- Output for 5.5.0 - 5.5.33, 5.6.0 - 5.6.19, 7.0.0 - 7.0.5
- Parse error: syntax error, unexpected 'var_dump' (T_STRING) in /in/GO6gp on line 9
Process exited with code 255.
<?php
class Foo {
private $bar, $baz;
}
$foo_reflection = new ReflectionObject(new Foo)
var_dump(
array_map(
function (ReflectionProperty $prop) {
$visibility = null;
switch ($prop->getModifiers()) {
case ReflectionProperty::IS_PUBLIC:
$visibility = 'public';
break;
case ReflectionProperty::IS_PROTECTED:
$visibility = 'protected';
break;
case ReflectionProperty::IS_PRIVATE:
$visibility = 'private';
break;
}
return [
'Name' => $prop->getName(),
'Visibility' => $visibility,
];
},
$foo_reflection->getProperties()
)
);