Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Rector\CodingStyle\Rector\String_\UseClassKeywordForClassNameResolutionRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Cast\RecastingRemovalRector;
use Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;

Expand Down Expand Up @@ -53,9 +52,4 @@
__DIR__ . '/src/Configuration/RectorConfigBuilder.php',
__DIR__ . '/src/Console/Notifier.php',
],

// on php 7.x, substr() result can return false, so force (string) is needed
RecastingRemovalRector::class => [
__DIR__ . '/rules/CodingStyle/ClassNameImport/ClassNameImportSkipVoter/ClassLikeNameClassNameImportSkipVoter.php',
],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ public function shouldSkip(File $file, FullyQualifiedObjectType $fullyQualifiedO
$namespace = strtolower((string) $namespace);

$shortNameLowered = $fullyQualifiedObjectType->getShortNameLowered();

$subClassName = substr(
$fullyQualifiedObjectType->getClassName(),
0,
-strlen($fullyQualifiedObjectType->getShortName()) - 1
);
$subClassName = $fullyQualifiedObjectType->getClassName() === $fullyQualifiedObjectType->getShortName()
? ''
: substr(
$fullyQualifiedObjectType->getClassName(),
0,
-strlen($fullyQualifiedObjectType->getShortName()) - 1
);
Comment thread
samsonasik marked this conversation as resolved.
Outdated

$fullyQualifiedObjectTypeNamespace = strtolower($subClassName);

Expand Down