Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46a6695

Browse files
CS fixes
1 parent 0ca5051 commit 46a6695

File tree

32 files changed

+82
-99
lines changed

32 files changed

+82
-99
lines changed

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ private function getPrettyMetadata(string $type, mixed $entity, bool $decorated)
384384

385385
if ('globals' === $type) {
386386
if (\is_object($meta)) {
387-
return ' = object('.\get_class($meta).')';
387+
return ' = object('.$meta::class.')';
388388
}
389389

390390
$description = substr(@json_encode($meta), 0, 50);

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2806,14 +2806,15 @@ private function resolveTrustedHeaders(array $headers): int
28062806
$trustedHeaders = 0;
28072807

28082808
foreach ($headers as $h) {
2809-
switch ($h) {
2810-
case 'forwarded': $trustedHeaders |= Request::HEADER_FORWARDED; break;
2811-
case 'x-forwarded-for': $trustedHeaders |= Request::HEADER_X_FORWARDED_FOR; break;
2812-
case 'x-forwarded-host': $trustedHeaders |= Request::HEADER_X_FORWARDED_HOST; break;
2813-
case 'x-forwarded-proto': $trustedHeaders |= Request::HEADER_X_FORWARDED_PROTO; break;
2814-
case 'x-forwarded-port': $trustedHeaders |= Request::HEADER_X_FORWARDED_PORT; break;
2815-
case 'x-forwarded-prefix': $trustedHeaders |= Request::HEADER_X_FORWARDED_PREFIX; break;
2816-
}
2809+
$trustedHeaders |= match ($h) {
2810+
'forwarded' => Request::HEADER_FORWARDED,
2811+
'x-forwarded-for' => Request::HEADER_X_FORWARDED_FOR,
2812+
'x-forwarded-host' => Request::HEADER_X_FORWARDED_HOST,
2813+
'x-forwarded-proto' => Request::HEADER_X_FORWARDED_PROTO,
2814+
'x-forwarded-port' => Request::HEADER_X_FORWARDED_PORT,
2815+
'x-forwarded-prefix' => Request::HEADER_X_FORWARDED_PREFIX,
2816+
default => 0,
2817+
};
28172818
}
28182819

28192820
return $trustedHeaders;

src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function collect(Request $request, Response $response, \Throwable $except
4242
$this->data = ['instances' => $empty, 'total' => $empty];
4343
foreach ($this->instances as $name => $instance) {
4444
$this->data['instances']['calls'][$name] = $instance->getCalls();
45-
$this->data['instances']['adapters'][$name] = \get_debug_type($instance->getPool());
45+
$this->data['instances']['adapters'][$name] = get_debug_type($instance->getPool());
4646
}
4747

4848
$this->data['instances']['statistics'] = $this->calculateStatistics();

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,12 @@ public static function createConnection(string $dsn, array $options = []): \Redi
288288
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
289289
$redis->setOption(\Redis::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']);
290290
}
291-
switch ($params['failover']) {
292-
case 'error': $redis->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, \RedisCluster::FAILOVER_ERROR); break;
293-
case 'distribute': $redis->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, \RedisCluster::FAILOVER_DISTRIBUTE); break;
294-
case 'slaves': $redis->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES); break;
295-
}
291+
$redis->setOption(\RedisCluster::OPT_SLAVE_FAILOVER, match ($params['failover']) {
292+
'error' => \RedisCluster::FAILOVER_ERROR,
293+
'distribute' => \RedisCluster::FAILOVER_DISTRIBUTE,
294+
'slaves' => \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES,
295+
'none' => \RedisCluster::FAILOVER_NONE,
296+
});
296297

297298
return $redis;
298299
};

