Hi, similar to the abstract and readonly modifiers to classes (similar
in syntax only), I propose a class level "static" modifier that ensures:
1. The class cannot be instantiated and will throw an exception if
attempted.
2. All methods and variables in the class are implicitly static.
3. (optional based on community input) It should have the same effect on
traits and interfaces
For example:
static class X {
const int k = 1;
private string $a
function foo():void{}
private function bar():void{}
}
would be equivalent to
class X {
const int k = 1;
private static string $a
public static function foo():void{}
private static function bar():void{}
}
and so on. I will be implementing this myself it it gets approved.
Cheers,
Lanre
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php