xref: /PHP-8.2/Zend/tests/bug75079.phpt (revision 20233469)
1--TEST--
2Bug #75079: self keyword leads to incorrectly generated TypeError when in closure in trait
3--FILE--
4<?php
5
6trait Foo
7{
8    public function selfDo(self ...$Selfs)
9    {
10        array_map(
11            function (self $Self) : self
12            {
13                return $Self;
14            },
15            $Selfs
16        );
17    }
18}
19
20class Bar
21{
22    use Foo;
23}
24
25class Baz
26{
27    use Foo;
28}
29
30$Bar = new Bar;
31$Baz = new Baz;
32
33$Bar->selfDo($Bar, $Bar);
34$Baz->selfDo($Baz, $Baz);
35
36?>
37===DONE===
38--EXPECT--
39===DONE===
40