Skip to content

Conversation

@ayrtonandino
Copy link
Contributor

This pr changes the output generated by ClientConstructorAssembler from:

use Phpro\SoapClient\Caller\Caller;
    
class MyClient
{
    /**
     * @var Caller
     */
    private $caller;

    public function __construct(\Phpro\SoapClient\Caller\Caller $caller)
    {

to:

class MyClient
{
    private \Phpro\SoapClient\Caller\Caller $caller;

    public function __construct(\Phpro\SoapClient\Caller\Caller $caller)
    {

Also upgrade laminas/laminas-code to latest version since GrumPHP didn't let me commit due to changes in laminas/laminas-code/pull/208

why this change

I'm using phpstan with tomasvotruba/type-coverage plugin, and the only missing type in my codebase is this Caller interface, it works the same and the type is already validated in the constructor, so It shouldn't break anything.

@veewee veewee requested a review from Copilot November 5, 2025 06:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the ClientConstructorAssembler to use PHP type declarations instead of PHPDoc annotations for the $caller property, improving type coverage for static analysis tools like PHPstan. The change modernizes the code generator to produce more explicit type declarations.

Key Changes:

  • Replaced PHPDoc @var annotations with native PHP type declarations for the $caller property
  • Upgraded laminas/laminas-code dependency to ^4.17.0 to support the new type generation approach
  • Removed the now-unused generateClassNameAndAddImport helper method

Reviewed Changes

Copilot reviewed 4 out of 21 changed files in this pull request and generated 2 comments.

File Description
src/Phpro/SoapClient/CodeGenerator/Assembler/ClientConstructorAssembler.php Refactored to use TypeGenerator for property types instead of DocBlock annotations; removed unused imports and helper method
test/PhproTest/SoapClient/Unit/CodeGenerator/Assembler/ClientConstructorAssemblerTest.php Updated test expectations to reflect new property declaration format without use statements or PHPDoc
docs/client.md Updated documentation example to show typed property declaration
composer.json Upgraded laminas/laminas-code to ^4.17.0 and allowed phpspec/phpspec ~8.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@veewee
Copy link
Contributor

veewee commented Nov 5, 2025

Thanks @ayrtonandino. Nice addition!
I've added some small remarks.

ayrtonandino and others added 2 commits November 5, 2025 09:45
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@veewee veewee merged commit 5c90538 into phpro:v4.x Nov 5, 2025
6 checks passed
@veewee
Copy link
Contributor

veewee commented Nov 5, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants