From 6846f1e78a70393d5f2d2e9f3db5c4b574ddf50d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 20 Jan 2022 16:48:36 +0000 Subject: [PATCH] Replace disallowed operators in tests/ --- tests/phpstan/rules/DisallowEnumComparisonRule.php | 4 ++-- tests/phpunit/item/ItemTest.php | 2 +- tests/phpunit/scheduler/AsyncPoolTest.php | 2 +- tests/plugins/TesterPlugin/src/Test.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/phpstan/rules/DisallowEnumComparisonRule.php b/tests/phpstan/rules/DisallowEnumComparisonRule.php index 726c4cfbfe..ec5ad3528b 100644 --- a/tests/phpstan/rules/DisallowEnumComparisonRule.php +++ b/tests/phpstan/rules/DisallowEnumComparisonRule.php @@ -47,7 +47,7 @@ class DisallowEnumComparisonRule implements Rule{ } public function processNode(Node $node, Scope $scope) : array{ - if(!($node instanceof Identical) and !($node instanceof NotIdentical)){ + if(!($node instanceof Identical) && !($node instanceof NotIdentical)){ return []; } @@ -81,7 +81,7 @@ class DisallowEnumComparisonRule implements Rule{ continue; } $class = $containedType->getClassReflection(); - if($class !== null and $class->hasTraitUse(EnumTrait::class)){ + if($class !== null && $class->hasTraitUse(EnumTrait::class)){ return true; } } diff --git a/tests/phpunit/item/ItemTest.php b/tests/phpunit/item/ItemTest.php index 95aafd8a70..db29f14dc0 100644 --- a/tests/phpunit/item/ItemTest.php +++ b/tests/phpunit/item/ItemTest.php @@ -99,7 +99,7 @@ class ItemTest extends TestCase{ } foreach($this->item->getEnchantments() as $enchantment){ foreach($enchantments as $k => $applied){ - if($enchantment->getType() === $applied->getType() and $enchantment->getLevel() === $applied->getLevel()){ + if($enchantment->getType() === $applied->getType() && $enchantment->getLevel() === $applied->getLevel()){ unset($enchantments[$k]); continue 2; } diff --git a/tests/phpunit/scheduler/AsyncPoolTest.php b/tests/phpunit/scheduler/AsyncPoolTest.php index e2aedfb939..878e99048c 100644 --- a/tests/phpunit/scheduler/AsyncPoolTest.php +++ b/tests/phpunit/scheduler/AsyncPoolTest.php @@ -54,7 +54,7 @@ class AsyncPoolTest extends TestCase{ public function testTaskLeak() : void{ $start = microtime(true); $this->pool->submitTask(new LeakTestAsyncTask()); - while(!LeakTestAsyncTask::$destroyed and microtime(true) < $start + 30){ + while(!LeakTestAsyncTask::$destroyed && microtime(true) < $start + 30){ usleep(50 * 1000); $this->pool->collectTasks(); } diff --git a/tests/plugins/TesterPlugin/src/Test.php b/tests/plugins/TesterPlugin/src/Test.php index 7af551840a..ce08c4a8da 100644 --- a/tests/plugins/TesterPlugin/src/Test.php +++ b/tests/plugins/TesterPlugin/src/Test.php @@ -72,7 +72,7 @@ abstract class Test{ } public function isTimedOut() : bool{ - return !$this->isFinished() and time() - $this->timeout > $this->startTime; + return !$this->isFinished() && time() - $this->timeout > $this->startTime; } protected function setTimeout(int $timeout) : void{