src/Symfony/Component/Console/Command/Command.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,9 @@ public function getNativeDefinition(): InputDefinition
439439
* @param $default The default value (for InputArgument::OPTIONAL mode only)
440440
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
441441
*
442-
* @throws InvalidArgumentException When argument mode is not valid
443-
*
444442
* @return $this
443+
*
444+
* @throws InvalidArgumentException When argument mode is not valid
445445
*/
446446
public function addArgument(string $name, int $mode = null, string $description = '', mixed $default = null /* array|\Closure $suggestedValues = null */): static
447447
{
@@ -463,9 +463,9 @@ public function addArgument(string $name, int $mode = null, string $description
463463
* @param $default The default value (must be null for InputOption::VALUE_NONE)
464464
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
465465
*
466-
* @throws InvalidArgumentException If option mode is invalid or incompatible
467-
*
468466
* @return $this
467+
*
468+
* @throws InvalidArgumentException If option mode is invalid or incompatible
469469
*/
470470
public function addOption(string $name, string|array $shortcut = null, int $mode = null, string $description = '', mixed $default = null /* array|\Closure $suggestedValues = [] */): static
471471
{

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,7 @@ public function __construct(bool $emitsSignal = true)
20862086
protected function execute(InputInterface $input, OutputInterface $output): int
20872087
{
20882088
if ($this->emitsSignal) {
2089-
posix_kill(posix_getpid(), SIGUSR1);
2089+
posix_kill(posix_getpid(), \SIGUSR1);
20902090
}
20912091

20922092
for ($i = 0; $i < $this->loop; ++$i) {

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public function addObjectResource(object|string $object): static
291291
{
292292
if ($this->trackResources) {
293293
if (\is_object($object)) {
294-
$object = \get_class($object);
294+
$object = $object::class;
295295
}
296296
if (!isset($this->classReflectors[$object])) {
297297
$this->classReflectors[$object] = new \ReflectionClass($object);
@@ -1037,7 +1037,7 @@ private function createService(Definition $definition, array &$inlineServices, b
10371037
if (null !== $factory) {
10381038
$service = $factory(...$arguments);
10391039

1040-
if (\is_object($tryProxy) && \get_class($service) !== $parameterBag->resolveValue($definition->getClass())) {
1040+
if (\is_object($tryProxy) && $service::class !== $parameterBag->resolveValue($definition->getClass())) {
10411041
throw new LogicException(sprintf('Lazy service of type "%s" cannot be hydrated because its factory returned an unexpected instance of "%s". Try adding the "proxy" tag to the corresponding service definition with attribute "interface" set to "%1$s".', $definition->getClass(), get_debug_type($service)));
10421042
}
10431043

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ private function exportParameters(array $parameters, string $path = '', int $ind
16651665
throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain expressions. Expression "%s" found in "%s".', $value, $path.'/'.$key));
16661666
} elseif ($value instanceof \UnitEnum) {
16671667
$hasEnum = true;
1668-
$value = sprintf('\%s::%s', \get_class($value), $value->name);
1668+
$value = sprintf('\%s::%s', $value::class, $value->name);
16691669
} else {
16701670
$value = $this->export($value);
16711671
}
@@ -1917,7 +1917,7 @@ private function dumpValue(mixed $value, bool $interpolate = true): string
19171917
return $code;
19181918
}
19191919
} elseif ($value instanceof \UnitEnum) {
1920-
return sprintf('\%s::%s', \get_class($value), $value->name);
1920+
return sprintf('\%s::%s', $value::class, $value->name);
19211921
} elseif ($value instanceof AbstractArgument) {
19221922
throw new RuntimeException($value->getTextWithContext());
19231923
} elseif (\is_object($value) || \is_resource($value)) {

src/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/InstantiatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface InstantiatorInterface
2525
/**
2626
* Instantiates a proxy object.
2727
*
28-
* @param string $id Identifier of the requested service
28+
* @param string $id Identifier of the requested service
2929
* @param callable(object=) $realInstantiator A callback that is capable of producing the real service instance
3030
*
3131
* @return object

src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function hasListeners(string $eventName = null): bool
108108

109109
public function dispatch(object $event, string $eventName = null): object
110110
{
111-
$eventName ??= \get_class($event);
111+
$eventName ??= $event::class;
112112

113113
if (null === $this->callStack) {
114114
$this->callStack = new \SplObjectStorage();

0 commit comments

Comments
 (0)