Skip to content

Commit

Permalink
[automated] Apply Coding Standard (#4621)
Browse files Browse the repository at this point in the history
Co-authored-by: TomasVotruba <TomasVotruba@users.noreply.github.com>
  • Loading branch information
TomasVotruba and TomasVotruba committed Jul 30, 2023
1 parent 49f2473 commit 8c62386
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Rector\TypeDeclaration\Rector\ClassMethod;

use PhpParser\Node\Name;
use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Core\PhpParser\NodeFinder\LocalMethodCallFinder;
Expand Down Expand Up @@ -91,16 +91,17 @@ public function refactor(Node $node): ?Node

$isPrivate =
($node->isFinal()
&& !$node->extends instanceof Name
&& ! $node->extends instanceof Name
&& $node->implements === []
&& $method->isProtected())
|| ($method->isFinal()
&& !$node->extends instanceof Name
|| (
$method->isFinal()
&& ! $node->extends instanceof Name
&& $node->implements === []
)
|| $method->isPrivate();

if (!$isPrivate) {
if (! $isPrivate) {
continue;
}

Expand Down
3 changes: 1 addition & 2 deletions src/NodeManipulator/PropertyManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\Core\NodeManipulator;

use PHPStan\Analyser\Scope;
use Doctrine\ORM\Mapping\Table;
use PhpParser\Node;
use PhpParser\Node\Expr\PropertyFetch;
Expand All @@ -14,6 +13,7 @@
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\Trait_;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\ObjectType;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
Expand Down Expand Up @@ -177,7 +177,6 @@ private function isChangeableContext(PropertyFetch | StaticPropertyFetch $proper
return $propertyFetch->getAttribute(AttributeKey::IS_USED_AS_ARG_BY_REF_VALUE, false) === true;
}


private function hasAllowedNotReadonlyAnnotationOrAttribute(PhpDocInfo $phpDocInfo, Class_ $class): bool
{
if ($phpDocInfo->hasByAnnotationClasses(self::DOCTRINE_PROPERTY_ANNOTATIONS)) {
Expand Down
13 changes: 8 additions & 5 deletions src/PhpParser/NodeFinder/PropertyFetchFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\Core\PhpParser\NodeFinder;

use PHPStan\Type\StaticType;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ArrayDimFetch;
Expand All @@ -20,6 +19,7 @@
use PhpParser\Node\Stmt\Trait_;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\StaticType;
use PHPStan\Type\TypeWithClassName;
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
use Rector\Core\PhpParser\AstResolver;
Expand Down Expand Up @@ -48,8 +48,11 @@ public function __construct(
/**
* @return array<PropertyFetch|StaticPropertyFetch>
*/
public function findPrivatePropertyFetches(Class_ $class, Property | Param $propertyOrPromotedParam, Scope $scope): array
{
public function findPrivatePropertyFetches(
Class_ $class,
Property | Param $propertyOrPromotedParam,
Scope $scope
): array {
$propertyName = $this->resolvePropertyName($propertyOrPromotedParam);
if ($propertyName === null) {
return [];
Expand Down Expand Up @@ -199,11 +202,11 @@ private function decoratePropertyFetch(Node $node, Scope $scope): void
}

foreach ($node->getArgs() as $key => $arg) {
if (!$arg->value instanceof PropertyFetch && !$arg->value instanceof StaticPropertyFetch) {
if (! $arg->value instanceof PropertyFetch && ! $arg->value instanceof StaticPropertyFetch) {
continue;
}

if (!$this->isFoundByRefParam($node, $key, $scope)) {
if (! $this->isFoundByRefParam($node, $key, $scope)) {
continue;
}

Expand Down
1 change: 0 additions & 1 deletion tests/Issues/SimplifyEmpty/config/configured_rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;

return static function (RectorConfig $rectorConfig): void {

$rectorConfig->rules([
SimplifyIfReturnBoolRector::class,
SimplifyDeMorganBinaryRector::class,
Expand Down

0 comments on commit 8c62386

Please sign in to comment.