Skip to content

Commit

Permalink
fixes CI errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Khartir committed Feb 7, 2020
1 parent 29b543f commit d698269
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/Type/PHPUnit/CreateMockDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\DynamicMethodReturnTypeExtension;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;

class CreateMockDynamicReturnTypeExtension implements \PHPStan\Type\DynamicMethodReturnTypeExtension
class CreateMockDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{

/** @var int[] */
Expand Down Expand Up @@ -51,7 +52,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
}

if ($argType instanceof ConstantArrayType) {
$types = array_map(function (Type $argType): ObjectType {
$types = array_map(function (ConstantStringType $argType): ObjectType {
return new ObjectType($argType->getValue());
}, $argType->getValueTypes());
}
Expand Down
5 changes: 3 additions & 2 deletions src/Type/PHPUnit/GetMockBuilderDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\Constant\ConstantArrayType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\DynamicMethodReturnTypeExtension;
use PHPStan\Type\Type;
use PHPStan\Type\TypeWithClassName;

class GetMockBuilderDynamicReturnTypeExtension implements \PHPStan\Type\DynamicMethodReturnTypeExtension
class GetMockBuilderDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{

public function getClass(): string
Expand Down Expand Up @@ -43,7 +44,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
}

if ($argType instanceof ConstantArrayType) {
$classes = array_map(function (Type $argType): string {
$classes = array_map(function (ConstantStringType $argType): string {
return $argType->getValue();
}, $argType->getValueTypes());

Expand Down
4 changes: 3 additions & 1 deletion src/Type/PHPUnit/MockBuilderDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\Broker\Broker;
use PHPStan\Reflection\BrokerAwareExtension;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
use PHPStan\Type\DynamicMethodReturnTypeExtension;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\TypeWithClassName;

class MockBuilderDynamicReturnTypeExtension implements \PHPStan\Type\DynamicMethodReturnTypeExtension, \PHPStan\Reflection\BrokerAwareExtension
class MockBuilderDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension, BrokerAwareExtension
{

/** @var \PHPStan\Broker\Broker */
Expand Down
3 changes: 2 additions & 1 deletion src/Type/PHPUnit/MockBuilderType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace PHPStan\Type\PHPUnit;

use PHPStan\Type\ObjectType;
use PHPStan\Type\TypeWithClassName;
use PHPStan\Type\VerbosityLevel;

class MockBuilderType extends \PHPStan\Type\ObjectType
class MockBuilderType extends ObjectType
{

/** @var array<string> */
Expand Down
2 changes: 1 addition & 1 deletion tests/Type/PHPUnit/CreateMockExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testCreateMock(string $expression, string $type): void
__DIR__ . '/data/create-mock.php',
$expression,
$type,
[new CreateMockDynamicReturnTypeExtension(), new GetMockBuilderDynamicReturnTypeExtension()]
[new CreateMockDynamicReturnTypeExtension()]
);
}

Expand Down
6 changes: 6 additions & 0 deletions tests/Type/PHPUnit/ExtensionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
abstract class ExtensionTestCase extends TestCase
{

/**
* @param string $file
* @param string $expression
* @param string $type
* @param array<DynamicMethodReturnTypeExtension> $extensions
*/
protected function processFile(
string $file,
string $expression,
Expand Down

0 comments on commit d698269

Please sign in to comment.