-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
Refactor is_a #5907
Refactor is_a #5907
Conversation
@ondrejmirtes this is_a change 5ac198c seems cause error in test: 1) Rector\Tests\NetteToSymfony\Rector\Interface_\DeleteFactoryInterfaceRector\DeleteFactoryInterfaceFileSystemRectorTest::test with data set #0 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
61
Failed asserting that false is true. @TomasVotruba PHPStan notice seems unrelated as i tried in local and got same error with or without this change: vendor/bin/phpstan analyse --ansi --error-format symplify packages/BetterPhpDocParser/ValueObject/PhpDocNode/JMS/SerializerTypeTagValueNode.php
Note: Using configuration file /Users/samsonasik/www/rector/phpstan.neon.
PHP Fatal error: Class Rector\BetterPhpDocParser\ValueObject\PhpDocNode\JMS\SerializerTypeTagValueNode contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPStan\PhpDocParser\Ast\Node::hasAttribute) in /Users/samsonasik/www/rector/packages/BetterPhpDocParser/ValueObject/PhpDocNode/JMS/SerializerTypeTagValueNode.php on line 13
Fatal error: Class Rector\BetterPhpDocParser\ValueObject\PhpDocNode\JMS\SerializerTypeTagValueNode contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (PHPStan\PhpDocParser\Ast\Node::hasAttribute) in /Users/samsonasik/www/rector/packages/BetterPhpDocParser/ValueObject/PhpDocNode/JMS/SerializerTypeTagValueNode.php on line 13 |
@samsonasik I need to merge this #5841 first |
@TomasVotruba thank you 👍 |
@ondrejmirtes I got the patch about failing unit test, the UnionType need to check against ShortenedObjectType to make $returnType re-assigned with |
…ryInterfaceAnalyzer
c6b6055
to
e85db07
Compare
test error start from change 79f8698 - return is_a($currentType->getClassName(), $newType->getClassName(), true);
+ return $newType->isSuperTypeOf($currentType)->yes(); |
try check one by one, it seems caused by 2bc0a98 |
somehow, it fixed with return early on - if (! is_a($type->getClassName(), $countableObjectType->getClassName(), true)) {
- continue;
+ if ($countableObjectType->isSuperTypeOf($type)->yes()) {
+ return true;
+ } |
57452d7
to
ed79bce
Compare
fda3572
to
10cd42f
Compare
]); | ||
|
||
if ($returnType instanceof ShortenedObjectType) { | ||
$returnType = new ObjectType($returnType->getFullyQualifiedName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check work without this wraparound, as in other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without this check, it got error in test like in my previous comment #5907 (comment)
@ondrejmirtes I tried update other places, but got errors like in my previous comments, I rollback to only apply what you suggested in #5906 . |
I'll look into this |
Thank you 👍 |
rectorphp/rector-src@b2c9e52 [PostRector] Move instanceof check early before SimpleParameterProvider static call check (#5907)
Fixes #5906