mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Don't use count() in a loop.
Use do while so the count does not happen in a loop statement. This makes the code linter happier.
This commit is contained in:
parent
90ca41d436
commit
75fcc7c2f8
1 changed files with 4 additions and 2 deletions
|
@ -516,7 +516,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
protected function _assertAttributes($assertions, $string) {
|
||||
$asserts = $assertions['attrs'];
|
||||
$explains = $assertions['explains'];
|
||||
while (count($asserts) > 0) {
|
||||
$len = count($asserts);
|
||||
do {
|
||||
$matches = false;
|
||||
foreach ($asserts as $j => $assert) {
|
||||
if (preg_match(sprintf('/^%s/s', $assert), $string, $match)) {
|
||||
|
@ -530,7 +531,8 @@ abstract class CakeTestCase extends PHPUnit_Framework_TestCase {
|
|||
if ($matches === false) {
|
||||
$this->assertTrue(false, 'Attribute did not match. Was expecting ' . $explains[$j]);
|
||||
}
|
||||
}
|
||||
$len = count($asserts);
|
||||
} while ($len > 0);
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue