Cannot decrement property %s::$%s of type int past its minimal value

Description

When a property is typed as an int, it cannot have a value lower than PHP_INT_MIN. There is a symetric error with the max value of an integer.

Example

<?php

class X {
    public int $p;
}

$x = new X;

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

?>

Literal Examples

  • Cannot decrement property Test::$p of type int past its minimal value

Solutions

  • Check the value before decrementing.

  • Drop the type, but see the property get turned into a float.