8000 Fix CS by fabpot · Pull Request #35587 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix CS #35587

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
Feb 4, 2020
Merged

Fix CS #35587

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 @@ -247,7 +247,7 @@ private static function getVendors()
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname(\dirname($r->getFileName()));
$v = \dirname($r->getFileName(), 2);
if (file_exists($v.'/composer/installed.json')) {
self::$vendors[] = $v;
$loader = require $v.'/autoload.php';
Expand Down
3 changes: 0 additions & 3 deletions src/Symfony/Bridge/Twig/Node/DumpNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ public function __construct($varPrefix, ?Node $values, int $lineno, string $tag
$this->varPrefix = $varPrefix;
}

/**
* @return void
*/
public function compile(Compiler $compiler): void
{
$compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ protected function doLeaveNode(Node $node, Environment $env): ?Node

/**
* {@inheritdoc}
*
* @return int
*/
public function getPriority(): int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 8000 @@ protected function doLeaveNode(Node $node, Environment $env): ?Node

/**
* {@inheritdoc}
*
* @return int
*/
public function getPriority(): int
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\Security\Core\Exception\LazyResponseException;
use Symfony\Component\Security\Http\Firewall\AbstractListener;
use Symfony\Component\VarDumper\Caster\ClassStub;

/**
* Wraps a lazy security listener.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle;

use Symfony\Component\DependencyInjection\Compiler\CheckTypeDeclarationsPass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;

use Symfony\Bridge\Twig\Extension\AssetExtension;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Cache/Adapter/PdoAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ private function getConnection(): object
} else {
switch ($this->driver = $this->conn->getDriver()->getName()) {
case 'mysqli':
throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', \get_class($this)));
throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class));
case 'pdo_mysql':
case 'drizzle_pdo_mysql':
$this->driver = 'mysql';
Expand Down
F438 2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public function run(InputInterface $input, OutputInterface $output)
$statusCode = $this->execute($input, $output);

if (!\is_int($statusCode)) {
throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, %s returned.', \get_class($this), \gettype($statusCode)));
throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, %s returned.', static::class, \gettype($statusCode)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
if ($ignoreNotFound = 'not_found' === $ignoreErrors) {
$args[2] = false;
} elseif (!\is_bool($ignoreErrors)) {
throw new \TypeError(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', \get_class($this), \gettype($ignoreErrors)));
throw new \TypeError(sprintf('Invalid argument $ignoreErrors provided to %s::import(): boolean or "not_found" expected, %s given.', static::class, \gettype($ignoreErrors)));
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function load($resource, string $type = null)
/**
* {@inheritdoc}
*/
public function supports($resource, string $type = null)
public function supports($resource, string $type = null)
{
if (!\is_string($resource)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\UriSigner;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Loader\ExistsLoaderInterface;
use Twig\Loader\SourceContextLoaderInterface;

/**
* Implements the Hinclude rendering strategy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

/**
* @author Konstantin Myakshin <molodchick@gmail.com>
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @experimental in 5.0
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Security/Http/Firewall.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\Security\Http\Firewall\AbstractListener;
use Symfony\Component\Security\Http\Firewall\AccessListener;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,9 @@ private function handleEventWithPreviousSession($userProviders, UserInterface $u

$tokenStorage = new TokenStorage();
$usageIndex = $session->getUsageIndex();
$tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class([
'session' => function () use ($session) { return $session; }
$tokenStorage = new UsageTrackingTokenStorage($tokenStorage, new class(['session' => function () use ($session) {
return $session;
},
]) implements ContainerInterface {
use ServiceLocatorTrait;
});
Expand Down
24 changes: 12 additions & 12 deletions src/Symfony/Component/String/AbstractString.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
*/
abstract class AbstractString implements \JsonSerializable
{
public const PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER;
public const PREG_SET_ORDER = \PREG_SET_ORDER;
public const PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE;
public const PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL;
public const PREG_PATTERN_ORDER = PREG_PATTERN_ORDER;
public const PREG_SET_ORDER = PREG_SET_ORDER;
public const PREG_OFFSET_CAPTURE = PREG_OFFSET_CAPTURE;
public const PREG_UNMATCHED_AS_NULL = PREG_UNMATCHED_AS_NULL;

public const PREG_SPLIT = 0;
public const PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY;
public const PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE;
public const PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE;
public const PREG_SPLIT_NO_EMPTY = PREG_SPLIT_NO_EMPTY;
public const PREG_SPLIT_DELIM_CAPTURE = PREG_SPLIT_DELIM_CAPTURE;
public const PREG_SPLIT_OFFSET_CAPTURE = PREG_SPLIT_OFFSET_CAPTURE;

protected $string = '';
protected $ignoreCase = false;
Expand Down Expand Up @@ -262,7 +262,7 @@ public function collapseWhitespace(): self
public function endsWith($suffix): bool
{
if (!\is_array($suffix) && !$suffix instanceof \Traversable) {
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this)));
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
}

foreach ($suffix as $s) {
Expand Down F438 Expand Up @@ -317,7 +317,7 @@ public function ensureStart(string $prefix): self
public function equalsTo($string): bool
{
if (!\is_array($string) && !$string instanceof \Traversable) {
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this)));
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
}

foreach ($string as $s) {
Expand Down Expand Up @@ -351,7 +351,7 @@ public function ignoreCase(): self
public function indexOf($needle, int $offset = 0): ?int
{
if (!\is_array($needle) && !$needle instanceof \Traversable) {
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this)));
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
}

$i = \PHP_INT_MAX;
Expand All @@ -373,7 +373,7 @@ public function indexOf($needle, int $offset = 0): ?int
public function indexOfLast($needle, int $offset = 0): ?int
{
if (!\is_array($needle) && !$needle instanceof \Traversable) {
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this)));
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
}

