database/factories/FakerMarkdownProvider/FakerProvider.php
Avoid using EscolaLms\TopicTypes\Database\Factories\FakerMarkdownProvider\count() function in do loops. Open
Open
do {
$parts[] = self::markdownH1();
if (self::randomDigit() > 3) {
$parts[] = self::markdownP();
}
- Read upRead up
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}