Skip to content

Conversation

carlos-granados
Copy link
Contributor

Derived from #6794

@@ -127,10 +127,10 @@ public function refactor(Node $node): null|Function_|ClassMethod

$hasChanged = $this->phpDocTypeChanger->changeReturnType($node, $functionLikePhpDocInfo, $arrayType);
if ($hasChanged) {
return null;
return $node;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The logic here was reversed

Copy link
Member

@TomasVotruba TomasVotruba Mar 20, 2025

Choose a reason for hiding this comment

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

Thanks 👍

We could catch these with a simple PHPStan rule

Copy link
Contributor

@staabm staabm Mar 31, 2025

Choose a reason for hiding this comment

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

I wonder why the reversed logic did not make any unit test fail (seems we are missing test-coverage)

@TomasVotruba TomasVotruba merged commit 45e746b into rectorphp:main Mar 20, 2025
44 checks passed
@carlos-granados carlos-granados deleted the fix-AddReturnArrayDocblockBasedOnArrayMapRector branch March 21, 2025 08:24
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