On Tue, Dec 2, 2025, at 3:13 AM, Alexandre Daubois wrote: > Hi Larry and Ilija, > > Le lun. 1 déc. 2025 à 22:37, Larry Garfield <[email protected]> a écrit : >> >> Hi folks. Ilija and I would like to present our latest RFC endeavor, >> pattern matching: >> >> https://wiki.php.net/rfc/pattern-matching > > Thanks for this RFC, it looks really great! > > I see that resources are never mentioned. I know that a lot of > resources are being converted to opaque classes in recent versions, > but they still exist. Would it be possible to use the "resource" type > with pattern matching, e.g. `$r is resource`? I would assume that the > answer is yes because the RFC mentions the support of `$foo is > iterable`.
`iterable` is already a type used elsewhere. `resource` is not something you can specify anywhere in code right now. Making pattern matching the one place you can actually type check against `resource`, which is not an inconsistency we want. Also, resources are on their way out, gradually, so we'd just need to remove support from pattern matching again in the future sometime. In all, it's just not worth the effort and inconsistency. --Larry Garfield
