| Conditions | 17 | 
| Paths | 23 | 
| Total Lines | 41 | 
| Code Lines | 29 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php | ||
| 122 | public function validateValueWithType($value = null): ?string | ||
| 123 |     { | ||
| 124 |         switch ($this->type()) { | ||
| 125 | case SchemaAttributeInterface::TYPE_DATE: | ||
| 126 | case SchemaAttributeInterface::TYPE_TIME: | ||
| 127 | case SchemaAttributeInterface::TYPE_TIMESTAMP: | ||
| 128 | case SchemaAttributeInterface::TYPE_DATETIME: | ||
| 129 |                 if (date_create($value) === false) { | ||
| 130 | return 'ERR_DATETIME_FORMAT'; | ||
| 131 | } | ||
| 132 | break; | ||
| 133 | |||
| 134 | case SchemaAttributeInterface::TYPE_YEAR: | ||
| 135 |                 if (preg_match('#^\d{4}$#', $value) !== 1) { | ||
| 136 | return 'ERR_YEAR_FORMAT'; | ||
| 137 | } | ||
| 138 | break; | ||
| 139 | |||
| 140 | case SchemaAttributeInterface::TYPE_INTEGER: | ||
| 141 | case SchemaAttributeInterface::TYPE_FLOAT: | ||
| 142 | case SchemaAttributeInterface::TYPE_DECIMAL: | ||
| 143 |                 if (!is_numeric($value)) { | ||
| 144 | return 'ERR_NUMERIC_FORMAT'; | ||
| 145 | } | ||
| 146 | break; | ||
| 147 | |||
| 148 | case SchemaAttributeInterface::TYPE_STRING: | ||
| 149 | case SchemaAttributeInterface::TYPE_TEXT: | ||
| 150 |                 if (strlen($value) > $this->length()) { | ||
| 151 | return 'ERR_TEXT_TOO_LONG'; | ||
| 152 | } | ||
| 153 | break; | ||
| 154 | |||
| 155 | case SchemaAttributeInterface::TYPE_ENUM: | ||
| 156 |                 if (!in_array($value, $this->enums())) { | ||
| 157 | return 'ERR_INVALID_ENUM_VALUE'; | ||
| 158 | } | ||
| 159 | break; | ||
| 160 | |||
| 161 | default: | ||
| 162 | return null; | ||
| 163 | } | ||
| 166 | 
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths