mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 00:40:52 +00:00
fix cs
This commit is contained in:
parent
08600382c2
commit
3b2976f849
|
@ -66,22 +66,30 @@ final class TriggerMessageResolver
|
|||
$words = explode(' ', $message);
|
||||
|
||||
foreach ($words as $word) {
|
||||
// is method()
|
||||
if (Strings::endsWith($word, '()') && strlen($word) > 2) {
|
||||
// doesn't include class in the beggning
|
||||
if (! Strings::startsWith($word, $class)) {
|
||||
$word = $class . '::' . $word;
|
||||
}
|
||||
// is method('...')
|
||||
} elseif (Strings::endsWith($word,'\')')) {
|
||||
if (! Strings::startsWith($word, $class)) {
|
||||
$word = $class . '::' . $word;
|
||||
}
|
||||
}
|
||||
|
||||
$completeMessage .= ' ' . $word;
|
||||
$completeMessage .= ' ' . $this->prependClassToMethodCallIfNeeded($word, $class);
|
||||
}
|
||||
|
||||
return trim($completeMessage);
|
||||
}
|
||||
|
||||
private function prependClassToMethodCallIfNeeded(string $word, string $class): string
|
||||
{
|
||||
// is method()
|
||||
if (Strings::endsWith($word, '()') && strlen($word) > 2) {
|
||||
// doesn't include class in the beggning
|
||||
if (! Strings::startsWith($word, $class)) {
|
||||
return $class . '::' . $word;
|
||||
}
|
||||
}
|
||||
|
||||
// is method('...')
|
||||
if (Strings::endsWith($word, '\')')) {
|
||||
// doesn't include class in the beggning
|
||||
if (! Strings::startsWith($word, $class)) {
|
||||
return $class . '::' . $word;
|
||||
}
|
||||
}
|
||||
|
||||
return $word;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user