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
implement LtrimFunctionReturnTypeExtension to support class-string #1597
Conversation
@@ -0,0 +1,17 @@ | |||
<?php declare(strict_types=1); | |||
|
|||
namespace Bug7483; |
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.
I tried supporting things like
function bar() {
$absolute = '\A';
$relative = 'A';
assertType('class-string', ltrim($absolute, '\\'));
assertType('class-string', ltrim($relative, '\\'));
}
but from the extension point of view these strings seem not to be class-strings...?
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.
ConstantStringType::isClassString() is just a hint whether the string was created from ::class, so that we don't trigger the autoloading for irrelevant strings, which upsets some custom autoloaders.
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.
So you don't need to do anything about it.
@@ -0,0 +1,17 @@ | |||
<?php declare(strict_types=1); | |||
|
|||
namespace Bug7483; |
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.
ConstantStringType::isClassString() is just a hint whether the string was created from ::class, so that we don't trigger the autoloading for irrelevant strings, which upsets some custom autoloaders.
Thank you. |
closes phpstan/phpstan#7483