mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
[Renaming] Add test fixture for same-namespaced short class fail (#5040)
Co-authored-by: Tom Klingenberg <tklingenberg@lastflood.net>
This commit is contained in:
parent
a43d3e3863
commit
1850a2dcc2
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Renaming\Tests\Rector\FileWithoutNamespace\PseudoNamespaceToNamespaceRector\Fixture;
|
||||
|
||||
class DateTime
|
||||
{
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Renaming\Tests\Rector\FileWithoutNamespace\PseudoNamespaceToNamespaceRector\Fixture;
|
||||
|
||||
class PreslashedBug
|
||||
{
|
||||
/**
|
||||
* @param \DateTime $time1
|
||||
* @return int
|
||||
*/
|
||||
public function test(\DateTime $time1)
|
||||
{
|
||||
return $time1->getOffset();
|
||||
}
|
||||
}
|
@ -128,7 +128,7 @@ final class ObjectTypeSpecifier
|
||||
return null;
|
||||
}
|
||||
|
||||
$namespacedObject = $namespaceName . '\\' . $objectType->getClassName();
|
||||
$namespacedObject = $namespaceName . '\\' . ltrim($objectType->getClassName(), '\\');
|
||||
|
||||
if (ClassExistenceStaticHelper::doesClassLikeExist($namespacedObject)) {
|
||||
return new FullyQualifiedObjectType($namespacedObject);
|
||||
|
@ -80,6 +80,7 @@ final class ValidateFixtureSuffixCommand extends Command
|
||||
->notPath('Namespace_/ImportFullyQualifiedNamesRector/Fixture/SharedShortName.php')
|
||||
->notPath('Name/RenameClassRector/Fixture/DuplicatedClass.php')
|
||||
->notPath('Rector/FileNode/RenameSpecFileToTestFileRector/Fixture/some_file_Spec.php')
|
||||
->notPath('Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Fixture/DateTime.php')
|
||||
->in(__DIR__ . '/../../../../tests')
|
||||
->in(__DIR__ . '/../../../../packages/*/tests')
|
||||
->in(__DIR__ . '/../../../../rules/*/tests');
|
||||
|
Loading…
x
Reference in New Issue
Block a user