note 130252 added to language.namespaces.definition

From: Date: Wed, 16 Apr 2025 17:59:27 +0000
Subject: note 130252 added to language.namespaces.definition
Groups: php.notes 
Request: Send a blank email to php-notes+get-222091@lists.php.net to get a copy of this message
As of PHP 8.1, not only classes (including abstracts and traits), interfaces, functions, and constants are affected by namespaces, but also enums. <?php namespace App\Types; enum Colors { case Red; case Green; } $reflection = new \ReflectionEnum('App\Types\Colors'); var_dump($reflection->getName()); // string(16) "App\Types\Colors" var_dump($reflection->getNamespaceName()); // string(9) "App\Types" ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 185.53.133.77) ---- Manual Page -- https://php.net/manual/en/language.namespaces.definition.php Edit -- https://main.php.net/note/edit/130252 Del: integrated -- https://main.php.net/note/delete/130252/integrated Del: useless -- https://main.php.net/note/delete/130252/useless Del: bad code -- https://main.php.net/note/delete/130252/bad+code Del: spam -- https://main.php.net/note/delete/130252/spam Del: non-english -- https://main.php.net/note/delete/130252/non-english Del: in docs -- https://main.php.net/note/delete/130252/in+docs Del: other reasons-- https://main.php.net/note/delete/130252 Reject -- https://main.php.net/note/reject/130252 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222091) next »