.. _php-notscalartype: .. _not-a-scalar-type: Not A Scalar Type +++++++++++++++++ ``int`` is the actual PHP scalar type, not ``integer``. PHP 7 introduced several scalar types, in particular ``int``, ``bool``, ``string`` and ``float``. Those three types are easily mistaken with ``integer``, ``boolean``, ``real`` and ``double``. Unless those classes actually exists, PHP emits some strange `error `_ messages. Thanks to ``Benoit Viguier`` for the `original idea `__ for this analysis. .. code-block:: php See also `Type declarations `_ and `PHP RFC: Scalar Type Hints `_. Related PHP errors ------------------- + `0 `_ Connex PHP features ------------------- + `scalar-typehint `_ Suggestions ___________ * Do not use ``int`` as a class name, an interface name or a trait name. Specs _____ +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Php/NotScalarType | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`PHP recommendations `, :ref:`Typechecks ` | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 1.0.7 | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Major | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Instant (5 mins) | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+