-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
While working on pepakriz/phpstan-exception-rules#138
I get the following results in
new ReflectionClass(static::class);
the static::class is a
object(PHPStan\Type\Constant\ConstantStringType)#24493 (2) {
["value":"PHPStan\Type\Constant\ConstantStringType":private]=>
string(65) "Pepakriz\PHPStanExceptionRules\Rules\PhpInternalFunctions\Example"
["isClassString":"PHPStan\Type\Constant\ConstantStringType":private]=>
bool(false)
}
When in
new ReflectionClass(self::class);
the self::class is a
object(PHPStan\Type\Constant\ConstantStringType)#24464 (2) {
["value":"PHPStan\Type\Constant\ConstantStringType":private]=>
string(65) "Pepakriz\PHPStanExceptionRules\Rules\PhpInternalFunctions\Example"
["isClassString":"PHPStan\Type\Constant\ConstantStringType":private]=>
bool(true)
}
Does the fact that the bool value is different is correct ? @ondrejmirtes
But more important in
new ReflectionClass(rand(0, 1) === 0 ? self::class : Throwable::class);
the argument is
object(PHPStan\Type\Constant\ConstantStringType)#25258 (2) {
["value":"PHPStan\Type\Constant\ConstantStringType":private]=>
string(65) "Pepakriz\PHPStanExceptionRules\Rules\PhpInternalFunctions\Example"
["isClassString":"PHPStan\Type\Constant\ConstantStringType":private]=>
bool(true)
}
[1]=>
object(PHPStan\Type\Constant\ConstantStringType)#25269 (2) {
["value":"PHPStan\Type\Constant\ConstantStringType":private]=>
string(9) "Throwable"
["isClassString":"PHPStan\Type\Constant\ConstantStringType":private]=>
bool(true)
}
But as soon as I changed self by static
new ReflectionClass(rand(0, 1) === 0 ? static::class : Throwable::class);
the ConstantStringType become a
PHPStan\Type\Generic\GenericClassStringType
This behaviour exists since the version 0.12.55.
In 0.12.54, it was correctly
array(2) {
[0]=>
object(PHPStan\Type\Constant\ConstantStringType)#24409 (2) {
["value":"PHPStan\Type\Constant\ConstantStringType":private]=>
string(65) "Pepakriz\PHPStanExceptionRules\Rules\PhpInternalFunctions\Example"
["isClassString":"PHPStan\Type\Constant\ConstantStringType":private]=>
bool(true)
}
[1]=>
object(PHPStan\Type\Constant\ConstantStringType)#24420 (2) {
["value":"PHPStan\Type\Constant\ConstantStringType":private]=>
string(9) "Throwable"
["isClassString":"PHPStan\Type\Constant\ConstantStringType":private]=>
bool(true)
}
}
(But it weird that isClassString is true, when it's false for new ReflectionClass(static::class);)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels