.. _type-silentlycastinteger: .. _silently-cast-integer: Silently Cast Integer +++++++++++++++++++++ Those are integer literals that are cast to a float when running PHP. They are too big for the current PHP version, and PHP resorts to cast them into a float, which has a much larger capacity but a lower precision. Compare your literals to ``PHP_MAX_INT`` (typically ``9223372036854775807``) and ``PHP_MIN_INT`` (typically ``-9223372036854775808``). This applies to binary (``0b10101``...), octal (``0123123``...) and hexadecimal (``0xfffff``...) too. .. code-block:: php See also `Integer overflow `_. Connex PHP features ------------------- + `cast `_ + `silent-cast `_ Suggestions ___________ * Make sure hexadecimal numbers have the right number of digits : generally, it is 15, but it may depends on your PHP version. Specs _____ +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Type/SilentlyCastInteger | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`CE `, :ref:`CI-checks `, :ref:`Changed Behavior ` | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Examples | :ref:`case-mediawiki-type-silentlycastinteger` | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+