Skip to content

Compatibility with PHPStan 0.10 #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: php
php:
- 7.0
- 7.1
- 7.2
before_script:
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "0.9-dev"
"dev-master": "0.10-dev"
}
},
"require": {
"php": "~7.0",
"phpstan/phpstan": "^0.9",
"php": "~7.1",
"phpstan/phpstan": "^0.10",
"doctrine/common": "^2.7",
"doctrine/orm": "^2.5"
},
"require-dev": {
"consistence/coding-standard": "~0.13.0",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"phing/phing": "^2.16.0",
"phpstan/phpstan-phpunit": "^0.9",
"phpstan/phpstan-strict-rules": "^0.9",
"phpunit/phpunit": "^6.4",
"phpstan/phpstan-phpunit": "^0.10",
"phpstan/phpstan-strict-rules": "^0.10",
"phpunit/phpunit": "^7.0",
"slevomat/coding-standard": "^2.0"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DoctrineSelectableClassReflectionExtension implements \PHPStan\Reflection\
/** @var \PHPStan\Broker\Broker */
private $broker;

public function setBroker(\PHPStan\Broker\Broker $broker)
public function setBroker(\PHPStan\Broker\Broker $broker): void
{
$this->broker = $broker;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class DoctrineSelectableClassReflectionExtensionTest extends \PHPStan\Test
/** @var \PHPStan\Reflection\Doctrine\DoctrineSelectableClassReflectionExtension */
private $extension;

protected function setUp()
protected function setUp(): void
{
$this->broker = $this->createBroker();

Expand All @@ -38,17 +38,17 @@ public function dataHasMethod(): array
* @param string $method
* @param bool $expectedResult
*/
public function testHasMethod(string $className, string $method, bool $expectedResult)
public function testHasMethod(string $className, string $method, bool $expectedResult): void
{
$classReflection = $this->broker->getClass($className);
$this->assertSame($expectedResult, $this->extension->hasMethod($classReflection, $method));
self::assertSame($expectedResult, $this->extension->hasMethod($classReflection, $method));
}

public function testGetMethod()
public function testGetMethod(): void
{
$classReflection = $this->broker->getClass(\Doctrine\Common\Collections\Collection::class);
$methodReflection = $this->extension->getMethod($classReflection, 'matching');
$this->assertSame('matching', $methodReflection->getName());
self::assertSame('matching', $methodReflection->getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class DoctrineSelectableDynamicReturnTypeExtensionTest extends TestCase
/** @var \PHPStan\Type\Doctrine\DoctrineSelectableDynamicReturnTypeExtension */
private $extension;

protected function setUp()
protected function setUp(): void
{
$this->extension = new DoctrineSelectableDynamicReturnTypeExtension();
}
Expand All @@ -39,14 +39,14 @@ public function dataIsMethodSupported(): array
* @param string $method
* @param bool $expectedResult
*/
public function testIsMethodSupported(string $method, bool $expectedResult)
public function testIsMethodSupported(string $method, bool $expectedResult): void
{
$methodReflection = $this->createMock(MethodReflection::class);
$methodReflection->method('getName')->willReturn($method);
$this->assertSame($expectedResult, $this->extension->isMethodSupported($methodReflection));
self::assertSame($expectedResult, $this->extension->isMethodSupported($methodReflection));
}

public function testGetTypeFromMethodCall()
public function testGetTypeFromMethodCall(): void
{
$methodReflection = $this->createMock(MethodReflection::class);

Expand All @@ -65,8 +65,8 @@ function (): Type {

$resultType = $this->extension->getTypeFromMethodCall($methodReflection, $methodCall, $scope);

$this->assertInstanceOf(ObjectType::class, $resultType);
$this->assertSame(\Doctrine\Common\Collections\Collection::class, $resultType->describe());
self::assertInstanceOf(ObjectType::class, $resultType);
self::assertSame(\Doctrine\Common\Collections\Collection::class, $resultType->describe());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class EntityManagerFindDynamicReturnTypeExtensionTest extends TestCase
/** @var \PHPStan\Type\Doctrine\EntityManagerFindDynamicReturnTypeExtension */
private $extension;

protected function setUp()
protected function setUp(): void
{
$this->extension = new EntityManagerFindDynamicReturnTypeExtension();
}
Expand All @@ -41,11 +41,11 @@ public function dataIsMethodSupported(): array
* @param string $method
* @param bool $expectedResult
*/
public function testIsMethodSupported(string $method, bool $expectedResult)
public function testIsMethodSupported(string $method, bool $expectedResult): void
{
$methodReflection = $this->createMock(MethodReflection::class);
$methodReflection->method('getName')->willReturn($method);
$this->assertSame($expectedResult, $this->extension->isMethodSupported($methodReflection));
self::assertSame($expectedResult, $this->extension->isMethodSupported($methodReflection));
}

/**
Expand Down Expand Up @@ -112,15 +112,15 @@ public function testGetTypeFromMethodCallWithClassConstFetch(
string $entityClassName,
string $method,
string $expectedTypeDescription
)
): void
{
$methodReflection = $this->mockMethodReflection($method);
$scope = $this->mockScope();
$methodCall = $this->mockMethodCallWithClassConstFetch($entityClassName);

$resultType = $this->extension->getTypeFromMethodCall($methodReflection, $methodCall, $scope);

$this->assertSame($expectedTypeDescription, $resultType->describe());
self::assertSame($expectedTypeDescription, $resultType->describe());
}

/**
Expand Down Expand Up @@ -195,7 +195,7 @@ public function testGetTypeFromMethodCallWithScalarString(

$resultType = $this->extension->getTypeFromMethodCall($methodReflection, $methodCall, $scope);

$this->assertSame($expectedTypeDescription, $resultType->describe());
self::assertSame($expectedTypeDescription, $resultType->describe());
}

private function mockMethodReflection(string $method): MethodReflection
Expand Down