Feature request
Currently, the isFinal() mark final even on non-native constant:
/**
* @final
*/
public const BAR = 'Bar';
Like ClassReflection, I think isFinalByKeyword() should be added for detect native final. Currently, the workaround is to be something like:
// Get the native ReflectionClassConstant
$declaringClass = $reflection->getDeclaringClass();
$nativeReflectionClass = $declaringClass->getNativeReflection();
$constantName = $reflection->getName();
// ensure native ->isFinal() exists
// @see https://3v4l.org/korKr#v8.0.11
if (PHP_VERSION_ID >= 80100) {
$nativeReflection = $nativeReflectionClass->getReflectionConstant($constantName);
$memberIsFinal = $nativeReflection instanceof ReflectionClassConstant && $nativeReflection->isFinal();
} else {
$memberIsFinal = false;
}
Did PHPStan help you today? Did it make you happy in any way?
No response