The past few years have been interesting. As of April 2024, I was still fixing multiple breaking changes from PHP 8.1.
Now that we're up and running with PHP 8.4, there are some decisions needed about XMB 1.
If we are going to keep this project alive, there will have to be changes. I am no longer testing anything on PHP 7 and recently uninstalled my last
copy of PHP 7.4. Here is what we gain by dropping PHP 7.0:
- PHP 7.1 added nullable types. This is a big deal for type hinting optional parameters.
- PHP 7.4 added type declarations for class properties. This is a big deal for strong typing within object oriented code (we have some of that).
- PHP 7.4 added the null coalescing assignment operator.
- PHP 8.0 added property promotion. This can be used (it's a style choice) to create class properties inside the constructor using less code. Very
helpful when writing dependency injection patterns.
- PHP 8.0 added named arguments. This makes it easier to work with complex functions.
- PHP 8.1 added Enumerations. This helps to standardize lists of constants.
In addition to those benefits, there's more to consider. Security support of PHP 8.0 ended a year ago, and I no longer have any copies of it that I
would use for testing. Active support of PHP 8.1 ended a year ago, and will be on security support for the next year only.
Compare this to the current requirements,
https://docs.xmbforum2.com/index.php?title=Requirements#PHP
So I'm proposing to drop PHP 7, and also to
raise the PHP requirement to either 8.1 or 8.2. I definitely don't want to accommodate
or be shackled to older versions of PHP for the lifetime of our XMB release cycle. This is a significant change, so it would happen in a new XMB
number 1.9.13 or equivalent.
Along with those changes, it's time to start implementing some degree of "dependency injection." At the most basic level, XMB needs to end its
extensive use of
global statements, and start removing some of the variables that had always lived in
global scope. The area of XMB most sensitive to global variable changes is the template system. That most likely means finding a better way of
passing variables from input to output, and designing at least a barebone template processor function to replace all of the
echo statements currently in use with templates. The last thing anyone wants is a long list of broken templates or extensive
breaking changes as we've seen with the PHP 8 updates, so this has to work properly.
I'm not presently of the opinion that XMB 1 is ending. It just needs some adjustments to make it easier to maintain in the future. Whether or not
that might inspire some new projects is still the big question.