Thank you for bringing those threads to my attention. I hadn't
encountered them before, but it appears to be the typical argument of "I
don't want this, so you shouldn't," along with "why do x when you can
just do y (notice how y is not x)."
1. I will personally implement this feature.
2. This change is non-breaking and backward compatible.
3. It is entirely opt-in. If you hold reservations about using static
classes, you can simply choose not to use them.
The proposal is designed with the intention of improving code clarity,
reinforcing design principles, and establishing a clear and standardized
approach to expressing the intended usage of a class. While I advocate
for member properties and methods to be implicitly static, I am open to
understanding alternative viewpoints on why this might not be the
optimal choice.
Cheers,
Lanre.
On 2023-11-20 12:52 a.m., Rowan Tommins wrote:
On 19 November 2023 21:28:08 GMT, Lanre Waju <la...@online-presence.ca> wrote:
Hi, similar to the abstract and readonly modifiers to classes (similar in syntax only), I
propose a class level "static" modifier that ensures:
Hi Lanre,
There was a proposal for this several years ago which was declined at the
voting stage: https://wiki.php.net/rfc/abstract_final_class
That doesn't mean we can't look again, but any new proposal would need to at
least address the reasons the previous one was declined. I believe these are
the relevant discussion threads: https://externals.io/message/79211
https://externals.io/message/79338 https://externals.io/message/79601
My memory is that one of the main points against was that a class with only
static methods is just a namespace, and you can already put functions directly
in a namespace. The only issue being that we don't have good autoloading
support for such functions, and that's a whole different problem...
Regards,
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php