Re: [RFC] Namespace-scoped declares, again
| From: | Michał Brzuchalski | Date: | Wed, 14 Aug 2019 10:17:16 +0000 |
| Subject: | Re: [RFC] Namespace-scoped declares, again | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106592@lists.php.net to get a copy of this message | ||
śr., 14 sie 2019 o 12:11 Rowan Collins <rowan.collins@gmail.com> napisał(a):
> On 14/08/2019 11:07, Michał Brzuchalski wrote:
> > Exactly so how would it know from string name either it should load class
> > from src/Foo.php or src/__nsmeta.php if there is no information?
>
>
> It wouldn't. It would include src/Foo.php, and that would have the
> definition of something with the name "Foo" - either a class, an
> interface, a trait, or a package. If it wasn't what the engine was
> expecting, it would be an error, just as it is right now if you write
> "implements ClassName", or "new TraitName();"
>
Following that would introduce unneeded additional directory hierarchy
level in a usual library
which uses PSR-4 which is the most used one, right?
/composer.json
/src/Foo.php
/src/Foo/ <- all package classes should go here?
--
regards / pozdrawiam,
--
Michał Brzuchalski
about.me/brzuchal
brzuchalski.com