| Conditions | 1 |
| Paths | 1 |
| Total Lines | 6 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public static function assertExecutionMemoryLessThenOrEqual(float $memoryInKb, callable $workload): void |
||
| 24 | { |
||
| 25 | $beforeMemory = memory_get_usage(); |
||
| 26 | $workload(); |
||
| 27 | $memoryUsage = memory_get_usage() - $beforeMemory; |
||
| 28 | self::assertLessThanOrEqual(1024 * $memoryInKb, $memoryUsage, 'Execution memory of this workload should be less then ' . $memoryInKb . 'KB.'); |
||
| 29 | } |
||
| 39 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.