mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-03 00:25:04 +00:00
tests/phpunit: fill in some phpstan types
This commit is contained in:
@ -40,6 +40,10 @@ class HandlerListManagerTest extends TestCase{
|
||||
$this->resolveParentFunc = (new \ReflectionMethod(HandlerListManager::class, 'resolveNearestHandleableParent'))->getClosure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator|mixed[][]
|
||||
* @phpstan-return \Generator<int, array{\ReflectionClass<Event>, bool, string}, void, void>
|
||||
*/
|
||||
public function isValidClassProvider() : \Generator{
|
||||
yield [new \ReflectionClass(Event::class), false, "event base should not be handleable"];
|
||||
yield [new \ReflectionClass(TestConcreteEvent::class), true, ""];
|
||||
@ -53,11 +57,16 @@ class HandlerListManagerTest extends TestCase{
|
||||
* @param \ReflectionClass $class
|
||||
* @param bool $isValid
|
||||
* @param string $reason
|
||||
* @phpstan-param \ReflectionClass<Event> $class
|
||||
*/
|
||||
public function testIsValidClass(\ReflectionClass $class, bool $isValid, string $reason) : void{
|
||||
self::assertSame($isValid, ($this->isValidFunc)($class), $reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator|\ReflectionClass[][]
|
||||
* @phpstan-return \Generator<int, array{\ReflectionClass<Event>, \ReflectionClass<Event>|null}, void, void>
|
||||
*/
|
||||
public function resolveParentClassProvider() : \Generator{
|
||||
yield [new \ReflectionClass(TestConcreteExtendsAllowHandleEvent::class), new \ReflectionClass(TestAbstractAllowHandleEvent::class)];
|
||||
yield [new \ReflectionClass(TestConcreteEvent::class), null];
|
||||
@ -70,6 +79,8 @@ class HandlerListManagerTest extends TestCase{
|
||||
*
|
||||
* @param \ReflectionClass $class
|
||||
* @param \ReflectionClass|null $expect
|
||||
* @phpstan-param \ReflectionClass<Event> $class
|
||||
* @phpstan-param \ReflectionClass<Event>|null $expect
|
||||
*/
|
||||
public function testResolveParentClass(\ReflectionClass $class, ?\ReflectionClass $expect) : void{
|
||||
if($expect === null){
|
||||
|
Reference in New Issue
Block a user