Hi Dmitrii On Sun, Feb 2, 2025 at 1:05 PM Dmitry Derepko <xepo...@gmail.com> wrote: > > I’m thinking about making match (true) and switch (true) be more lightweight > by removing the subject “(true)” and making matching “true condition” by > default. > So $var = match (true) { … } can be used as $var = match { … }.
There's an old RFC draft for this that never went anywhere. I believe the feedback was mixed, but there's no way to know how it would have turned out since it never went into voting. Given it's inactive, it should be ok for you to take over. https://wiki.php.net/rfc/short-match https://externals.io/message/112496 > `when` construction is overwhelming, but some features are totally handy, > such as checking for class of the subject: > when (obj) { > is Class1 -> … > is Class2 -> … > else -> ... > } > > Which was implemented by Ilija Tovilo in: > https://github.com/php/php-src/compare/master...iluuu1994:pattern-matching This is a really old draft. The RFC itself is mostly up to date. The implementation is still WIP. https://wiki.php.net/rfc/pattern-matching Ilija