You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of PHP 7.0, support for anonymous functions is no longer required - we now have support for anonymous classes that actually implement the middleware-interface, which is much cleaner and safer.
As middleman already requires 7.0, we can drop support for function in the next major release.
Documentation should be updated to use anonymous classes instead of functions.
When support for legacy PSR-15 interfaces is removed as well, we should be able to get rid of all conditionals in the dispatcher and go completely strict on type-safety.
The text was updated successfully, but these errors were encountered:
Okay, so PHP 7 did introduce anonymous classes, and they probably are both safer and cleaner - but, unfortunately, they do not support closure, as anonymous functions do, which makes them incredibly verbose and inconvenient where closure is required, e.g. forcing you to declare a constructor and initialize private properties, where functions let you do the same with just a use declaration.
In PHP 8, short arrow functions make this even more convenient.
Also, this feature isn't complex, it's literally two lines of code.
I'm keeping support for closures and dropping this change from the roadmap.
As of PHP 7.0, support for anonymous functions is no longer required - we now have support for anonymous classes that actually implement the middleware-interface, which is much cleaner and safer.
As middleman already requires 7.0, we can drop support for function in the next major release.
Documentation should be updated to use anonymous classes instead of functions.
When support for legacy PSR-15 interfaces is removed as well, we should be able to get rid of all conditionals in the dispatcher and go completely strict on type-safety.
The text was updated successfully, but these errors were encountered: