Skip to content

UseIdenticalOverEqualWithSameTypeRector should not trust phpdoc #6880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 5, 2025

Conversation

staabm
Copy link
Contributor

@staabm staabm commented May 5, 2025

No description provided.

@staabm
Copy link
Contributor Author

staabm commented May 5, 2025

I am adding a obvious fix, but I am not sure about it, as we see tests failling now - these tests obviously expected a trustfully phpdoc. do we agree these other tests expectations are wrong as they shouldn't trust the phpdoc in the same way?

I wonder whether we should/want to trust a array-shape when its produced by a php-src builtin function/method, but not when its based on a userland phpdoc (and whether we are able to differentiate the 2)? created a PHPStan upstream discussion.

@TomasVotruba
Copy link
Member

In this case, can we detect the type is being compared from an array shale?
If so, we should skip it.

I'd keep it for other cases, as so far the rule has beem reliable.

@staabm
Copy link
Contributor Author

staabm commented May 5, 2025

thanks for the suggestion. adapted accordingly

@staabm staabm marked this pull request as ready for review May 5, 2025 09:25
@samsonasik
Copy link
Member

Looking good, thank you @staabm

@samsonasik samsonasik merged commit fdbcc40 into rectorphp:main May 5, 2025
45 checks passed
@staabm staabm deleted the patch-1 branch May 5, 2025 12:18
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