Skip to content

Commit

Permalink
DX: re-apply CS
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus authored and nicolas-grekas committed Dec 30, 2023
1 parent fe482a4 commit 233110a
Show file tree
Hide file tree
Showing 23 changed files with 20 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;

use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Types\GuidType;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\AbstractQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgno
{
$entity1 = new SingleIntIdEntity(1, null);

$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectException(ConstraintDefinitionException::class);
$this->validator->validate($entity1, $constraint);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Monolog\Formatter\HtmlFormatter;
use Monolog\Formatter\LineFormatter;
use Monolog\Level;
use Monolog\Logger;
use Monolog\LogRecord;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public function testFormatArgsIntegration()
$this->assertEquals($expected, $this->render($template, $data));
}


public function testFormatFileIntegration()
{
$template = <<<'TWIG'
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MemcachedAdapter extends AbstractAdapter
/**
* We are replacing characters that are illegal in Memcached keys with reserved characters from
* {@see \Symfony\Contracts\Cache\ItemInterface::RESERVED_CHARACTERS} that are legal in Memcached.
* Note: don’t use {@see \Symfony\Component\Cache\Adapter\AbstractAdapter::NS_SEPARATOR}.
* Note: don’t use {@see AbstractAdapter::NS_SEPARATOR}.
*/
private const RESERVED_MEMCACHED = " \n\r\t\v\f\0";
private const RESERVED_PSR6 = '@()\{}/';
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
private static array $valuesCache = [];

/**
* @param $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire.
* Doing so is encouraged because it fits perfectly OPcache's memory model.
* @param bool $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire.
* Doing so is encouraged because it fits perfectly OPcache's memory model.
*
* @throws CacheException if OPcache is not enabled
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class YamlFileLoader extends FileLoader
private int $anonymousServicesCount;
private string $anonymousServicesSuffix;


public function load(mixed $resource, string $type = null): mixed
{
$path = $this->locator->locate($resource);
Expand Down Expand Up @@ -760,7 +759,7 @@ private function parseCallable(mixed $callable, string $parameter, string $id, s
*/
protected function loadFile(string $file): ?array
{
if (!class_exists(\Symfony\Component\Yaml\Parser::class)) {
if (!class_exists(YamlParser::class)) {
throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed. Try running "composer require symfony/yaml".');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/ErrorHandler/DebugClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function getClassLoader(): callable
public static function enable(): void
{
// Ensures we don't hit https://bugs.php.net/42098
class_exists(\Symfony\Component\ErrorHandler\ErrorHandler::class);
class_exists(ErrorHandler::class);
class_exists(\Psr\Log\LogLevel::class);

if (!\is_array($functions = spl_autoload_functions())) {
Expand Down
12 changes: 6 additions & 6 deletions src/Symfony/Component/Finder/Tests/Iterator/IteratorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ protected function assertOrderedIterator($expected, \Traversable $iterator)
}

/**
* Same as assertOrderedIterator, but checks the order of groups of
* array elements.
* Same as assertOrderedIterator, but checks the order of groups of
* array elements.
*
* @param array $expected - an array of arrays. For any two subarrays
* $a and $b such that $a goes before $b in $expected, the method
* asserts that any element of $a goes before any element of $b
* in the sequence generated by $iterator
* @param array $expected an array of arrays. For any two subarrays
* $a and $b such that $a goes before $b in $expected, the method
* asserts that any element of $a goes before any element of $b
* in the sequence generated by $iterator
*/
protected function assertOrderedIteratorForGroups(array $expected, \Traversable $iterator)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class StreamWrapper
private ResponseInterface $response;

/** @var resource|string|null */
private $content = null;
private $content;

/** @var resource|callable|null */
private $handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\PropertyAccess\Exception\InvalidTypeException;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Exception\PartialDenormalizationException;
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Ldap/Security/LdapAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait OidcTrait
{
private function createUser(array $claims): OidcUser
{
if (!\function_exists(\Symfony\Component\String\u::class)) {
if (!\function_exists(u::class)) {

Check failure on line 27 in src/Symfony/Component/Security/Http/AccessToken/Oidc/OidcTrait.php

View workflow job for this annotation

GitHub Actions / Psalm

UndefinedClass

src/Symfony/Component/Security/Http/AccessToken/Oidc/OidcTrait.php:27:31: UndefinedClass: Class, interface or enum named Symfony\Component\Security\Http\AccessToken\Oidc\u does not exist (see https://psalm.dev/019)
throw new \LogicException('You cannot use the "OidcUserInfoTokenHandler" since the String component is not installed. Try running "composer require symfony/string".');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class YamlFileLoader extends FileLoader
protected function loadResource(string $resource): array
{
if (!isset($this->yamlParser)) {
if (!class_exists(\Symfony\Component\Yaml\Parser::class)) {
if (!class_exists(YamlParser::class)) {
throw new LogicException('Loading translations from the YAML format requires the Symfony Yaml component.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Component\Validator\Constraints;

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Symfony\Component\Validator\Attribute\HasNamedArguments;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\ImageValidator;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testValidIpV6WithWhitespacesNamed()
{
$this->validator->validate(
"\n\t2001:0db8:85a3:0000:0000:8a2e:0370:7334\r\n",
new Ip(version: \Symfony\Component\Validator\Constraints\Ip::V6, normalizer: 'trim')
new Ip(version: Ip::V6, normalizer: 'trim')
);

$this->assertNoViolation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPath()

public function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPathNamed()
{
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectException(ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires only one of the "min" or "minPropertyPath" options to be set, not both.');
new Range(min: 'min', minPropertyPath: 'minPropertyPath');
}
Expand All @@ -47,7 +47,7 @@ public function testThrowsConstraintExceptionIfBothMaxLimitAndPropertyPath()

public function testThrowsConstraintExceptionIfBothMaxLimitAndPropertyPathNamed()
{
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectException(ConstraintDefinitionException::class);
$this->expectExceptionMessage('requires only one of the "max" or "maxPropertyPath" options to be set, not both.');
new Range(max: 'max', maxPropertyPath: 'maxPropertyPath');
}
Expand All @@ -67,7 +67,7 @@ public function testThrowsNoDefaultOptionConfiguredException()

public function testThrowsConstraintDefinitionExceptionIfBothMinAndMaxAndMinMessageOrMaxMessage()
{
$this->expectException(\Symfony\Component\Validator\Exception\ConstraintDefinitionException::class);
$this->expectException(ConstraintDefinitionException::class);
$this->expectExceptionMessage('can not use "minMessage" and "maxMessage" when the "min" and "max" options are both set. Use "notInRangeMessage" instead.');
new Range(min: 'min', max: 'max', minMessage: 'minMessage', maxMessage: 'maxMessage');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public function testCollapse()
],
[
'bar' => 123,
]
],
]);

$dumper = new CliDumper();
Expand Down

0 comments on commit 233110a

Please sign in to comment.