From 08d93e01b9341fdea9a22f52dc5fbce542c62245 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 30 Apr 2023 02:35:47 +0200 Subject: [PATCH] [automated] Apply Coding Standard (#3713) * [automated] Apply Coding Standard * [ci-review] Rector Rectify --------- Co-authored-by: TomasVotruba Co-authored-by: GitHub Action --- .../TypeMapper/UnionTypeMapper.php | 2 +- .../Rector/PropertyFetch/RenamePropertyRector.php | 10 +++++----- src/Application/ApplicationFileProcessor.php | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php b/packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php index 8bfcb0f11f1..15f6b5568bb 100644 --- a/packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php +++ b/packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php @@ -268,7 +268,7 @@ private function resolveUnionTypes(PhpParserUnionType $phpParserUnionType, int $ $phpParserUnionType->types = array_filter( $phpParserUnionType->types, - static fn(Node $node): bool => ! $node instanceof Identifier || $node->toString() !== 'false' + static fn (Node $node): bool => ! $node instanceof Identifier || $node->toString() !== 'false' ); $phpParserUnionType->types = array_values($phpParserUnionType->types); diff --git a/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php b/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php index 34b9f9f6061..04b5684e36b 100644 --- a/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php +++ b/rules/Renaming/Rector/PropertyFetch/RenamePropertyRector.php @@ -4,7 +4,6 @@ namespace Rector\Renaming\Rector\PropertyFetch; -use PHPStan\Type\Type; use PhpParser\Node; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Identifier; @@ -14,6 +13,7 @@ use PhpParser\Node\VarLikeIdentifier; use PHPStan\Type\ObjectType; use PHPStan\Type\ThisType; +use PHPStan\Type\Type; use Rector\Core\Contract\Rector\ConfigurableRectorInterface; use Rector\Core\Rector\AbstractRector; use Rector\Renaming\ValueObject\RenameProperty; @@ -125,16 +125,16 @@ private function processFromPropertyFetch(PropertyFetch $propertyFetch): ?Proper if (! $this->isObjectType($propertyFetch->var, $renamedProperty->getObjectType())) { continue; } - + if ($class instanceof ClassLike) { if (! $nodeVarType instanceof Type) { $nodeVarType = $this->nodeTypeResolver->getType($propertyFetch->var); } - if ($nodeVarType instanceof ThisType ) { + if ($nodeVarType instanceof ThisType) { $this->renameProperty($class, $renamedProperty); - } - } + } + } $propertyFetch->name = new Identifier($renamedProperty->getNewProperty()); return $propertyFetch; diff --git a/src/Application/ApplicationFileProcessor.php b/src/Application/ApplicationFileProcessor.php index b05402d837f..a2a07372e6b 100644 --- a/src/Application/ApplicationFileProcessor.php +++ b/src/Application/ApplicationFileProcessor.php @@ -87,6 +87,7 @@ public function run(Configuration $configuration, InputInterface $input): array if ($configuration->shouldShowDiffs()) { $this->fileDiffFileDecorator->decorate($files); } + $this->printFiles($files, $configuration); }