The PHP community is currently discussing an important new feature: static classes.
This proposal, outlined in the RFC by Paul Morris, introduces the concept of a static class, which is a class that cannot be instantiated and whose members are all static.
The proposal aims to incorporate this feature in PHP version 8.4, or in the next one. The RFC is currently under discussion, and its adoption could bring significant changes to how developers express intent and ensure class behaviors at compile-time.
A static class in PHP, as proposed, is a class marked with the static
keyword. This marking means the class cannot be instantiated, and all its properties and methods must be static. The proposal highlights several benefits of explicitly marking a class as static:
The proposal includes several specific features and rules for static classes:
static
keyword is used at the class level.
static class Foo {}
new
, ReflectionClass::newInstance*
, or unserialize
) will result in a runtime error.final
, but if it is not, it can still be extended. Static classes may extend other static or non-static classes provided they do not contain instance members.__callStatic()
, are supported.The proposal raises several questions and design considerations:
final
?The proposal suggests that the static
keyword should still be required for member declarations within a static class, despite the class itself being marked as static. This decision is to ensure clarity throughout the class body, especially for developers jumping into different parts of the class.
The proposal asserts that there are no known backward-incompatible changes associated with introducing static classes. The feature is considered complete by itself, but there is room for future enhancements, such as supporting read-only static properties if technical limitations are overcome.
The community is invited to discuss and provide feedback on the proposal. A draft pull request by Lanre is available for review, and the proposal includes references to similar features in other programming languages, like C#.
The introduction of static classes in PHP aims to bring more robust and explicit design patterns to the language, providing clear developer intent and stringent compile-time and runtime checks.
As the PHP community discusses this RFC, the potential adoption in PHP 8.4 could mark a significant step forward in PHP's evolution, aligning it more closely with features available in other modern programming languages.
For more details and to participate in the discussion, you can view the full RFC.
Do you own a company or need help with your Laravel project? I can help you with that. Check the plans and let me know if you have any questions.
Get 1 month free with yearly plan during checkout.
$ 3 ,995
/m
What's included:
$ 5 ,995
/m
What's included:
Ok, just book a call now.
Good question! For starters, the annual cost of a full-time senior-level developer now exceeds $100,000, plus benefits (and good luck finding one available).
Aside from that, you may not always have enough work to keep them busy at all times, so you're stuck paying for time you aren't able to utilize.
With the monthly plan, you can pause and resume your subscription as often as you need to ensure you're only paying your developer when you have work available for them.
No, once subscribed you're able to request as many things as you'd like, and they will be delivered one by one.
Delivery will always be fast without compromising quality. Very complex requests will be divided into smaller products for continuous delivery.
Always, before starting to work, we can make a planning so that you know, before starting, when each change will be delivered.
You'll work directly with me, the founder and only person behind DeveloperJoy.
We understand you may not have enough work to fill up entire month. Perhaps you only have one or two requests at the moment. That's where pausing your subscription comes in handy.
Billing cycles are based on 31 day period. Let's say you sign up and use the service for 21 days, and then decide to pause your subscription. This means that the billing cycle will be paused and you'll have 10 days of service remaining to be used anytime in the future
I had experience making products with PHP, Go, and JavaScript/TypeScript.
Also I feel really comfortable working with WordPress, Laravel, Symfony, Vue.js, React, Svelte, and more.
Mail me and we will see how best to collaborate.
You can make this request by email, sharing a task board with me or, depending on your plan, by call or Slack.
That's fine. You can pause your subscription when finished and return when you have additional requests needs. There's no need to let the remainder of your subscription go to waste.
Due to the high quality nature of the work, there will be no refunds issued.