-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#4289Labels
Description
Feature request
PHPstan tool is great tool and can be greater with this little feature ;)
https://phpstan.org/r/2cb586a7-3ade-448b-95cb-21641f483a1e
For now class constants are not supported in return array syntax. Maybe this can be changed?
<?php declare(strict_types = 1);
class HelloWorld
{
public const SOME_KEY = 'key';
/** @return array{HelloWorld::SOME_KEY: int} */
public function v1(): array
{
return [
self::SOME_KEY => 123,
];
}
/** @return array{self::SOME_KEY: int} */
public function v2(): array
{
return [
self::SOME_KEY => 123,
];
}
/** @return array{static::SOME_KEY: int} */
public function v3(): array
{
return [
static::SOME_KEY => 123,
];
}
}
Thank you for this tool, I cannot imagine work without PHPStan anymore ;)
Reactions are currently unavailable