Skip to content

Commit

Permalink
Run Rector and cs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 12, 2024
1 parent f2a1e26 commit f4c13e1
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/Matcher/ClassMethodCallReferenceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use PHPStan\Node\MethodCallableNode;
use PHPStan\Type\ThisType;
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\TypeWithClassName;
use Rector\TypePerfect\ValueObject\MethodCallReference;

final class ClassMethodCallReferenceResolver
Expand Down
7 changes: 3 additions & 4 deletions src/Printer/CollectorMetadataPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\UnionType;
use PhpParser\PrettyPrinter\Standard;
use PHPStan\Node\Printer\Printer;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ExtendedMethodReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
Expand All @@ -32,11 +31,11 @@

final readonly class CollectorMetadataPrinter
{
private Standard $printer;
private Standard $standard;

public function __construct(
) {
$this->printer = new Standard();
$this->standard = new Standard();
}

public function printArgTypesAsString(MethodCall $methodCall, ExtendedMethodReflection $extendedMethodReflection, Scope $scope): string
Expand Down Expand Up @@ -97,7 +96,7 @@ public function printParamTypesToString(ClassMethod $classMethod, ?string $class
$paramType = $this->resolveSortedTypes($paramType, $className);
}

$printedParamType = $this->printer->prettyPrint([$paramType]);
$printedParamType = $this->standard->prettyPrint([$paramType]);
$printedParamType = str_replace('\Closure', 'callable', $printedParamType);
$printedParamType = ltrim($printedParamType, '\\');
$printedParamType = str_replace('|\\', '|', $printedParamType);
Expand Down
8 changes: 1 addition & 7 deletions src/Reflection/ReflectionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ private function parseFilenameToClass(string $fileName): ClassLike|null
private function findFirstClassLike(array $nodes): ?ClassLike
{
$nodeFinder = new NodeFinder();

$foundClassLike = $nodeFinder->findFirstInstanceOf($nodes, ClassLike::class);
if ($foundClassLike instanceof ClassLike) {
return $foundClassLike;
}

return null;
return $nodeFinder->findFirstInstanceOf($nodes, ClassLike::class);
}
}
1 change: 0 additions & 1 deletion src/Rules/NarrowReturnObjectTypeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use PHPStan\Rules\RuleErrorBuilder;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeWithClassName;
use Rector\TypePerfect\Configuration;
use Rector\TypePerfect\NodeFinder\ReturnNodeFinder;
use Rector\TypePerfect\Reflection\MethodNodeAnalyser;
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/NoMixedMethodCallerRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Node\Printer\Printer;
use PHPStan\Analyser\Scope;
use PHPStan\Node\Printer\Printer;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleError;
use PHPStan\Rules\RuleErrorBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/NoMixedPropertyFetcherRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use PhpParser\Node;
use PhpParser\Node\Expr\PropertyFetch;
use PHPStan\Node\Printer\Printer;
use PHPStan\Analyser\Scope;
use PHPStan\Node\Printer\Printer;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleError;
use PHPStan\Rules\RuleErrorBuilder;
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/NoParamTypeRemovalRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public function processNode(Node $node, Scope $scope): array

private function resolveParentParamType(PhpMethodReflection $phpMethodReflection, int $paramPosition): Type
{
foreach ($phpMethodReflection->getVariants() as $parametersAcceptorWithPhpDoc) {
foreach ($parametersAcceptorWithPhpDoc->getParameters() as $parentParamPosition => $parameterReflectionWithPhpDoc) {
foreach ($phpMethodReflection->getVariants() as $variant) {
foreach ($variant->getParameters() as $parentParamPosition => $parameterReflectionWithPhpDoc) {
if ($paramPosition !== $parentParamPosition) {
continue;
}
Expand Down

0 comments on commit f4c13e1

Please sign in to comment.