Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106595 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78995 invoked from network); 14 Aug 2019 12:58:35 -0000 Received: from unknown (HELO poczta.brzuchalski.com) (188.165.245.118) by pb1.pair.com with SMTP; 14 Aug 2019 12:58:35 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id 368C9298423A for ; Wed, 14 Aug 2019 12:27:12 +0200 (CEST) Received: from poczta.brzuchalski.com ([127.0.0.1]) by localhost (poczta.brzuchalski.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iEVYZXcRGSoR for ; Wed, 14 Aug 2019 12:27:08 +0200 (CEST) Received: from mail-ot1-f41.google.com (unknown [209.85.210.41]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id 4B6772984236 for ; Wed, 14 Aug 2019 12:27:08 +0200 (CEST) Received: by mail-ot1-f41.google.com with SMTP id q20so28226145otl.0 for ; Wed, 14 Aug 2019 03:27:08 -0700 (PDT) X-Gm-Message-State: APjAAAVc9xyq9fQ2+0Jrco8wHDeru68bKCG0WkGSg9Lpp3lOAc3EOiNq 92hjHFJQ5TiXh7zvZ7H2nEtQzM9qeNiVg3rHtp0= X-Google-Smtp-Source: APXvYqxmQ+1tnPJNHwGqeF6zes7meeMvgXxiG+LErrvEUj8Yz5KdjayslhHGcPeZcnOstLcsJHOM8Ji/WLZHI3btyBU= X-Received: by 2002:a9d:518e:: with SMTP id y14mr6557154otg.259.1565778427429; Wed, 14 Aug 2019 03:27:07 -0700 (PDT) MIME-Version: 1.0 References: <25d774e8-183b-d39c-4ac4-81c1b7770229@gmail.com> <5d5298a5.1c69fb81.b4ed1.2d97SMTPIN_ADDED_MISSING@mx.google.com> <3db68c5e-54d1-812f-bbf5-1b089cba1bff@gmail.com> <5d52f72d.1c69fb81.8f95f.57a1SMTPIN_ADDED_MISSING@mx.google.com> <2bcb05d6-abf6-4fcb-599e-eaf4bcd58878@gmail.com> <182a6bd5-4057-7ba1-2cca-ab0be37e0b75@gmail.com> <72896017-20d0-16af-b188-8500777f947b@gmail.com> <00eea416-23be-6629-2e94-4cfa9f5fcb39@gmail.com> In-Reply-To: Date: Wed, 14 Aug 2019 12:26:55 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000f6ca0105901132c6" Subject: Re: [PHP-DEV] [RFC] Namespace-scoped declares, again From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --000000000000f6ca0105901132c6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =C5=9Br., 14 sie 2019 o 12:17 Micha=C5=82 Brzuchalski napisa=C5=82(a): > > > =C5=9Br., 14 sie 2019 o 12:11 Rowan Collins > napisa=C5=82(a): > >> On 14/08/2019 11:07, Micha=C5=82 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? > Going even further by the example of Doctrine libraries: # doctrine/collections - Composer Package [1] uses PSR-4 autoload with "Doctrine\\Common\\Collections\\" prefix to adopt package concept it would have to change the prefix to "Doctrine\\Common\\" to find Collections.php and all the rest of source code in Collections directory # doctrine/common - Composer Package [2] uses "Doctrine\\Common\\" prefix should change into "Doctrine\\" to be able to load Common.php and the rest of source code in Common directory # ocramius/package-versions - Composer Package [3] uses "PackageVersions\\" prefix and then what? [1] https://github.com/doctrine/collections/blob/master/composer.json [2] https://github.com/doctrine/common/blob/master/composer.json [3] https://github.com/Ocramius/PackageVersions/blob/master/composer.json --=20 regards / pozdrawiam, -- Micha=C5=82 Brzuchalski about.me/brzuchal brzuchalski.com --000000000000f6ca0105901132c6--