this post was submitted on 02 Jul 2025
8 points (100.0% liked)

Programming

23 readers
8 users here now

My various programming endeavours, mainly in PHP (Symfony), Typescript (Angular), Go and C#. With a sprinkle of Java and C++ here and there.

founded 6 months ago
MODERATORS
 

This minor addition brings asymmetric visibility—already available for instance properties—to static properties as well.

Previously, this was valid syntax:

 final class PublicPrivateSetClass {
    public private(set) string $instanceProperty;
}

As of PHP 8.5, you can now do the same with static properties:

 final class PublicPrivateSetClass {
    public private(set) static string $staticProperty;
}

While not the most groundbreaking feature, it improves consistency in the language—which is always a welcome change.

you are viewing a single comment's thread
view the rest of the comments
[–] dominik@chrastecky.dev 2 points 3 weeks ago

I like it as well, recently had one use case where it would have been the best solution, sadly php-cs-fixer chokes on that so I had to do it with property hooks.