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
Added integer range phpdoc support #596
Conversation
I have not really a idea where to start more in detail investigation of the test is currently failling with
|
As I said it needs to be implemented in TypeNodeResolver, specifically in |
sorry, I mixed up
thx for the hint, this was really usefull I was able to implement the minmal test-cases which came to my mind. I am pretty sure you will not like the if-cases arround the |
src/PhpDoc/TypeNodeResolver.php
Outdated
if ($minType instanceof ConstantIntegerType) { | ||
$min = $minType->getValue(); | ||
} elseif ($minType instanceof ObjectType) { | ||
if ($minType->getClassName() === "PHPStan\Generics\GenericClassStringType\min") { |
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.
This doesn't make sense, it's not going to work in a different namespace. Try looking for IdentifierTypeNode in $typeNode->genericTypes
instead.
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.
lol, after reading your comment, I realized why the class-name contained this PHPStan prefixed string, which I initially thought of is a magic-value ;-)
changed the impl to use IdentifierTypeNode
and added a few more testcases.
thanks again for your input
@@ -83,7 +83,7 @@ public static function decode(array $data): ExportedNode | |||
$data['public'], | |||
$data['private'], | |||
$data['final'], | |||
$data['phpDoc'], | |||
$data['phpDoc'] !== null ? ExportedPhpDocNode::decode($data['phpDoc']['data']) : null |
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.
Fyi, This change was not added by me
3f1ad27
to
fdf3d0e
Compare
Just rebased and force-pushed this. Thank you! |
as suggested in phpstan/phpstan#3383 (comment) I added a failling unit test and started to look arround in
TypeNodeResolver
.