Skip to content

chore: PHP CS Fixer fixes #59939

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
Mar 8, 2025
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 @@ -494,7 +494,6 @@ private function createRegistry(?ObjectManager $manager = null): ManagerRegistry
$registry->method('getManager')->willReturn($manager);
}


return $registry;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public function testTransformReadableCollection()
3 => 'bar',
];

$collection = new class($array) implements ReadableCollection
{
$collection = new class($array) implements ReadableCollection {
public function __construct(private readonly array $array)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Symfony\Component\Cache\Tests\Adapter;

use Psr\Cache\CacheItemPoolInterface;
use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Cache\Adapter\RedisAdapter;

abstract class AbstractRedisAdapterTestCase extends AdapterTestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public static function setUpBeforeClass(): void
$hosts = explode(' ', getenv('REDIS_REPLICATION_HOSTS'));
$lastArrayKey = array_key_last($hosts);
$hostTable = [];
foreach($hosts as $key => $host) {
foreach ($hosts as $key => $host) {
$hostInformation = array_combine(['host', 'port'], explode(':', $host));
if($lastArrayKey === $key) {
if ($lastArrayKey === $key) {
$hostInformation['role'] = 'master';
}
$hostTable[] = $hostInformation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Symfony\Component\Cache\Tests\Adapter;

use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Psr\Cache\CacheItemPoolInterface;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
namespace Symfony\Component\Cache\Tests\Traits;

use PHPUnit\Framework\TestCase;
use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Cache\Traits\RedisProxyTrait;
use Symfony\Component\Cache\Traits\RelayClusterProxy;
use Symfony\Component\Cache\Traits\RelayProxy;
Expand Down Expand Up @@ -124,7 +124,6 @@ public function testRelayProxy()
$this->assertEquals($expectedProxy, $proxy);
}


/**
* @requires extension relay
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Symfony/Component/Cache/Traits/RedisTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use Predis\Connection\Replication\ReplicationInterface as Predis2ReplicationInterface;
use Predis\Response\ErrorInterface;
use Predis\Response\Status;
use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Relay\Sentinel;
use Symfony\Component\Cache\Exception\CacheException;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
Expand Down Expand Up @@ -382,20 +382,20 @@ public static function createConnection(#[\SensitiveParameter] string $dsn, arra
try {
$relayClusterContext = $params['relay_cluster_context'];

foreach (['allow_self_signed', 'verify_peer_name','verify_peer'] as $contextStreamBoolField) {
if(isset($relayClusterContext['stream'][$contextStreamBoolField])) {
foreach (['allow_self_signed', 'verify_peer_name', 'verify_peer'] as $contextStreamBoolField) {
if (isset($relayClusterContext['stream'][$contextStreamBoolField])) {
$relayClusterContext['stream'][$contextStreamBoolField] = filter_var($relayClusterContext['stream'][$contextStreamBoolField], \FILTER_VALIDATE_BOOL);
}
}

foreach (['use-cache', 'client-tracking','throw-on-error','client-invalidations','reply-literal','persistent'] as $contextBoolField) {
if(isset($relayClusterContext[$contextBoolField])) {
foreach (['use-cache', 'client-tracking', 'throw-on-error', 'client-invalidations', 'reply-literal', 'persistent'] as $contextBoolField) {
if (isset($relayClusterContext[$contextBoolField])) {
$relayClusterContext[$contextBoolField] = filter_var($relayClusterContext[$contextBoolField], \FILTER_VALIDATE_BOOL);
}
}

foreach (['max-retries', 'serializer','compression','compression-level'] as $contextIntField) {
if(isset($relayClusterContext[$contextIntField])) {
foreach (['max-retries', 'serializer', 'compression', 'compression-level'] as $contextIntField) {
if (isset($relayClusterContext[$contextIntField])) {
$relayClusterContext[$contextIntField] = filter_var($relayClusterContext[$contextIntField], \FILTER_VALIDATE_INT);
}
}
Expand Down
13 changes: 7 additions & 6 deletions src/Symfony/Component/Cache/Traits/RelayClusterProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(
int|float $command_timeout = 0,
bool $persistent = false,
#[\SensitiveParameter] mixed $auth = null,
array|null $context = null
array|null $context = null,
) {
$this->initializeLazyObject()->__construct(...\func_get_args());
}
Expand Down Expand Up @@ -157,7 +157,6 @@ public function endpointId(): array|false
return $this->initializeLazyObject()->endpointId(...\func_get_args());
}


public function rawCommand(array|string $key_or_address, string $cmd, mixed ...$args): mixed
{
return $this->initializeLazyObject()->rawCommand(...\func_get_args());
Expand Down Expand Up @@ -383,12 +382,13 @@ public function bitpos(mixed $key, int $bit, ?int $start = null, ?int $end = nul
return $this->initializeLazyObject()->bitpos(...\func_get_args());
}

public function blmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos, float $timeout): \Relay\Cluster|string|null|false
public function blmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos, float $timeout): \Relay\Cluster|string|false|null
{
return $this->initializeLazyObject()->blmove(...\func_get_args());
}

public function lmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos): Cluster|string|null|false {
public function lmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos): Cluster|string|false|null
{
return $this->initializeLazyObject()->lmove(...\func_get_args());
}

Expand Down Expand Up @@ -662,7 +662,8 @@ public function ltrim(mixed $key, int $start, int $end): \Relay\Cluster|bool
return $this->initializeLazyObject()->ltrim(...\func_get_args());
}

public static function maxMemory(): int {
public static function maxMemory(): int
{
return \Relay\Cluster::maxMemory();
}

Expand Down Expand Up @@ -1083,7 +1084,7 @@ public function zrangestore(mixed $dstkey, mixed $srckey, mixed $start, mixed $e

public function zrank(mixed $key, mixed $rank, bool $withscore = false): Cluster|array|int|false
{
return $this->initializeLazyObject()->zrank(...\func_get_args());
return $this->initializeLazyObject()->zrank(...\func_get_args());
}

public function zrangebylex(mixed $key, mixed $min, mixed $max, int $offset = -1, int $count = -1): \Relay\Cluster|array|false
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Clock/Test/ClockSensitiveTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Clock\Clock;
use Symfony\Component\Clock\ClockInterface;
use Symfony\Component\Clock\MockClock;

use function Symfony\Component\Clock\now;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Clock/Tests/ClockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Symfony\Component\Clock\MockClock;
use Symfony\Component\Clock\NativeClock;
use Symfony\Component\Clock\Test\ClockSensitiveTrait;

use function Symfony\Component\Clock\now;

class ClockTest extends TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Formatter;

use Symfony\Component\Console\Exception\InvalidArgumentException;

use function Symfony\Component\String\b;

/**
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Console/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Terminal;

use function Symfony\Component\String\s;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testArrayCsrfToken()
$validation->preSubmit($event);

$this->assertInstanceOf(FormErrorIterator::class, $this->form->getErrors());
$this->assertGreaterThan(0, count($this->form->getErrors()));
$this->assertGreaterThan(0, \count($this->form->getErrors()));
}

public function testMaxPostSizeExceeded()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private static function matchAllowedHostParts(array $uriParts, array $trustedPar
{
// Check each chunk of the domain is valid
foreach ($trustedParts as $key => $trustedPart) {
if (!array_key_exists($key, $uriParts) || $uriParts[$key] !== $trustedPart) {
if (!\array_key_exists($key, $uriParts) || $uriParts[$key] !== $trustedPart) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use Symfony\Component\HttpClient\Internal\Canary;
use Symfony\Component\HttpClient\Internal\ClientState;
use Symfony\Contracts\HttpClient\ResponseInterface;

use function Amp\delay;
use function Amp\Future\awaitFirst;

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Lock/Store/RedisStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

use Predis\Response\Error;
use Predis\Response\ServerException;
use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Lock\Exception\InvalidTtlException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\LockStorageException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Component\Lock\Tests\Store;

use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Lock\Exception\InvalidArgumentException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function setUpBeforeClass(): void
self::markTestSkipped('The Relay\Cluster class is required.');
}

if (getenv('REDIS_CLUSTER_HOSTS') === false) {
if (false === getenv('REDIS_CLUSTER_HOSTS')) {
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ private function registerReceivers(ContainerBuilder $container, array $busIds):
$failureTransportsMap[$tag['alias']] = $receiverMapping[$id];
}
}
if (!isset($tag['is_consumable']) || $tag['is_consumable'] !== false) {
if (!isset($tag['is_consumable']) || false !== $tag['is_consumable']) {
$consumableReceiverNames[] = $tag['alias'] ?? $id;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Contracts\HttpClient\HttpClientInterface;

use function Symfony\Component\String\u;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\AccessToken\Oidc;

use Symfony\Component\Security\Core\User\OidcUser;

use function Symfony\Component\String\u;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\String\Slugger\AsciiSlugger;
use Symfony\Component\String\UnicodeString;

use function Symfony\Component\String\u;

class UserBadgeTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Semaphore/Store/RedisStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Component\Semaphore\Store;

use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Semaphore\Exception\InvalidArgumentException;
use Symfony\Component\Semaphore\Exception\SemaphoreAcquiringException;
use Symfony\Component\Semaphore\Exception\SemaphoreExpiredException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\Component\Semaphore\Tests\Store;

use Relay\Relay;
use Relay\Cluster as RelayCluster;
use Relay\Relay;
use Symfony\Component\Semaphore\PersistingStoreInterface;
use Symfony\Component\Semaphore\Store\RedisStore;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function setUpBeforeClass(): void
self::markTestSkipped('The Relay\Cluster class is required.');
}

if (getenv('REDIS_CLUSTER_HOSTS') === false) {
if (false === getenv('REDIS_CLUSTER_HOSTS')) {
self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testExceptionWithEmptyMappingProperty()
public function testExceptionWithMissingDefaultTypeInMapping()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(sprintf('Default type "bar" given to "%s" must be present in "mapping" types.', DiscriminatorMap::class));
$this->expectExceptionMessage(\sprintf('Default type "bar" given to "%s" must be present in "mapping" types.', DiscriminatorMap::class));
new DiscriminatorMap(typeProperty: 'type', mapping: ['foo' => 'FooClass'], defaultType: 'bar');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
use Symfony\Component\Serializer\Tests\Dummy\DummyClassWithDiscriminatorMap;
use Symfony\Component\Serializer\Tests\Dummy\DummyClassOne;
use Symfony\Component\Serializer\Tests\Dummy\DummyClassWithDiscriminatorMap;

/**
* @author Loïc Frémont <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ public function getMetadataFor($value): ClassMetadataInterface
);
}

throw new InvalidArgumentException(sprintf('"%s" is not handled.', $value));
throw new InvalidArgumentException(\sprintf('"%s" is not handled.', $value));
}

public function hasMetadataFor($value): bool
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/String/Tests/FunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\String\AbstractString;
use Symfony\Component\String\ByteString;
use Symfony\Component\String\UnicodeString;

use function Symfony\Component\String\b;
use function Symfony\Component\String\s;
use function Symfony\Component\String\u;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Sequentially extends Composite
*/
public function __construct(mixed $constraints = null, ?array $groups = null, mixed $payload = null)
{
if (is_array($constraints) && !array_is_list($constraints)) {
if (\is_array($constraints) && !array_is_list($constraints)) {
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public function __construct(?array $options = null, ?string $message = null, ?ar
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
}

if (is_array($options) && isset($options['propertyPath'])) {
if (\is_array($options) && isset($options['propertyPath'])) {
throw new ConstraintDefinitionException(\sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', static::class));
}

if (is_array($options) && isset($options['value'])) {
if (\is_array($options) && isset($options['value'])) {
throw new ConstraintDefinitionException(\sprintf('The "value" option of the "%s" constraint cannot be set.', static::class));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testNullIsValid()

public function testEmptyStringIsValid()
{
$this->validator->validate('', new CardScheme(schemes:[]));
$this->validator->validate('', new CardScheme(schemes: []));

$this->assertNoViolation();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public static function provideConstraintsWithChoicesArray(): iterable

/**
* @group legacy
*
* @dataProvider provideLegacyConstraintsWithChoicesArrayDoctrineStyle
*/
public function testValidChoiceArrayDoctrineStyle(Choice $constraint)
Expand Down Expand Up @@ -126,6 +127,7 @@ public static function provideConstraintsWithCallbackFunction(): iterable

/**
* @group legacy
*
* @dataProvider provideLegacyConstraintsWithCallbackFunctionDoctrineStyle
*/
public function testValidChoiceCallbackFunctionDoctrineStyle(Choice $constraint)
Expand Down Expand Up @@ -262,6 +264,7 @@ public function testInvalidChoiceMultiple()
->setCode(Choice::NO_SUCH_CHOICE_ERROR)
->assertRaised();
}

/**
* @group legacy
*/
Expand Down
Loading
Loading