Four out of five

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Sebastian Bergmann evaluates PHP's standing against the consensus criteria of modern language design — closures, objects, pattern matching, and type parametricity — using the Rhombus language's goal statement as a framework. PHP 8.5 and 8.6 bring partial function application, pipe operator, clone-with, and URI extensions. Pattern matching via the RFC by Garfield and Tovilo is in progress but missed PHP 8.6, likely landing in 8.7. On generics, erased generics were deliberately rejected to preserve PHP's runtime-checked type invariant; runtime-checked generics are the planned path. The docblock type language (PHPStan/Psalm) serves as PHP's de facto extensibility mechanism, delivering generics and shape types without RFC votes. Bergmann concludes PHP scores four out of five on the modern language checklist, with strong domain-fit for web workloads through its shared-nothing execution model, secure session defaults, and correct URL parsing in the standard library.

9m read timeFrom phpunit.expert
Post cover image
Table of contents
Rhombus's checklistExtensibility, accidentallyThe domain commitmentWhere this leaves us

Questions this post answers

Why were erased generics rejected for PHP 8.6?

Erased generics were rejected because PHP has enforced native types at runtime since PHP 5.0, and introducing syntax that looks like a type check but is silently not enforced at runtime would break that invariant. Unlike Java or TypeScript, PHP has no mandatory separate compilation step to catch type errors before execution. JetBrains Developer Ecosystem Survey data shows PHPStan and Psalm adoption is well under half of PHP developers, so the assumption that everyone uses static analysis does not hold. PHP developers tracking the generics roadmap find the internals debate and RFC updates on daily.dev.

What does the PHP pattern matching RFC introduce and when will it ship?

The Pattern Matching RFC by Larry Garfield and Ilija Tovilo introduces an `is` comparison operator supporting type patterns (`$value is int|float`), object patterns with property matching and variable binding (`$p is Point(x: 3, y: $y)`), and array shape patterns. A `match ($value) is { ... }` construct combines them. It missed the PHP 8.6 feature window and is expected to ship with PHP 8.7. Developers planning PHP upgrades around pattern matching can track the RFC progress on daily.dev.

What new features did PHP 8.5 and PHP 8.6 add to closures and functional programming?

PHP 8.5 extended closures into constant expressions (usable in attribute arguments and property/parameter defaults) and added the pipe operator `|>`. PHP 8.6 adds partial function application — `strlen(?)` produces a closure with a hole — enabling genuine function composition with `|>`. PHP 8.6 also optimises closures: those not using `$this` are inferred as static, and fully stateless closures are cached between uses. PHP developers adopting functional patterns can follow PHP 8.5 and 8.6 release coverage on daily.dev.

7.9K Impressions1 Comment