Skip to content

Commit

Permalink
Updated PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 16, 2018
1 parent 2b6db86 commit 0951fed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
28 changes: 12 additions & 16 deletions src/Reflection/Dibi/DibiFluentMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use PHPStan\Reflection\ClassMemberReflection;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\FunctionVariant;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;

class DibiFluentMethodReflection implements MethodReflection
{
Expand Down Expand Up @@ -43,19 +43,6 @@ public function isStatic(): bool
return false;
}

/**
* @return \PHPStan\Reflection\ParameterReflection[]
*/
public function getParameters(): array
{
return [];
}

public function isVariadic(): bool
{
return true;
}

public function isPrivate(): bool
{
return false;
Expand All @@ -66,9 +53,18 @@ public function isPublic(): bool
return true;
}

public function getReturnType(): Type
/**
* @return \PHPStan\Reflection\ParametersAcceptor[]
*/
public function getVariants(): array
{
return new ObjectType(\Dibi\Fluent::class);
return [
new FunctionVariant(
[],
true,
new ObjectType(\Dibi\Fluent::class)
),
];
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Reflection\Dibi;

use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\VerbosityLevel;

class DibiFluentClassReflectionExtensionTest extends \PHPStan\Testing\TestCase
Expand Down Expand Up @@ -48,14 +49,15 @@ public function testGetMethod(): void
{
$classReflection = $this->broker->getClass(\Dibi\Fluent::class);
$methodReflection = $this->extension->getMethod($classReflection, 'select');
$parametersAcceptor = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());
self::assertSame('select', $methodReflection->getName());
self::assertSame($classReflection, $methodReflection->getDeclaringClass());
self::assertFalse($methodReflection->isStatic());
self::assertEmpty($methodReflection->getParameters());
self::assertTrue($methodReflection->isVariadic());
self::assertEmpty($parametersAcceptor->getParameters());
self::assertTrue($parametersAcceptor->isVariadic());
self::assertFalse($methodReflection->isPrivate());
self::assertTrue($methodReflection->isPublic());
self::assertSame(\Dibi\Fluent::class, $methodReflection->getReturnType()->describe(VerbosityLevel::value()));
self::assertSame(\Dibi\Fluent::class, $parametersAcceptor->getReturnType()->describe(VerbosityLevel::value()));
}

}

0 comments on commit 0951fed

Please sign in to comment.