|
| 1 | +<?php // lint >= 8.1 |
| 2 | + |
| 3 | +namespace Bug12219; |
| 4 | + |
| 5 | +class Bug |
| 6 | +{ |
| 7 | + /** |
| 8 | + * @template T of \BackedEnum |
| 9 | + * @param class-string<T> $class |
| 10 | + * @param value-of<T> $value |
| 11 | + */ |
| 12 | + public function foo(string $class, mixed $value): void |
| 13 | + { |
| 14 | + } |
| 15 | + |
| 16 | + /** |
| 17 | + * @template Q of \BackedEnum |
| 18 | + * @param class-string<Q> $class |
| 19 | + * @param value-of<Q> $value |
| 20 | + */ |
| 21 | + public function bar(string $class, mixed $value): void |
| 22 | + { |
| 23 | + // Parameter #2 $value of static method Bug::foo() contains unresolvable type. |
| 24 | + $this->foo($class, $value); |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +interface SuperBackedEnum extends \BackedEnum |
| 29 | +{ |
| 30 | + public function customMethod(): void; |
| 31 | +} |
| 32 | + |
| 33 | +class Bug2 |
| 34 | +{ |
| 35 | + /** |
| 36 | + * @template T of SuperBackedEnum |
| 37 | + * @param class-string<T> $class |
| 38 | + * @param value-of<T> $value |
| 39 | + */ |
| 40 | + public function foo(string $class, mixed $value): void |
| 41 | + { |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * @template Q of SuperBackedEnum |
| 46 | + * @param class-string<Q> $class |
| 47 | + * @param value-of<Q> $value |
| 48 | + */ |
| 49 | + public function bar(string $class, mixed $value): void |
| 50 | + { |
| 51 | + // Parameter #2 $value of static method Bug::foo() contains unresolvable type. |
| 52 | + $this->foo($class, $value); |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +class Bug3 |
| 57 | +{ |
| 58 | + /** |
| 59 | + * @template T of \UnitEnum |
| 60 | + * @param class-string<T> $class |
| 61 | + * @param value-of<T> $value |
| 62 | + */ |
| 63 | + public function foo(string $class, mixed $value): void |
| 64 | + { |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * @template Q of \UnitEnum |
| 69 | + * @param class-string<Q> $class |
| 70 | + * @param value-of<Q> $value |
| 71 | + */ |
| 72 | + public function bar(string $class, mixed $value): void |
| 73 | + { |
| 74 | + // Parameter #2 $value of static method Bug::foo() contains unresolvable type. |
| 75 | + $this->foo($class, $value); |
| 76 | + } |
| 77 | +} |
0 commit comments