$i = null;
Expand Down Expand Up @@ -536,7 +536,7 @@ public function split(string $delimiter, int $limit = null, int $flags = null):
public function startsWith($prefix): bool
{
if (!\is_array($prefix) && !$prefix instanceof \Traversable) {
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, \get_class($this)));
throw new \TypeError(sprintf('Method "%s()" must be overridden by class "%s" to deal with non-iterable values.', __FUNCTION__, static::class));
}

foreach ($prefix as $prefix) {
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/String/AbstractUnicodeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function ascii(array $rules = []): self
}
} elseif (!\function_exists('iconv')) {
$s = preg_replace('/[^\x00-\x7F]/u', '?', $s);
} elseif (\ICONV_IMPL === 'glibc') {
} elseif (ICONV_IMPL === 'glibc') {
$s = iconv('UTF-8', 'ASCII//TRANSLIT', $s);
} else {
$s = preg_replace_callback('/[^\x00-\x7F]/u', static function ($c) {
Expand Down Expand Up @@ -223,7 +223,7 @@ public function lower(): parent

public function match(string $regexp, int $flags = 0, int $offset = 0): array
{
$match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
$match = ((PREG_PATTERN_ORDER | PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';

if ($this->ignoreCase) {
$regexp .= 'i';
Expand Down Expand Up @@ -309,7 +309,7 @@ public function replaceMatches(string $fromRegexp, $to): parent

if (\is_array($to) || $to instanceof \Closure) {
if (!\is_callable($to)) {
throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', \get_class($this)));
throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', static::class));
}

$replace = 'preg_replace_callback';
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/String/ByteString.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function lower(): parent

public function match(string $regexp, int $flags = 0, int $offset = 0): array
{
$match = ((\PREG_PATTERN_ORDER | \PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';
$match = ((PREG_PATTERN_ORDER | PREG_SET_ORDER) & $flags) ? 'preg_match_all' : 'preg_match';

if ($this->ignoreCase) {
$regexp .= 'i';
Expand Down Expand Up @@ -271,7 +271,7 @@ public function replaceMatches(string $fromRegexp, $to): parent

if (\is_array($to)) {
if (!\is_callable($to)) {
throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', \get_class($this)));
throw new \TypeError(sprintf('Argument 2 passed to %s::replaceMatches() must be callable, array given.', static::class));
}

$replace = 'preg_replace_callback';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Validator\Tests\Constraints;

use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\Validator\Constraints\Expression;
use Symfony\Component\Validator\Constraints\ExpressionValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Mapping\Cache\Psr6Cache;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;
Expand Down
3 changes: 0 additions & 3 deletions src/Symfony/Component/VarDumper/Test/VarDumperTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public function assertDumpMatchesFormat($expected, $data, int $filter = 0, strin
$this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message);
}

/**
* @return string|null
*/
protected function getDump($data, $key = null, int $filter = 0): ?string
{
if (null === $flags = $this->varDumperConfig['flags']) {
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/VarExporter/Internal/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class Exporter
* @param int &$objectsCount
* @param bool &$valuesAreStatic
*
* @return array
*
* @throws NotInstantiableTypeException When a value cannot be serialized
*/
public static function prepare($values, $objectsPool, &$refsPool, &$objectsCount, &$valuesAreStatic): array
Expand Down
0