It seems like you are calling the size function count() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.
If the size of the collection does not change during the iteration, it is
generally a good practice to compute it beforehand, and not on each iteration:
for($i=0;$i<count($array);$i++){// calls count() on each iteration}// Betterfor($i=0,$c=count($array);$i<$c;$i++){// calls count() just once}
Loading history...
30
$this->match = $this->matches[$i];
31
$this->getVariable();
32
/*$this->replace = "<?php if (is_object({$this->variable})) {$this->variable} = (array) {$this->variable}; ?>";*/
50% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have
checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that
someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.
It seems like you are calling the size function count() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.
If the size of the collection does not change during the iteration, it is
generally a good practice to compute it beforehand, and not on each iteration:
for($i=0;$i<count($array);$i++){// calls count() on each iteration}// Betterfor($i=0,$c=count($array);$i<$c;$i++){// calls count() just once}
Loading history...
49
$variable .= "->".$explode[$k];
50
}
51
52
$this->variable = $variable;
53
}
54
55
private function filter(string $name): void
56
{
57
$this->$name();
58
}
59
60
private function upper(): void
61
{
62
if (isset($this->match[2]) && $this->match[2] == 'capitalize') {