Good day!

https://wiki.php.net/rfc/anonymous_classes

There's a little RFC + patch that Joe Watkins put together, and as
before with the ArrayOf RFC, I'll be helping out.

So, lets get this discussion rolling.

It was declined for PHP 5 some time ago, and has returned now to try for PHP 7.

The usage of anonymous classes to some will be instantly offensive,
but really it comes down to the use case. The usage of anonymous
functions compared to declared functions is pretty much the exact same
thing as anonymous classes.

Other than examples on the RFC, Fractal would certainly be happy to
have them: http://fractal.thephpleague.com/transformers/

Defining a class properly is certainly still going to be the majority
of uses of classes in PHP. That helps with the Optimizer, and helps
code reuse.

Sadly due to the way in which people have had ONE CLASS ONE FILE
drilled into their head since PEAR and continuing through Zend and
PSR-0, it can become a PITA to add some simple functionality if a
small class is needed for one tiny thing.

Anonymous functions alleviate that annoyance with a simple and
consistent feature that just give people a nice simple option to get
their jobs done, without hitting autoloaders and file systems to do
it.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to