No Property Beyond Limits

<?php

class X {
    public int $p;
}

$x = new X;

$x->p = PHP_INT_MIN;
--$x->p;

?>

TIL that PHP reports attempts to go beyond the limits (upper and lower) of integer properties. Indeed, beyond these limits, the property is converted to a float, which violate the typing.

This error goes away by dropping the type: the property simply changes type.

This also means that no error is reported when doing the same on a variable.

See Also

PHP Error Messages

PHP Features

Last updated: 14 July 2026