1--TEST--
2Test typed properties overflowing
3--SKIPIF--
4<?php if (PHP_INT_SIZE == 4) die("SKIP: 64 bit test"); ?>
5--FILE--
6<?php
7
8class Foo {
9    public static int $bar = PHP_INT_MAX;
10};
11
12try {
13    Foo::$bar++;
14} catch(TypeError $t) {
15    var_dump($t->getMessage());
16}
17
18var_dump(Foo::$bar);
19
20try {
21    Foo::$bar += 1;
22} catch(TypeError $t) {
23    var_dump($t->getMessage());
24}
25
26var_dump(Foo::$bar);
27
28try {
29    ++Foo::$bar;
30} catch(TypeError $t) {
31    var_dump($t->getMessage());
32}
33
34var_dump(Foo::$bar);
35
36try {
37    Foo::$bar = Foo::$bar + 1;
38} catch(TypeError $t) {
39    var_dump($t->getMessage());
40}
41
42var_dump(Foo::$bar);
43
44?>
45--EXPECT--
46string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
47int(9223372036854775807)
48string(53) "Cannot assign float to property Foo::$bar of type int"
49int(9223372036854775807)
50string(70) "Cannot increment property Foo::$bar of type int past its maximal value"
51int(9223372036854775807)
52string(53) "Cannot assign float to property Foo::$bar of type int"
53int(9223372036854775807)
54