Replace disallowed operators in tests/

This commit is contained in:
Dylan K. Taylor 2022-01-20 16:48:36 +00:00
parent 4d55935bd8
commit 6846f1e78a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
4 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,7 @@ class DisallowEnumComparisonRule implements Rule{
} }
public function processNode(Node $node, Scope $scope) : array{ public function processNode(Node $node, Scope $scope) : array{
if(!($node instanceof Identical) and !($node instanceof NotIdentical)){ if(!($node instanceof Identical) && !($node instanceof NotIdentical)){
return []; return [];
} }
@ -81,7 +81,7 @@ class DisallowEnumComparisonRule implements Rule{
continue; continue;
} }
$class = $containedType->getClassReflection(); $class = $containedType->getClassReflection();
if($class !== null and $class->hasTraitUse(EnumTrait::class)){ if($class !== null && $class->hasTraitUse(EnumTrait::class)){
return true; return true;
} }
} }

View File

@ -99,7 +99,7 @@ class ItemTest extends TestCase{
} }
foreach($this->item->getEnchantments() as $enchantment){ foreach($this->item->getEnchantments() as $enchantment){
foreach($enchantments as $k => $applied){ 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]); unset($enchantments[$k]);
continue 2; continue 2;
} }

View File

@ -54,7 +54,7 @@ class AsyncPoolTest extends TestCase{
public function testTaskLeak() : void{ public function testTaskLeak() : void{
$start = microtime(true); $start = microtime(true);
$this->pool->submitTask(new LeakTestAsyncTask()); $this->pool->submitTask(new LeakTestAsyncTask());
while(!LeakTestAsyncTask::$destroyed and microtime(true) < $start + 30){ while(!LeakTestAsyncTask::$destroyed && microtime(true) < $start + 30){
usleep(50 * 1000); usleep(50 * 1000);
$this->pool->collectTasks(); $this->pool->collectTasks();
} }

View File

@ -72,7 +72,7 @@ abstract class Test{
} }
public function isTimedOut() : bool{ 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{ protected function setTimeout(int $timeout) : void{