Psalm
Get started
Documentation
Paid support
Plugins
Blog
GitHub
<?php declare(strict_types = 1); class foo { public function testing(?foo $x): void { if ($x !== null && !($x instanceof static)) { throw new \TypeError('custom error'); } echo "OK\n"; } } class bar extends foo {} $foo = new foo; $bar = new bar; $foo->testing($foo); $foo->testing($bar); $bar->testing($bar); $bar->testing($foo);
Snippet created on June 19 2019 at 22:25 UTC
Settings
Get link