mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 02:36:52 +01:00
use constant over string
This commit is contained in:
parent
789badcb9a
commit
ec396a53b1
@ -9,6 +9,11 @@ use PHPStan\Type\ObjectType;
|
||||
|
||||
final class PropertyNaming
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const INTERFACE = 'Interface';
|
||||
|
||||
/**
|
||||
* @param ObjectType|string $objectType
|
||||
*/
|
||||
@ -40,8 +45,8 @@ final class PropertyNaming
|
||||
|
||||
/** @var string $lastNamePart */
|
||||
$lastNamePart = Strings::after($fqn, '\\', - 1);
|
||||
if (Strings::endsWith($lastNamePart, 'Interface')) {
|
||||
return Strings::substring($lastNamePart, 0, - strlen('Interface'));
|
||||
if (Strings::endsWith($lastNamePart, self::INTERFACE)) {
|
||||
return Strings::substring($lastNamePart, 0, - strlen(self::INTERFACE));
|
||||
}
|
||||
|
||||
return $lastNamePart;
|
||||
@ -60,7 +65,7 @@ final class PropertyNaming
|
||||
}
|
||||
|
||||
if (Strings::match($shortName, '#Interface$#')) {
|
||||
return Strings::substring($shortName, -strlen('Interface'));
|
||||
return Strings::substring($shortName, -strlen(self::INTERFACE));
|
||||
}
|
||||
|
||||
return $shortName;
|
||||
|
Loading…
x
Reference in New Issue
Block a user