xref: /PHP-8.0/Zend/tests/gh9407.phpt (revision d5373eac)
1--TEST--
2GH-9407: LSP error in eval'd code refers to wrong class for static type
3--FILE--
4<?php
5
6class A {
7    public function duplicate(): static {}
8}
9
10class C {
11    public static function generate() {
12        eval(<<<PHP
13            class B extends A {
14                public function duplicate(): A {}
15            }
16        PHP);
17    }
18}
19
20C::generate();
21
22?>
23--EXPECTF--
24Fatal error: Declaration of B::duplicate(): A must be compatible with A::duplicate(): static in %s : eval()'d code on line %d
25