|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-10-07 12:55 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
[2019-10-07 12:55 UTC] nikic@php.net
[2019-10-07 13:17 UTC] alan at aondra dot com
[2019-10-07 14:13 UTC] requinix@php.net
-Package: PHP Language Specification
+Package: Reflection related
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 17:00:02 2025 UTC |
Description: ------------ With the introduction of typed class properties, there is also the nullable flag represented as a question mark, for example: class Foo { public ?string $bar; } In keeping with the naming convention in ReflectionParameter and ReflectionType, the request is to also include a method with this name in the ReflectionProperty. Test script: --------------- class Foo { public ?string $bar; public string $baz; } $barMeta = new ReflectionProperty(Foo::class, 'bar'); $bazMeta = new ReflectionProperty(Foo::class, 'baz'); var_dump( $barMeta->allowsNull() ); var_dump( $bazMeta->allowsNull() ); Expected result: ---------------- true false