[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-cvs
Subject:    Re: [DOC-CVS] svn: /phpdoc/en/trunk/language/oop5/ basic.xml
From:       Christoph Becker <cmbecker69 () gmx ! de>
Date:       2016-01-15 16:48:01
Message-ID: 569922C1.30503 () gmx ! de
[Download RAW message or body]

Peter Cowburn wrote:

> On 15 January 2016 at 13:31, Christoph Michael Becker <cmb@php.net> wrote:
> 
>> cmb                                      Fri, 15 Jan 2016 13:31:35 +0000
>>
>> Revision: http://svn.php.net/viewvc?view=revision&revision=338498
>>
>> Log:
>> ::class is a compile time transformation
>>
>> Changed paths:
>>     U   phpdoc/en/trunk/language/oop5/basic.xml
>>
>> Modified: phpdoc/en/trunk/language/oop5/basic.xml
>> ===================================================================
>> --- phpdoc/en/trunk/language/oop5/basic.xml     2016-01-15 13:24:06 UTC
>> (rev 338497)
>> +++ phpdoc/en/trunk/language/oop5/basic.xml     2016-01-15 13:31:35 UTC
>> (rev 338498)
>> @@ -380,6 +380,14 @@
>>       </screen>
>>      </example>
>>     </para>
>> +   <note>
>> +    <para>The class name resolution using <literal>::class</literal> is a
>> +     compile time transformation. That means at the time the class name
>> string
>> +     is created no autoloading has happened yet. As a consequence, class
>> names
>> +     are expanded even if the class does not exist. No error is issued in
>> +     that case.
>> +    </para>
>> +   </note>
>>
> 
> I don't think we need to justify why the autoloader isn't called here.  A
> sentence saying that the autoloader is not called would be sufficient in my
> eyes. Also, if you want to keep the justification description, note that
> "::class" is not compile-time only, it can also be used for runtime lookups
> such as "static::class".

This commit was actually contributed by Dennis Birkholz via PhDOE.  If I
remember correctly it was a follow up to some discussion on internals or
a bug report, and the main point was the fact that classes are not
checked for existance, i.e. Foo::class "works" even if class Foo is not
defined.

In my opinion this "detail" should be documented.  I'm not sure about
the wording, though.  Maybe Dennis, whom I've CC'd has some idea/can
clarify.

-- 
Christoph M. Becker


-- 
PHP Documentation Commits Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic