1.2.1655. strict_types Preference¶
strict_types
is a PHP mode where typehint are enforced strictly or weakly. By default, it is weak typing, allowing backward compatibility with previous versions.
This analysis reports if strict_types
are used systematically or not. strict_types
affects the calling file, not the definition file.
<?php
// define strict_types
declare(strict_types = 1);
foo(1);
?>
See also Strict typing.
1.2.1655.1. Connex PHP features¶
1.2.1655.1.1. Suggestions¶
Use
strict_types
as early as possible in the development, to make it easier to adopt
1.2.1655.1.2. Specs¶
Short name |
Php/DeclareStrict |
Rulesets |
|
Exakat since |
0.12.2 |
PHP Version |
With PHP 7.0 and more recent |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |