fix code style

This commit is contained in:
Christian Flothmann 2021-01-04 16:44:05 +01:00
parent 74d8fb897a
commit 08fb696dbc
29 changed files with 29 additions and 32 deletions

View File

@ -50,7 +50,7 @@ $container->loadFromExtension('framework', [
'fallback' => 'fr',
'paths' => ['%kernel.project_dir%/Fixtures/translations'],
'cache_dir' => '%kernel.cache_dir%/translations',
'enabled_locales' => ['fr', 'en']
'enabled_locales' => ['fr', 'en'],
],
'validation' => [
'enabled' => true,

View File

@ -12,7 +12,7 @@ $container->loadFromExtension('framework', [
'initial_marking' => ['draft'],
'metadata' => [
'title' => 'article workflow',
'description' => 'workflow for articles'
'description' => 'workflow for articles',
],
'places' => [
'draft',

View File

@ -4,7 +4,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
class_alias(
ClassAliasTargetClass::class,
__NAMESPACE__ . '\ClassAliasExampleClass'
__NAMESPACE__.'\ClassAliasExampleClass'
);
if (false) {

View File

@ -6,7 +6,7 @@ use Symfony\Component\Validator\Constraints as Assert;
class Category
{
const NAME_PATTERN = '/\w+/';
public const NAME_PATTERN = '/\w+/';
public $id;

View File

@ -15,7 +15,6 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Version;
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\PdoAdapter;
use Symfony\Component\Cache\Tests\Traits\PdoPruneableTrait;

View File

@ -84,10 +84,10 @@ class Processor
if (isset($config[$key])) {
if (\is_string($config[$key]) || !\is_int(key($config[$key]))) {
// only one
return [$config[$key]];
return [$config[$key]];
}
return $config[$key];
return $config[$key];
}
return [];

View File

@ -23,7 +23,7 @@ class DummyOutput extends BufferedOutput
public function getLogs(): array
{
$logs = [];
foreach (explode(PHP_EOL, trim($this->fetch())) as $message) {
foreach (explode(\PHP_EOL, trim($this->fetch())) as $message) {
preg_match('/^\[(.*)\] (.*)/', $message, $matches);
$logs[] = sprintf('%s %s', $matches[1], $matches[2]);
}

View File

@ -21,7 +21,6 @@ use Symfony\Component\DependencyInjection\Argument\ServiceLocator;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass;
use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass;
use Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphEdge;
use Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;

View File

@ -478,7 +478,7 @@ class XmlFileLoader extends FileLoader
break;
case 'expression':
if (!class_exists(Expression::class)) {
throw new \LogicException(sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
throw new \LogicException('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".');
}
$arguments[$key] = new Expression($arg->nodeValue);

View File

@ -868,7 +868,7 @@ class YamlFileLoader extends FileLoader
}
} elseif (\is_string($value) && 0 === strpos($value, '@=')) {
if (!class_exists(Expression::class)) {
throw new \LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
throw new \LogicException('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".');
}
return new Expression(substr($value, 2));

View File

@ -16,7 +16,7 @@ class Foo
public static function createCallable(): callable
{
return function() {};
return function () {};
}
public static function createArray(): array

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
class FactoryDummy extends FactoryParent
{
public static function createFactory(): FactoryDummy
public static function createFactory(): self
{
}

View File

@ -11,4 +11,3 @@ class MultipleArgumentsOptionalScalarNotReallyOptional
{
}
}

View File

@ -204,7 +204,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
{
if (null !== $this->scale && null !== $this->roundingMode) {
// shift number to maintain the correct scale during rounding
$roundingCoef = pow(10, $this->scale);
$roundingCoef = 10 ** $this->scale;
if (self::FRACTIONAL == $this->type) {
$roundingCoef *= 100;

View File

@ -340,7 +340,7 @@ class TimeType extends AbstractType
$resolver->setNormalizer('view_timezone', function (Options $options, $viewTimezone): ?string {
if (null !== $options['model_timezone'] && $viewTimezone !== $options['model_timezone'] && null === $options['reference_date']) {
throw new LogicException(sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.'));
throw new LogicException('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.');
}
return $viewTimezone;

View File

@ -72,7 +72,7 @@ class JsonResponse extends Response
*/
public static function create($data = null, int $status = 200, array $headers = [])
{
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
return new static($data, $status, $headers);
}

View File

@ -58,7 +58,7 @@ class RedirectResponse extends Response
*/
public static function create($url = '', int $status = 302, array $headers = [])
{
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
return new static($url, $status, $headers);
}

View File

@ -234,7 +234,7 @@ class Response
*/
public static function create(?string $content = '', int $status = 200, array $headers = [])
{
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
return new static($content, $status, $headers);
}

View File

@ -52,7 +52,7 @@ class StreamedResponse extends Response
*/
public static function create($callback = null, int $status = 200, array $headers = [])
{
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
return new static($callback, $status, $headers);
}

View File

@ -9,7 +9,7 @@ class LdapTestCase extends TestCase
protected function getLdapConfig()
{
$h = @ldap_connect(getenv('LDAP_HOST'), getenv('LDAP_PORT'));
@ldap_set_option($h, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($h, \LDAP_OPT_PROTOCOL_VERSION, 3);
if (!$h || !@ldap_bind($h)) {
$this->markTestSkipped('No server is listening on LDAP_HOST:LDAP_PORT');

View File

@ -40,7 +40,7 @@ final class SesTransportFactory extends AbstractTransportFactory
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component or AsyncAws package is not installed. Try running "composer require async-aws/ses".', __CLASS__));
}
trigger_deprecation('symfony/amazon-mailer', '5.1', 'Using the "%s" transport without AsyncAws is deprecated. Try running "composer require async-aws/ses".', $scheme, \get_called_class());
trigger_deprecation('symfony/amazon-mailer', '5.1', 'Using the "%s" transport without AsyncAws is deprecated. Try running "composer require async-aws/ses".', $scheme, static::class);
$user = $this->getUser($dsn);
$password = $this->getPassword($dsn);

View File

@ -116,7 +116,7 @@ class DummyTransport implements Transport\TransportInterface
public function __toString(): string
{
return sprintf('dummy://local');
return 'dummy://local';
}
}

View File

@ -13,12 +13,12 @@ if (!file_exists($autoload)) {
require_once $autoload;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceiver;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\EventListener\DispatchPcntlSignalListener;
use Symfony\Component\Messenger\EventListener\StopWorkerOnSigtermSignalListener;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceiver;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection;
use Symfony\Component\Messenger\Transport\Serialization\Serializer;
use Symfony\Component\Messenger\Worker;
use Symfony\Component\Serializer as SerializerComponent;
@ -40,7 +40,7 @@ $worker = new Worker(['the_receiver' => $receiver], new class() implements Messa
public function dispatch($envelope, array $stamps = []): Envelope
{
echo 'Get envelope with message: '.get_class($envelope->getMessage())."\n";
echo sprintf("with stamps: %s\n", json_encode(array_keys($envelope->all()), JSON_PRETTY_PRINT));
echo sprintf("with stamps: %s\n", json_encode(array_keys($envelope->all()), \JSON_PRETTY_PRINT));
sleep(30);
echo "Done.\n";

View File

@ -194,7 +194,7 @@ class ConnectionTest extends TestCase
'expectedAutoSetup' => true,
];
yield 'test options array' => [
yield 'test options array' => [
'dsn' => 'doctrine://default',
'options' => [
'table_name' => 'name_from_options',

View File

@ -45,7 +45,7 @@ class RoutableMessageBus implements MessageBusInterface
if (null === $busNameStamp) {
if (null === $this->fallbackBus) {
throw new InvalidArgumentException(sprintf('Envelope is missing a BusNameStamp and no fallback message bus is configured on RoutableMessageBus.'));
throw new InvalidArgumentException('Envelope is missing a BusNameStamp and no fallback message bus is configured on RoutableMessageBus.');
}
return $this->fallbackBus->dispatch($envelope, $stamps);

View File

@ -59,7 +59,7 @@ final class EmailAddressContains extends Constraint
return false;
}
throw new \LogicException(sprintf('Unable to test a message address on a non-address header.'));
throw new \LogicException('Unable to test a message address on a non-address header.');
}
/**

View File

@ -35,7 +35,7 @@ abstract class AbstractAuthenticator implements AuthenticatorInterface
public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface
{
if (!$passport instanceof UserPassportInterface) {
throw new LogicException(sprintf('Passport does not contain a user, overwrite "createAuthenticatedToken()" in "%s" to create a custom authenticated token.', \get_class($this)));
throw new LogicException(sprintf('Passport does not contain a user, overwrite "createAuthenticatedToken()" in "%s" to create a custom authenticated token.', static::class));
}
return new PostAuthenticationToken($passport->getUser(), $firewallName, $passport->getUser()->getRoles());

View File

@ -23,7 +23,7 @@ class AbstractNormalizerDummy extends AbstractNormalizer
/**
* {@inheritdoc}
*/
public function getAllowedAttributes($classOrObject, array $context, bool $attributesAsString = false)
public function getAllowedAttributes($classOrObject, array $context, bool $attributesAsString = false)
{
return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString);
}

View File

@ -20,8 +20,8 @@ use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummy;
use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyFirstChild;
use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummySecondChild;
use Symfony\Component\Serializer\Tests\Fixtures\IgnoreDummy;
use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyThirdChild;
use Symfony\Component\Serializer\Tests\Fixtures\IgnoreDummy;
use Symfony\Component\Serializer\Tests\Mapping\TestClassMetadataFactory;
/**