note 127859 added to language.oop5.late-static-bindings
| From: | MikeT at main dot php dot net | Date: | Tue, 25 Oct 2022 11:52:01 +0000 |
| Subject: | note 127859 added to language.oop5.late-static-bindings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219811@lists.php.net to get a copy of this message | ||
Word of caution static::class doesn't always work as you might expect
<?php
namespace NameSpace;
class Class
{
static function getClass()
{
return static::class;
}
}
Class::getClass()
?>
may return \NameSpace\Class or Class depending on context
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.161 (proxied: 82.18.233.3)
----
Manual Page -- https://php.net/manual/en/language.oop5.late-static-bindings.php
Edit -- https://main.php.net/note/edit/127859
Del: integrated -- https://main.php.net/note/delete/127859/integrated
Del: useless -- https://main.php.net/note/delete/127859/useless
Del: bad code -- https://main.php.net/note/delete/127859/bad+code
Del: spam -- https://main.php.net/note/delete/127859/spam
Del: non-english -- https://main.php.net/note/delete/127859/non-english
Del: in docs -- https://main.php.net/note/delete/127859/in+docs
Del: other reasons-- https://main.php.net/note/delete/127859
Reject -- https://main.php.net/note/reject/127859
Search -- https://main.php.net/manage/user-notes.php