Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Oct 9, 2025

No description provided.

Comment on lines -46 to -47
-
identifier: argument.type
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since argument types were ignored, the root cause for #552 was not detected.

@staabm staabm marked this pull request as ready for review October 9, 2025 19:07
@staabm staabm changed the title Fix PHPStan error Fix PHPStan errors Oct 9, 2025
@staabm staabm changed the title Fix PHPStan errors Fix argument.type PHPStan errors Oct 9, 2025

// must respect PHPStan anonymous internal naming \Rector\NodeTypeResolver\PHPStan\Scope\PHPStanNodeScopeResolver::ANONYMOUS_CLASS_START_REGEX
return new Class_('AnonymousClass1234', [
// @phpstan-ignore argument.type
Copy link
Member

Choose a reason for hiding this comment

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

We don't use inline ignores by convention. Better use assert or fix this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to be hones, I did not understand what the error is about at this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

send a try and error fix

if (! $expr->value instanceof Array_) {
return null;
}

Copy link
Member

Choose a reason for hiding this comment

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

👍

return null;
}

$matchedNullableVariableNameToType = $variableNameToTypeCollection->matchByVariableName($variableName);
Copy link
Member

Choose a reason for hiding this comment

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

👍

@samsonasik
Copy link
Member

samsonasik commented Oct 9, 2025

@staabm please run:

vendor/bin/rector && composer fix-cs

thank you.

throw new NotImplementedYetException();
}

if (! $className instanceof Name) {
Copy link
Member

Choose a reason for hiding this comment

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

probably need test for $firstArg->value is a String_, not Foo::class, but "Foo", so if it is a String_, use its value, also possibly verify by value via ValueResolver, but that can be later 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, please do this for me.

I did not plan to deep dive into this codebase :)

@staabm
Copy link
Contributor Author

staabm commented Oct 10, 2025

Ready to land

@samsonasik samsonasik merged commit 948ddb1 into rectorphp:main Oct 10, 2025
6 checks passed
@samsonasik
Copy link
Member

Thank you @staabm

@staabm staabm deleted the fix2 branch October 10, 2025 06:35
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