fix code style

This commit is contained in:
Christian Flothmann 2021-01-04 15:15:06 +01:00
parent 262525b95b
commit 89fedfa9e9
23 changed files with 30 additions and 30 deletions

View File

@ -32,10 +32,10 @@ class HttpCodeActivationStrategy extends ErrorLevelActivationStrategy
{
foreach ($exclusions as $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)) {
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 (\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

@ -491,7 +491,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

@ -813,7 +813,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

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

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

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

View File

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

View File

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

View File

@ -327,7 +327,7 @@ class TimeType extends AbstractType
$resolver->setDeprecated('model_timezone', function (Options $options, $modelTimezone): string {
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 '';

View File

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

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

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

View File

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

View File

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

@ -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

@ -193,7 +193,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

@ -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

@ -5,7 +5,7 @@ namespace Symfony\Component\Validator\Tests\Fixtures;
/**
* This class has two paths to PropertyGetterInterface:
* PropertyGetterInterface <- AbstractPropertyGetter <- PropertyGetter
* PropertyGetterInterface <- ChildGetterInterface <- PropertyGetter
* PropertyGetterInterface <- ChildGetterInterface <- PropertyGetter.
*/
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']) {
default:
@ -111,7 +111,7 @@ switch ($vars['REQUEST_URI']) {
break;
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-Length: '.strlen($output));
echo $output;