Skip to content

Commit

Permalink
Update PHPStan from 0.11 to 0.12 (#11)
Browse files Browse the repository at this point in the history
* Update PHPStan from 0.11 to 0.12

* Fix PHPunit tests
  • Loading branch information
babeuloula authored and samizdam committed Dec 6, 2019
1 parent bd7928b commit e9e5e9d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"require": {
"php": "~7.1",
"myclabs/php-enum": "^1.2",
"phpstan/phpstan": "^0.10|^0.11"
"phpstan/phpstan": "^0.10|^0.11|^0.12"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
Expand Down
60 changes: 57 additions & 3 deletions src/Reflection/EnumMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\FunctionVariant;
use PHPStan\Reflection\MethodReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Generic\TemplateTypeMap;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;

class EnumMethodReflection implements MethodReflection
{
Expand Down Expand Up @@ -60,8 +63,59 @@ public function getPrototype(): ClassMemberReflection

public function getVariants(): array
{
return [
new FunctionVariant([], false, new ObjectType($this->classReflection->getName())),
];
if (true === (new \ReflectionClass(FunctionVariant::class))->hasMethod('getTemplateTypeMap')) {
return [
new FunctionVariant(
TemplateTypeMap::createEmpty(),
TemplateTypeMap::createEmpty(),
[],
false,
new ObjectType($this->classReflection->getName())
),
];
} else {
return [
new FunctionVariant(
[],
false,
new ObjectType($this->classReflection->getName())
),
];
}
}

public function getDocComment(): ?string
{
return null;
}

public function isDeprecated(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

public function getDeprecatedDescription(): ?string
{
return null;
}

public function isFinal(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

public function isInternal(): TrinaryLogic
{
return TrinaryLogic::createNo();
}

public function getThrowType(): ?Type
{
return null;
}

public function hasSideEffects(): TrinaryLogic
{
return TrinaryLogic::createNo();
}
}

0 comments on commit e9e5e9d

Please sign in to comment.