ParentClass { public $property = 1; } function getProperty(ParentClass $a) { echo $a->property; } getProperty(new ChildClass()); //will work, since $property is defined in Child getProperty(new ParentClass()); //won't work, since $property is not defined in Parent 動的プロパティは静的解析で検知できるのか https://pleiades.io/help/phpstorm/php-possible-polymorphic-call.html より 24
Error exception. if ($user->admin) { $restricted = false; } if ($restricted) { die('You do not have permission to be here'); } (おまけ)PHP 9 で例外になる愉快な仲間たち https://wiki.php.net/rfc/undefined_variable_error_promotion より 39
null) {} // PHP 8.4: Deprecated: Implicitly marking parameter $var as nullable is deprecated, // the explicit nullable type must be used instead // PHP 9: remove support for implicitly nullable types in PHP 9 // こうやって書く function foo(?T $var = null) {} function foo(T|null $var = null) {} (おまけ)PHP 9 で例外になる愉快な仲間たち https://wiki.php.net/rfc/deprecate-implicitly-nullable-types より 42