Skip to content

UseIdenticalOverEqualWithSameTypeRector should not trust phpdoc#6880

Merged
samsonasik merged 4 commits intorectorphp:mainfrom
staabm:patch-1
May 5, 2025
Merged

UseIdenticalOverEqualWithSameTypeRector should not trust phpdoc#6880
samsonasik merged 4 commits intorectorphp:mainfrom
staabm:patch-1

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented May 5, 2025

No description provided.

@staabm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants