[php-src] Issue #15692: Argument type is intersection, comprised of the classes without common parent

From: Date: Sun, 01 Sep 2024 16:36:15 +0000
Subject: [php-src] Issue #15692: Argument type is intersection, comprised of the classes without common parent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247666@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15692 Author: Kenny1911 ### Description The following code: ```php <?php class Foo {} class Bar {} function test(Foo&Bar $arg): void {} ``` https://3v4l.org/sKIr0 I use intersection type Foo&Bar for function argument. Actually, there is no type that would be comparable to Foo&Bar. Therefore, Foo&Bar is equivalent to the type never. If i use never in argument type, PHP Fatal Error will be thrown. But if i use Foo&Bar, no error will occur. Resulted in this output: *Nothing* But I expected this output instead: ``` PHP Fatal error: Foo&Bar cannot be used as a parameter type ``` ### PHP Version PHP 8.3.11 ### Operating System Ubuntu 20.04

« previous php.bugs (#247666) next »