Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented May 20, 2024

Solve #256 (cc @alexander-schranz)

By design, all the arguments can be null in Command::interact method.
Doing

/** @var string|null $market */
$market = $input->getArgument('market');

in the interact method is reported as an error by PHPStan so there is currently no satisfying solution except ignoring the error. And updating the dynamic return type extension seems doable.

}

$method = $scope->getFunction();
if ($method instanceof MethodReflection && $method->getName() === 'interact') {
Copy link
Member

Choose a reason for hiding this comment

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

You should also check the declaring class of the method. You might not be in a console command at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a new check 1dfe119

I'm not sure if there is a more optimised method for this.

@ondrejmirtes ondrejmirtes merged commit af6ae0f into phpstan:1.4.x May 30, 2024
@ondrejmirtes
Copy link
Member

Thank you.

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.

3 participants