| Total Complexity | 4 | 
| Total Lines | 55 | 
| Duplicated Lines | 0 % | 
| Coverage | 50% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 13 | class Modular extends Composite  | 
            ||
| 14 | { | 
            ||
| 15 | /**  | 
            ||
| 16 | * @inheritdoc  | 
            ||
| 17 | *  | 
            ||
| 18 | * can accept parameters.  | 
            ||
| 19 | *  | 
            ||
| 20 |      * - {moduleId}: the unique module id associated to this rule. | 
            ||
| 21 | */  | 
            ||
| 22 |     public string $notFoundMessage = 'Unknown route for module `{moduleId}`.'; | 
            ||
| 23 | |||
| 24 | /**  | 
            ||
| 25 | * @var string unique id to grab the module from the application that will  | 
            ||
| 26 | * parse the rules.  | 
            ||
| 27 | */  | 
            ||
| 28 | public string $moduleId;  | 
            ||
| 29 | |||
| 30 | /**  | 
            ||
| 31 | * @var UrlRuleCreator  | 
            ||
| 32 | */  | 
            ||
| 33 | 21 | protected UrlRuleCreator $module;  | 
            |
| 34 | |||
| 35 | /**  | 
            ||
| 36 | 21 | * @inheritdoc  | 
            |
| 37 | */  | 
            ||
| 38 | protected function isApplicable(string $route): bool  | 
            ||
| 42 | 21 | }  | 
            |
| 43 | |||
| 44 | 21 | /**  | 
            |
| 45 | * @inheritdoc  | 
            ||
| 46 | */  | 
            ||
| 47 | 21 | protected function createRules()  | 
            |
| 48 | 21 |     { | 
            |
| 49 | return $this->module->createUrlRules($this);  | 
            ||
| 50 | }  | 
            ||
| 51 | |||
| 52 | /**  | 
            ||
| 53 | * @inheritdoc  | 
            ||
| 54 | */  | 
            ||
| 55 | 21 | protected function createNotFoundException(): NotFoundHttpException  | 
            |
| 56 |     { | 
            ||
| 57 | return new NotFoundHttpException(  | 
            ||
| 58 |             strtr($this->notFoundMessage, ['{moduleId}' => $this->moduleId]) | 
            ||
| 59 | );  | 
            ||
| 60 | }  | 
            ||
| 61 | |||
| 62 | protected function ensureRules()  | 
            ||
| 68 | }  | 
            ||
| 69 | }  | 
            ||
| 70 | 
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.