mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Add "final" and "abstract" to the result of `_property_string()` when outputting the string representation of a `ReflectionClass` or `ReflectionProperty` instance Closes GH-17827
35 lines
799 B
PHP
35 lines
799 B
PHP
--TEST--
|
|
ReflectionProperty::is{Private,Protected}Set
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
public private(set) int $bar;
|
|
public protected(set) int $baz;
|
|
}
|
|
|
|
function test($property) {
|
|
$reflectionProperty = new ReflectionProperty(Foo::class, $property);
|
|
var_dump($reflectionProperty->isPrivateSet());
|
|
var_dump($reflectionProperty->isProtectedSet());
|
|
var_dump(($reflectionProperty->getModifiers() & ReflectionProperty::IS_PRIVATE_SET) !== 0);
|
|
var_dump(($reflectionProperty->getModifiers() & ReflectionProperty::IS_PROTECTED_SET) !== 0);
|
|
echo $reflectionProperty;
|
|
}
|
|
|
|
test('bar');
|
|
test('baz');
|
|
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
Property [ final public private(set) int $bar ]
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|
|
Property [ public protected(set) int $baz ]
|