minor #39710 fix code style (xabbuh)

This PR was merged into the 4.4 branch.

Discussion
----------

fix code style

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

89fedfa9e9 fix code style
This commit is contained in:
Nicolas Grekas 2021-01-04 18:09:16 +01:00
commit bb5d52c42d
23 changed files with 30 additions and 30 deletions

View File

@ -32,10 +32,10 @@ class HttpCodeActivationStrategy extends ErrorLevelActivationStrategy
{ {
foreach ($exclusions as $exclusion) { foreach ($exclusions as $exclusion) {
if (!\array_key_exists('code', $exclusion)) { if (!\array_key_exists('code', $exclusion)) {
throw new \LogicException(sprintf('An exclusion must have a "code" key.')); throw new \LogicException('An exclusion must have a "code" key.');
} }
if (!\array_key_exists('urls', $exclusion)) { if (!\array_key_exists('urls', $exclusion)) {
throw new \LogicException(sprintf('An exclusion must have a "urls" key.')); throw new \LogicException('An exclusion must have a "urls" key.');
} }
} }

View File

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

View File

@ -491,7 +491,7 @@ class XmlFileLoader extends FileLoader
break; break;
case 'expression': case 'expression':
if (!class_exists(Expression::class)) { 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); $arguments[$key] = new Expression($arg->nodeValue);

View File

@ -813,7 +813,7 @@ class YamlFileLoader extends FileLoader
} }
} elseif (\is_string($value) && 0 === strpos($value, '@=')) { } elseif (\is_string($value) && 0 === strpos($value, '@=')) {
if (!class_exists(Expression::class)) { 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)); return new Expression(substr($value, 2));

