rfc:namespace-visibility
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:namespace-visibility [2018/07/18 21:27] – created mdwheele | rfc:namespace-visibility [2018/07/18 21:42] (current) – mdwheele | ||
---|---|---|---|
Line 89: | Line 89: | ||
- Public declarations will be visible from anywhere, which is the current behaviour. If no modifier is supplied, public shall be the default to maintain backwards compatibility with this behaviour. | - Public declarations will be visible from anywhere, which is the current behaviour. If no modifier is supplied, public shall be the default to maintain backwards compatibility with this behaviour. | ||
- | - Protected declarations will be visible from anywhere that *shares* a higher-level namespace with the target of the visibility modifier. For example, | + | - Protected declarations will be visible from anywhere that **shares** a higher-level namespace with the target of the visibility modifier. For example, |
- Private declarations will only be visible from the namespace in which they are declared. | - Private declarations will only be visible from the namespace in which they are declared. | ||
Line 153: | Line 153: | ||
</ | </ | ||
- | Because '' | + | Because '' |
<code php> | <code php> | ||
Line 165: | Line 165: | ||
new \Example\ProtectedClass(); | new \Example\ProtectedClass(); | ||
- | (new Factory())-> | + | (new Factory())-> |
new \Example\PublicClass(); | new \Example\PublicClass(); | ||
Line 247: | Line 247: | ||
</ | </ | ||
- | In a completely separate space that shares no common namespace with '' | + | In a completely separate space that shares no common namespace with '' |
<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 {} |
class InvalidImplementation implements \Example\PrivateInterface | class InvalidImplementation implements \Example\PrivateInterface | ||
- | protected class ProtectedClass extends PublicClass {} | + | 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 '' | Developers can reflect on any class, interface or trait, regardless of visibility. Four new methods are added to '' | ||
- | - '' | + | * '' |
- | - '' | + | |
- | - '' | + | |
- | - '' | + | |
<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.1531949278.txt.gz · Last modified: 2018/07/18 21:27 by mdwheele