8000 Fix `$this` calls to static ones when relevant by alexandre-daubois · Pull Request #58373 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix $this calls to static ones when relevant #58373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function configure(): void
$commandName = basename($fullCommand);
$fullCommand = @realpath($fullCommand) ?: $fullCommand;

$shell = $this->guessShell();
$shell = self::guessShell();
[$rcFile, $completionFile] = match ($shell) {
'fish' => ['~/.config/fish/config.fish', "/etc/fish/completions/$commandName.fish"],
'zsh' => ['~/.zshrc', '$fpath[1]/_'.$commandName],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function onConsoleError(ConsoleErrorEvent $event): void

$error = $event->getError();

if (!$inputString = $this->getInputString($event)) {
if (!$inputString = self::getInputString($event)) {
$this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);

return;
Expand All @@ -58,7 +58,7 @@ public function onConsoleTerminate(ConsoleTerminateEvent $event): void
return;
}

if (!$inputString = $this->getInputString($event)) {
if (!$inputString = self::getInputString($event)) {
$this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
return null;
}

if (!isset($this->getProvidedTypes()[$prefix])) {
if (!isset(static::getProvidedTypes()[$prefix])) {
throw new RuntimeException(\sprintf('Unsupported env var prefix "%s".', $prefix));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ public function getLanguages(): array
$this->languages = [];
foreach ($languages as $acceptHeaderItem) {
$lang = $acceptHeaderItem->getValue();
$this->languages[] = $this->formatLocale($lang);
$this->languages[] = self::formatLocale($lang);
}
$this->languages = array_unique($this->languages);

Expand Down
8000
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected function refreshUser(TokenInterface $token): ?TokenInterface
$newToken->setUser($refreshedUser, false);

// tokens can be deauthenticated if the user has been changed.
if ($token instanceof AbstractToken && $this->hasUserChanged($user, $newToken)) {
if ($token instanceof AbstractToken && self::hasUserChanged($user, $newToken)) {
$userDeauthenticated = true;

$this->logger?->debug('Cannot refresh token because user has changed.', ['username' => $refreshedUser->getUserIdentifier(), 'provider' => $provider::class]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function getGetter(object $subject): callable
$property = $this->property;
$method = 'get'.ucfirst($property);

return match ($this->getters[$subject::class] ??= $this->getType($subject, $property, $method)) {
return match ($this->getters[$subject::class] ??= self::getType($subject, $property, $method)) {
MarkingStoreMethod::METHOD => $subject->{$method}(...),
MarkingStoreMethod::PROPERTY => static fn () => $subject->{$property},
};
Expand All @@ -99,7 +99,7 @@ private function getSetter(object $subject): callable
$property = $this->property;
$method = 'set'.ucfirst($property);

return match ($this->setters[$subject::class] ??= $this->getType($subject, $property, $method)) {
return match ($this->setters[$subject::class] ??= self::getType($subject, $property, $method)) {
MarkingStoreMethod::METHOD => $subject->{$method}(...),
MarkingStoreMethod::PROPERTY => static fn ($marking) => $subject->{$property} = $marking,
};
Expand Down
0