Skip to content

Commit

Permalink
add file path to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jun 30, 2024
1 parent a913de8 commit 2ea0fa8
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 84 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class PathInfoReturn
*
* @psalm-assert-if-true =non-empty-string $filename
*/
public static function extension($filename): string|array
public static function extension($filename): array|string
{
return pathinfo($filename, PATHINFO_EXTENSION);
}
Expand Down
1 change: 1 addition & 0 deletions rules/TypeDeclaration/PHPStan/ObjectTypeSpecifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function narrowToFullyQualifiedOrAliasedObjectType(
?Scope $scope = null,
): FullyQualifiedObjectType | AliasedObjectType | ShortenedGenericObjectType | ShortenedObjectType | NonExistingObjectType | UnionType | MixedType {
$filePath = $node->getAttribute(AttributeKey::FILE_PATH);

// $useImportsScope = $this->useImportsResolver->resolve();
$useImportScope = $this->useImportsScopeResolver->resolve($filePath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,10 @@ public function collectStrictReturnTypes(array $returns, Scope $scope): array
public function resolveMethodCallReturnNode(MethodCall | StaticCall | FuncCall $call): ?Node
{
$returnType = $this->resolveMethodCallReturnType($call);
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> 8e47df14f2 (add union type test fixture for ReturnTypeFromStrictTypedCallRector)
if (! $returnType instanceof Type) {
return null;
}

<<<<<<< HEAD
=======
>>>>>>> c1a7c8b301 (traverse with file path, improve CleanupUnneededNullsafeOperatorRector to use type directly isntead of node juggling)
=======
>>>>>>> 8e47df14f2 (add union type test fixture for ReturnTypeFromStrictTypedCallRector)
return $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($returnType, TypeKind::RETURN);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockTagReplacer;
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
use Rector\StaticTypeMapper\ValueObject\Type\NonExistingObjectType;
Expand Down Expand Up @@ -96,6 +97,7 @@ private function createPhpDocInfoFromFile(string $path): ?PhpDocInfo

$nop = new Nop();
$nop->setDocComment(new Doc($phpDocContent));
$nop->setAttribute(AttributeKey::FILE_PATH, $path);

return $phpDocInfoFactory->createFromNode($nop);
}
Expand Down

0 comments on commit 2ea0fa8

Please sign in to comment.