summaryrefslogtreecommitdiff
path: root/Zend/tests/type_declarations/typed_properties_102.phpt
blob: 83f3c26186fc1cb2137171dd8f69afb341e68ea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--TEST--
Compound assignment operator on static property holding ref
--FILE--
<?php declare(strict_types=1);

class Test {
    public static int $intProp = 123;
    public static $prop;
}

Test::$prop =& Test::$intProp;
try {
    Test::$prop .= "foobar";
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
var_dump(Test::$prop, Test::$intProp);
?>
--EXPECT--
Cannot assign string to reference held by property Test::$intProp of type int
int(123)
int(123)