Open
Description
Description
The following code:
<?php
class Foo {}
class Bar {}
function test(Foo&Bar $arg): void {}
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