> On Jul 3, 2024, at 8:24 PM, Michael Morris <[email protected]> wrote:
> On Wed, Jul 3, 2024 at 7:52 PM Mike Schinkel <[email protected] <mailto:[email protected]>> wrote:
> Me personally, the opinions that I do not like are the one-symbol-per file assumption, which is
> also a key issue I have with PSR-4.
>
> That's a PSR-4 issue, not an autoloader one. Autoloaders, even in composer, can use class
> maps to discover which file must be loaded to make the symbol accessible, even if multiple unused
> symbols in that file come along for the ride.
My statement you are commenting on was about spl_autoload
and PSR-4, full stop.
> 2. Symbol encapsulation — Allowing symbols to be hidden from code that should not use them.
>
> Uhm, I'm not formally trained so that one got by me - could you please give an example of
> this? I might have posted one already without realizing it.
Which part? Symbol, or Encapsulation?
If Symbols, that is just the collective name for classes, interfaces, enums, functions, constants
and variables.
If Encapsulation, then that means symbol hiding. PHP offers only limited forms of symbol hiding
with private
and protected
. Currently it is not possible in PHP to have a
top-level symbol in a namespace — vs. just a function, property or constant enclosed in and as
part of a class — that a developer can disallow other developers from accessing via regular access
methods, e.g. instantiating the class, implementing the interface, using the constant, calling the
function. etc.
Does that answer?
-Mike