[php-src] Issue #8843: Exception type hint

From: Date: Tue, 21 Jun 2022 17:24:37 +0000
Subject: [php-src] Issue #8843: Exception type hint
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241781@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8843 Author: 94noni ### Description Hi, I would like to know if there is a way to improve the [Exception](https://www.php.net/manual/en/language.exceptions.php) handling with type string hinting logic instead of annotation. I think it can help get rid of annotations in some codebase, and of course help devs and IDE as well to better understand the exceptions chain if any. --- ## before ```php /** * @throws LogicException */ public function function(?int $int): int { if (null === $int) { throw new LogicException(); } // ... return $int } ``` ## after ```php public function function(?int $int): int | !LogicException { if (null === $int) { throw new LogicException(); } // ... return $int } ``` The !LogicException is totally arbitrary right now Thank you,

« previous php.bugs (#241781) next »