rfc:namespace-visibility

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:namespace-visibility [2018/07/18 21:39] mdwheelerfc:namespace-visibility [2018/07/18 21:42] (current) mdwheele
Line 247: Line 247:
 </code> </code>
  
-In a completely separate space that shares no common namespace with ''\Example'', the only legal implementation is of the ''public'' interface from ''\Example''. All other implementations are illegal because they either don't share a namespace (in the ''protected'' case) or are not the *same* namespace (in the ''private'' case).+In a completely separate space that shares no common namespace with ''\Example'', the only legal implementation is of the ''public'' interface from ''\Example''. All other implementations are illegal because they either don't share a namespace (in the ''protected'' case) or are not the **same** namespace (in the ''private'' case).
  
 <code php> <code php>
Line 364: Line 364:
 <code php> <code php>
 namespace { namespace {
-    class InvalidChildClass extends \Example\PrivateClass {}            // ILLEGAL+    class InvalidChildClass extends \Example\PrivateClass {}           // ILLEGAL
     class InvalidImplementation implements \Example\PrivateInterface    // ILLEGAL     class InvalidImplementation implements \Example\PrivateInterface    // ILLEGAL
  
-    protected class ProtectedClass extends PublicClass {}               // legal+    protected class ProtectedClass extends PublicClass {}              // legal
     class AnotherImplementation implements \Example\PublicInterface {}  // legal     class AnotherImplementation implements \Example\PublicInterface {}  // legal
 } }
Line 400: Line 400:
 Developers can reflect on any class, interface or trait, regardless of visibility. Four new methods are added to ''ReflectionClass'': Developers can reflect on any class, interface or trait, regardless of visibility. Four new methods are added to ''ReflectionClass'':
  
-''ReflectionClass::isPublic'' - Checks if the method is public.  +  * ''ReflectionClass::isPublic'' - Checks if the method is public.  
-''ReflectionClass::isProtected'' - Checks if the method is protected.  +  ''ReflectionClass::isProtected'' - Checks if the method is protected.  
-''ReflectionClass::isPrivate'' - Checks if the method is private.  +  ''ReflectionClass::isPrivate'' - Checks if the method is private.  
-''ReflectionClass::setAccessible'' - Set method accessibility. +  ''ReflectionClass::setAccessible'' - Set method accessibility. 
  
 <code php> <code php>
Line 455: Line 455:
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
-Proposed PHP version depends on whether or not there will be a PHP 7.4 before PHP 8.0. This RFC prefers the earlier of the two. If there is a PHP 7.4, this RFC targets that. Otherwise, it targets PHP 8.0.+PHP 7.4
  
 ===== RFC Impact ===== ===== RFC Impact =====
rfc/namespace-visibility.1531949947.txt.gz · Last modified: 2018/07/18 21:39 by mdwheele