←back to thread

PHP 8.5

(stitcher.io)
214 points brentroose | 1 comments | | HN request time: 0s | source
Show context
darkamaul ◴[] No.45990664[source]
PHP's evolution since PHP 5 has been substantial, and I think this is a real problem. As someone who learned the language years ago, the pace of change (generics, attributes, match expressions, typed properties) makes modern codebases genuinely difficult to follow.

I suspect this affects many developers who cut their teeth on PHP but haven't kept up. The language has become a different beast, which is a strength for the community but a barrier to re-entry.

replies(12): >>45990804 #>>45990834 #>>45990835 #>>45990949 #>>45991400 #>>45992500 #>>45992620 #>>45992776 #>>45993443 #>>45993687 #>>45995052 #>>45995108 #
gramakri2 ◴[] No.45990804[source]
IMO, newer PHP is still very readable. I programmed with C++ for a decade, but I can safely say that I cannot understand a modern C++ code base anymore.
replies(1): >>45993606 #
idoubtit ◴[] No.45993606[source]
Are the new features really readable? I have no idea what this code from the OP is meant for:

    #[SkipDiscovery(static function (Container $container): bool {
        return ! $container->get(Application::class) instanceof ConsoleApplication;
    })]
    final class BlogPostEventHandlers
    { /* … */ }
As a side note, even PHP's official wiki cannot highlight correctly the multiline attributes behind a "#". See https://wiki.php.net/rfc/closures_in_const_expr
replies(2): >>45993865 #>>45996683 #
1. TimWolla ◴[] No.45993865[source]
The examples in TFA are terrible and I don't get why it was necessary to jump the gun by submitting that article instead of actually waiting for the release and the official release page with more carefully designed examples.

Given that the cat effectively is out of the bag, does the example on the release page (sneak preview) make more sense to you: https://www.php.net/releases/8.5/en.php#closures-in-const-ex...?

> As a side note, even PHP's official wiki cannot highlight correctly the multiline attributes behind a "#"

Yes, unfortunately the off-the-shelf software of the Wiki uses a custom-built highlighter instead of the `highlight_string()` function that is bundled with PHP: https://www.php.net/manual/en/function.highlight-string.php