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

Commit 9eca47d

Browse files
Fixed PHP 7.0 support
1 parent bf68ff6 commit 9eca47d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/CommandTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public function testHandlerCanBeResolved()
4848
$params = (new ReflectionClass($handler))->getMethod('handle')->getParameters();
4949
$this->assertCount(1, $params);
5050
$this->assertFalse($params[0]->getType()->allowsNull());
51-
$this->assertTrue(get_class($command) === $params[0]->getType()->getName());
51+
52+
$type = PHP_VERSION_ID >= 70100 ? $params[0]->getType()->getName() : (string) $params[0]->getType();
53+
$this->assertSame(get_class($command), $type);
5254
}
5355
}

src/EventTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ public function testEventHasRegisteredHandlers()
8181
$params = (new ReflectionClass($handler))->getMethod('handle')->getParameters();
8282
$this->assertCount(1, $params, "Expected '{$handler}::handle' to require exactly 1 argument.");
8383
$this->assertFalse($params[0]->getType()->allowsNull(), "Expected '{$handler}::handle' to require non-null arguments.");
84-
$type = $params[0]->getType()->getName();
84+
85+
$type = PHP_VERSION_ID >= 70100 ? $params[0]->getType()->getName() : (string) $params[0]->getType();
8586
$this->assertTrue($class === $type || (new ReflectionClass($class))->isSubclassOf($type), "Expected '{$class}' to equal or subtype '{$type}' in '{$handler}::handle'.");
8687
}
8788
}

0 commit comments

Comments
 (0)