1--TEST--
2Use of parent inside a class that has / has no parent
3--FILE--
4<?php
5
6// Illegal: A::parent is ill-defined
7class A {
8    public function method(parent $x) {}
9}
10class B extends A {
11    public function method(parent $x) {}
12}
13
14// Legal: A2::parent == P2
15class P2 {}
16class A2 extends P2 {
17    public function method(parent $x) {}
18}
19class B2 extends A2 {
20    public function method(P2 $x) {}
21}
22
23// Legal: B3::parent == A3 is subclass of A3::parent == P3 in covariant position
24class P3 {}
25class A3 extends P3 {
26    public function method($x): parent {}
27}
28class B3 extends A3 {
29    public function method($x): parent {}
30}
31
32// Illegal: B4::parent == A4 is subclass of A4::parent == P4 in contravariant position
33class P4 {}
34class A4 extends P4 {
35    public function method(parent $x) {}
36}
37class B4 extends A4 {
38    public function method(parent $x) {}
39}
40
41?>
42--EXPECTF--
43Deprecated: Cannot use "parent" when current class scope has no parent in %s on line %d
44
45Warning: Declaration of B4::method(A4 $x) should be compatible with A4::method(P4 $x) in %s on line %d
46
47Warning: Could not check compatibility between B::method(A $x) and A::method(parent $x), because class parent is not available in %s on line %d
48