Skip to content

Commit

Permalink
[Naming] Remove MakeBoolPropertyRespectIsHasWasMethodNamingRector, no…
Browse files Browse the repository at this point in the history
…t reliable and rather PHPStan scope (#511)
  • Loading branch information
TomasVotruba committed Jul 25, 2021
1 parent ba990a2 commit 923bb72
Show file tree
Hide file tree
Showing 52 changed files with 91 additions and 910 deletions.
2 changes: 0 additions & 2 deletions config/set/naming.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Rector\Naming\Rector\ClassMethod\RenameVariableToMatchNewTypeRector;
use Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector;
use Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchMethodCallReturnTypeRector;
use Rector\Naming\Rector\Property\MakeBoolPropertyRespectIsHasWasMethodNamingRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand All @@ -18,6 +17,5 @@
$services->set(RenameVariableToMatchNewTypeRector::class);
$services->set(RenameVariableToMatchMethodCallReturnTypeRector::class);
$services->set(RenameForeachValueVariableToMatchMethodCallReturnTypeRector::class);
$services->set(MakeBoolPropertyRespectIsHasWasMethodNamingRector::class);
$services->set(RenameForeachValueVariableToMatchExprVariableRector::class);
};
16 changes: 0 additions & 16 deletions packages/NodeTypeResolver/NodeTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
use PhpParser\Node\Param;
use PhpParser\Node\Scalar;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\Return_;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Type\Accessory\NonEmptyArrayType;
use PHPStan\Type\ArrayType;
use PHPStan\Type\BooleanType;
use PHPStan\Type\Constant\ConstantBooleanType;
use PHPStan\Type\FloatType;
use PHPStan\Type\Generic\GenericObjectType;
Expand Down Expand Up @@ -289,20 +287,6 @@ public function isNullableTypeOfSpecificType(Node $node, string $desiredType): b
return false;
}

public function isPropertyBoolean(Property $property): bool
{
if ($this->isStaticType($property, BooleanType::class)) {
return true;
}

$defaultNodeValue = $property->props[0]->default;
if (! $defaultNodeValue instanceof Expr) {
return false;
}

return $this->isStaticType($defaultNodeValue, BooleanType::class);
}

/**
* @return class-string
*/
Expand Down
10 changes: 6 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,8 @@ parameters:
paths:
- rules/Php80/Rector/If_/NullsafeOperatorRector.php

- '#Method "evaluateBinaryToVersionCompareCondition\(\)" returns bool type, so the name should start with is/has/was#'

# soo many false positive naming - fix later with Recto rule
- '#Method "(.*?)\(\)" returns bool type, so the name should start with is/has/was#'
# covered in symplify main
- '#Method "(equal|match)(.*?)\(\)" returns bool type, so the name should start with is/has/was#'

-
message: '#Comparison operation "<" between 0 and 2 is always true#'
Expand Down Expand Up @@ -526,3 +524,7 @@ parameters:

# resolve later
- '#Method "(.*?)\(\)" only calling another method call and has no added value\. Use the inlined call instead#'
- '#Method "processRenameVariable\(\)" returns bool type, so the name should start with is/has/was#'
- '#Method "refactorParamType\(\)" returns bool type, so the name should start with is/has/was#'
- '#Method "decorateReturnWithSpecificType\(\)" returns bool type, so the name should start with is/has/was#'
- '#Method "resolveObjectType\(\)" returns bool type, so the name should start with is/has/was#'
1 change: 0 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Rector\Core\Rector\AbstractRector;
use Rector\Nette\Set\NetteSetList;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php74\Rector\MethodCall\ChangeReflectionTypeToStringToGetNameRector;
use Rector\PHPUnit\Rector\Class_\AddSeeTestAnnotationRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Restoration\Rector\ClassMethod\InferParamFromClassMethodReturnRector;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 923bb72

Please sign in to comment.