1--TEST--
2Trying to assign to a static 'self' typed property on a trait must not fixate the type to the trait
3--FILE--
4<?php
5
6trait Test {
7    public static self $selfProp;
8    public static ?self $selfNullProp;
9    public static parent $parentProp;
10}
11
12try {
13    Test::$selfProp = new stdClass;
14} catch (Error $e) {
15    echo $e->getMessage(), "\n";
16}
17try {
18    Test::$selfNullProp = new stdClass;
19} catch (Error $e) {
20    echo $e->getMessage(), "\n";
21}
22try {
23    Test::$parentProp = new stdClass;
24} catch (Error $e) {
25    echo $e->getMessage(), "\n";
26}
27
28Test::$selfNullProp = null;
29var_dump(Test::$selfNullProp);
30
31class Foo {}
32class Bar extends Foo {
33    use Test;
34}
35
36Bar::$selfProp = new Bar;
37Bar::$selfNullProp = new Bar;
38Bar::$parentProp = new Foo;
39
40var_dump(Bar::$selfProp, Bar::$selfNullProp, Bar::$parentProp);
41
42?>
43--EXPECT--
44Cannot write a value to a 'self' typed static property of a trait
45Cannot write a non-null value to a 'self' typed static property of a trait
46Cannot access parent:: when current class scope has no parent
47NULL
48object(Bar)#3 (0) {
49}
50object(Bar)#2 (0) {
51}
52object(Foo)#4 (0) {
53}
54