Skip to content

Commit

Permalink
Merge pull request #8 from trejjam/master
Browse files Browse the repository at this point in the history
Update phpstan version to `^0.11`
  • Loading branch information
Ocramius authored Jan 16, 2019
2 parents 22c3052 + fc22c53 commit 1f8ab28
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"require": {
"php": "^7.2",
"nikic/php-parser": "^4.0",
"phpstan/phpstan": "^0.10.8"
"phpstan/phpstan": "^0.11"
},
"require-dev": {
"doctrine/coding-standard": "^5.0",
"infection/infection": "^0.11.4",
"maglnet/composer-require-checker": "^1.1",
"phpstan/phpstan-phpunit": "^0.10",
"phpstan/phpstan-strict-rules": "^0.10",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11",
"phpunit/phpunit": "^7.4",
"roave/backward-compatibility-check": "^2.0",
"squizlabs/php_codesniffer": "^3.4"
Expand Down
7 changes: 4 additions & 3 deletions src/DisallowFloatEverywhereRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
use PHPStan\Type\VerbosityLevel;
use function assert;
use function sprintf;

class DisallowFloatEverywhereRule implements Rule
{
public function getNodeType() : string
{
return Node\Expr::class;
return Expr::class;
}

/**
* @param Expr $node
*
* @return string[]
*/
public function processNode(Node $node, Scope $scope) : array
Expand All @@ -31,6 +30,8 @@ public function processNode(Node $node, Scope $scope) : array
return [];
}

assert($node instanceof Expr);

$nodeType = $scope->getType($node);
if (! FloatTypeHelper::isFloat($nodeType)) {
return [];
Expand Down
7 changes: 4 additions & 3 deletions src/DisallowFloatInFunctionSignatureRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use function array_map;
use function array_merge;
use function array_values;
use function assert;
use function sprintf;

final class DisallowFloatInFunctionSignatureRule implements Rule
Expand All @@ -33,16 +34,16 @@ public function __construct(Broker $broker)

public function getNodeType() : string
{
return Node\Stmt\Function_::class;
return Function_::class;
}

/**
* @param Function_ $node
*
* @return string[]
*/
public function processNode(Node $node, Scope $scope) : array
{
assert($node instanceof Function_);

$functionName = new Name($node->name->toString());
if (! $this->broker->hasCustomFunction($functionName, $scope)) {
return [];
Expand Down
7 changes: 4 additions & 3 deletions src/DisallowFloatInMethodSignatureRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@
use function array_map;
use function array_merge;
use function array_values;
use function assert;
use function sprintf;

final class DisallowFloatInMethodSignatureRule implements Rule
{
public function getNodeType() : string
{
return Node\Stmt\ClassMethod::class;
return ClassMethod::class;
}

/**
* @param ClassMethod $node
*
* @return string[]
*/
public function processNode(Node $node, Scope $scope) : array
{
assert($node instanceof ClassMethod);

if (! $scope->isInClass()) {
throw new ShouldNotHappenException();
}
Expand Down
7 changes: 4 additions & 3 deletions src/DisallowFloatPropertyTypeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@
use PHPStan\Rules\Rule;
use PHPStan\ShouldNotHappenException;
use PHPStan\Type\VerbosityLevel;
use function assert;
use function sprintf;

final class DisallowFloatPropertyTypeRule implements Rule
{
public function getNodeType() : string
{
return Node\Stmt\PropertyProperty::class;
return PropertyProperty::class;
}

/**
* @param PropertyProperty $node
*
* @return string[]
*/
public function processNode(Node $node, Scope $scope) : array
{
assert($node instanceof PropertyProperty);

if (! $scope->isInClass()) {
throw new ShouldNotHappenException();
}
Expand Down

0 comments on commit 1f8ab28

Please sign in to comment.