On Fri, May 15, 2026 at 6:11 AM Daniil Gentili <[email protected]> wrote: >> >> >> If one would actually use the highest possible level of the static >> analysis tools they would need to “convince” the static analyzer that >> “yes, unserialize() is actually returning an object of the right type”. >> This is typically done with `assert($foo instanceof SomeClass);`, >> >> >> something that PHP will double-check for you at runtime. > > > > Interesting that you mention specifically assert, which PHP actually does > **not** double-check for you at runtime, in production by default, so there > is actually a precedent for a language feature that only does typechecking in > the development stage.
Assertions have been on by default for a long time, and in 8.0 we elevated them to throw instead of warn. So by default, yes, in production you do get assertions.