View File

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

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
@trigger_error('deprecated', E_USER_DEPRECATED); @trigger_error('deprecated', \E_USER_DEPRECATED);
class DeprecatedClass class DeprecatedClass
{ {

View File

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

View File

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

View File

@ -4,7 +4,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
if (PHP_VERSION_ID >= 80000) { if (\PHP_VERSION_ID >= 80000) {
require __DIR__.'/uniontype_classes.php'; require __DIR__.'/uniontype_classes.php';
} }
@ -275,6 +275,7 @@ class Wither
/** /**
* @required * @required
*
* @return static * @return static
*/ */
public function withFoo1(Foo $foo) public function withFoo1(Foo $foo)
@ -284,6 +285,7 @@ class Wither
/** /**
* @required * @required
*
* @return static * @return static
*/ */
public function withFoo2(Foo $foo) public function withFoo2(Foo $foo)

View File

@ -41,7 +41,7 @@ class Html5ParserCrawlerTest extends AbstractCrawlerTest
} }
/** @dataProvider invalidHtml5Provider */ /** @dataProvider invalidHtml5Provider */
public function testHtml5ParserWithInvalidHeadedContent(string $content): void public function testHtml5ParserWithInvalidHeadedContent(string $content)
{ {
$this->skipTestIfHTML5LibraryNotAvailable(); $this->skipTestIfHTML5LibraryNotAvailable();

View File

@ -41,7 +41,6 @@ class FinalClass4
/** /**
* @author John Doe * @author John Doe
* *
*
* @final multiline * @final multiline
* comment * comment
*/ */

View File

@ -327,7 +327,7 @@ class TimeType extends AbstractType
$resolver->setDeprecated('model_timezone', function (Options $options, $modelTimezone): string { $resolver->setDeprecated('model_timezone', function (Options $options, $modelTimezone): string {
if (null !== $modelTimezone && $options['view_timezone'] !== $modelTimezone && null === $options['reference_date']) { if (null !== $modelTimezone && $options['view_timezone'] !== $modelTimezone && null === $options['reference_date']) {
return sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4.'); return 'Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4.';
} }
return ''; return '';

View File

@ -70,7 +70,7 @@ class StringToFloatTransformerTest extends TestCase
/** /**
* @dataProvider provideReverseTransformations * @dataProvider provideReverseTransformations
*/ */
public function testReverseTransform($from, $to, int $scale = null): void public function testReverseTransform($from, $to, int $scale = null)
{ {
$transformer = new StringToFloatTransformer($scale); $transformer = new StringToFloatTransformer($scale);

View File

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

View File

@ -64,7 +64,7 @@ abstract class TransportFactoryTestCase extends TestCase
/** /**
* @dataProvider createProvider * @dataProvider createProvider
*/ */
public function testCreate(Dsn $dsn, TransportInterface $transport): void public function testCreate(Dsn $dsn, TransportInterface $transport)
{ {
$factory = $this->getFactory(); $factory = $this->getFactory();
@ -77,7 +77,7 @@ abstract class TransportFactoryTestCase extends TestCase
/** /**
* @dataProvider unsupportedSchemeProvider * @dataProvider unsupportedSchemeProvider
*/ */
public function testUnsupportedSchemeException(Dsn $dsn, string $message = null): void public function testUnsupportedSchemeException(Dsn $dsn, string $message = null)
{ {
$factory = $this->getFactory(); $factory = $this->getFactory();
@ -92,7 +92,7 @@ abstract class TransportFactoryTestCase extends TestCase
/** /**
* @dataProvider incompleteDsnProvider * @dataProvider incompleteDsnProvider
*/ */
public function testIncompleteDsnException(Dsn $dsn): void public function testIncompleteDsnException(Dsn $dsn)
{ {
$factory = $this->getFactory(); $factory = $this->getFactory();

View File

@ -38,7 +38,7 @@ class DsnTest extends TestCase
/** /**
* @dataProvider invalidDsnProvider * @dataProvider invalidDsnProvider
*/ */
public function testInvalidDsn(string $dsn, string $exceptionMessage): void public function testInvalidDsn(string $dsn, string $exceptionMessage)
{ {
$this->expectException(InvalidArgumentException::class); $this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage($exceptionMessage); $this->expectExceptionMessage($exceptionMessage);

View File

@ -63,7 +63,7 @@ class TransportTest extends TestCase
/** /**
* @dataProvider fromDsnProvider * @dataProvider fromDsnProvider
*/ */
public function testFromDsn(string $dsn, TransportInterface $transport): void public function testFromDsn(string $dsn, TransportInterface $transport)
{ {
$this->assertEquals($transport, Transport::fromDsn($dsn)); $this->assertEquals($transport, Transport::fromDsn($dsn));
} }
@ -79,7 +79,7 @@ class TransportTest extends TestCase
/** /**
* @dataProvider fromWrongStringProvider * @dataProvider fromWrongStringProvider
*/ */
public function testFromWrongString(string $dsn, string $error): void public function testFromWrongString(string $dsn, string $error)
{ {
$transportFactory = new Transport([new DummyTransportFactory()]); $transportFactory = new Transport([new DummyTransportFactory()]);
@ -116,7 +116,7 @@ class DummyTransport implements Transport\TransportInterface
public function __toString(): string public function __toString(): string
{ {
return sprintf('dummy://local'); return 'dummy://local';
} }
} }

View File

@ -45,7 +45,7 @@ class RoutableMessageBus implements MessageBusInterface
if (null === $busNameStamp) { if (null === $busNameStamp) {
if (null === $this->fallbackBus) { 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); return $this->fallbackBus->dispatch($envelope, $stamps);

View File

@ -40,7 +40,7 @@ $worker = new Worker(['the_receiver' => $receiver], new class() implements Messa
public function dispatch($envelope, array $stamps = []): Envelope public function dispatch($envelope, array $stamps = []): Envelope
{ {
echo 'Get envelope with message: '.get_class($envelope->getMessage())."\n"; 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); sleep(30);
echo "Done.\n"; echo "Done.\n";

View File

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

View File

@ -59,7 +59,7 @@ final class EmailAddressContains extends Constraint
return false; 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

@ -5,7 +5,7 @@ namespace Symfony\Component\Validator\Tests\Fixtures;
/** /**
* This class has two paths to PropertyGetterInterface: * This class has two paths to PropertyGetterInterface:
* PropertyGetterInterface <- AbstractPropertyGetter <- PropertyGetter * PropertyGetterInterface <- AbstractPropertyGetter <- PropertyGetter
* PropertyGetterInterface <- ChildGetterInterface <- PropertyGetter * PropertyGetterInterface <- ChildGetterInterface <- PropertyGetter.
*/ */
class PropertyGetter extends AbstractPropertyGetter implements ChildGetterInterface class PropertyGetter extends AbstractPropertyGetter implements ChildGetterInterface
{ {

View File

@ -29,7 +29,7 @@ foreach ($_SERVER as $k => $v) {
} }
} }
$json = json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $json = json_encode($vars, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
switch ($vars['REQUEST_URI']) { switch ($vars['REQUEST_URI']) {
default: default:
@ -111,7 +111,7 @@ switch ($vars['REQUEST_URI']) {
break; break;
case '/post': case '/post':
$output = json_encode($_POST + ['REQUEST_METHOD' => $vars['REQUEST_METHOD']], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $output = json_encode($_POST + ['REQUEST_METHOD' => $vars['REQUEST_METHOD']], \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
header('Content-Type: application/json', true); header('Content-Type: application/json', true);
header('Content-Length: '.strlen($output)); header('Content-Length: '.strlen($output));
echo $output; echo $output;