Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Fixed PHP 7.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 24, 2019
1 parent bf68ff6 commit 9eca47d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/CommandTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public function testHandlerCanBeResolved()
$params = (new ReflectionClass($handler))->getMethod('handle')->getParameters();
$this->assertCount(1, $params);
$this->assertFalse($params[0]->getType()->allowsNull());
$this->assertTrue(get_class($command) === $params[0]->getType()->getName());

$type = PHP_VERSION_ID >= 70100 ? $params[0]->getType()->getName() : (string) $params[0]->getType();
$this->assertSame(get_class($command), $type);
}
}
3 changes: 2 additions & 1 deletion src/EventTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public function testEventHasRegisteredHandlers()
$params = (new ReflectionClass($handler))->getMethod('handle')->getParameters();
$this->assertCount(1, $params, "Expected '{$handler}::handle' to require exactly 1 argument.");
$this->assertFalse($params[0]->getType()->allowsNull(), "Expected '{$handler}::handle' to require non-null arguments.");
$type = $params[0]->getType()->getName();

$type = PHP_VERSION_ID >= 70100 ? $params[0]->getType()->getName() : (string) $params[0]->getType();
$this->assertTrue($class === $type || (new ReflectionClass($class))->isSubclassOf($type), "Expected '{$class}' to equal or subtype '{$type}' in '{$handler}::handle'.");
}
}
Expand Down

0 comments on commit 9eca47d

Please sign in to comment.