Skip to content

Commit

Permalink
fixed compatibility with PhpStan 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Feb 4, 2019
1 parent ba720d8 commit 38c3ada
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"require": {
"php": "~7.1",
"phpstan/phpstan": "~0.10"
"phpstan/phpstan": "~0.11"
},
"require-dev": {
"nette/tester": "~2.0",
Expand Down
4 changes: 3 additions & 1 deletion src/Types/RepositoryReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public function getTypeFromMethodCall(
$entityType = new ObjectType(IEntity::class);
} else {
assert($entityClassNameTypes instanceof ConstantArrayType);
$classNameType = $entityClassNameTypes->getFirstValueType();
$classNameTypes = $entityClassNameTypes->getValueTypes();
assert(count($classNameTypes) > 0);
$classNameType = $classNameTypes[0];
assert($classNameType instanceof ConstantStringType);
$entityType = new ObjectType($classNameType->getValue());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

Environment::setup();

$command = __DIR__ . '/../vendor/bin/phpstan analyze --no-progress -l 7 -c ' . __DIR__ . '/config.neon --errorFormat rawSimple ' . __DIR__ . '/testbox';
$command = __DIR__ . '/../vendor/bin/phpstan analyze --no-progress -l 7 -c ' . __DIR__ . '/config.neon --error-format rawSimple ' . __DIR__ . '/testbox';
exec($command, $o);
$actual = trim(implode("\n", $o));
$expected = trim(file_get_contents(__DIR__ . '/expected.txt'));
Expand Down

0 comments on commit 38c3ada

Please sign in to comment.