Non-canonical cast (integer) is deprecated, use the (int) cast instead

Description

The non-canonical cast (integer) has been deprecated. It should be replace by the simpler (int).

Example

<?php

$a = (integer) $string;

?>

Solutions

  • Use (int).

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See nonCanonicalCast.

Static Analysis

This error may be tracked down with the following static analysis rules: Php/NonCanonicalCast.