> De : François Laupretre [mailto:franc...@php.net] > > This way, the user can write : > > function convertToInt(string $number): int! { <- int! instead of int > if (!preg_match("(^[0-9]{1,17}$)", $number)) { > throw new InvalidArgumentException("Supplied argument is not a valid > number"); > } > return $number;
A static analyzer would raise an error on this, as we are sure it fails, while : function convertToInt(string $number): int! { if (!preg_match("(^[0-9]{1,17}$)", $number)) { throw new InvalidArgumentException("Supplied argument is not a valid number"); } return (int)$number; would be analyzed as OK. That's what you want, don't you ? Regards François -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php