PHP

PHP

Made by DeepSource

throw expression used in PHP < 8.0 PHP-W1017

Bug risk
Critical

throw expression is allowed only in PHP >= 8.0. Trying to use it in earlier PHP versions will give you an error.

Bad Practice

class Example
{
    public function doSomething(bool $b): void
    {
        $b ? true : throw new \Exception();

        throw new \Exception();
    }
}

References