8000 Merge branch '3.4' into 4.4 · symfony/symfony@3ee39e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ee39e7

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: Fix CS
2 parents cb16fe7 + 2e27353 commit 3ee39e7

File tree

29 files changed

+61
-61
lines changed

29 files changed

+61
-61
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ protected function createContainer(array $data = [])
16201620

16211621
protected function createContainerFromFile($file, $data = [], $resetCompilerPasses = true, $compile = true)
16221622
{
1623-
$cacheKey = md5(\get_class($this).$file.serialize($data));
1623+
$cacheKey = md5(static::class.$file.serialize($data));
16241624
if ($compile && isset(self::$containerCache[$cacheKey])) {
16251625
return self::$containerCache[$cacheKey];
16261626
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ protected static function createKernel(array $options = []): KernelInterface
6969

7070
protected static function getVarDir()
7171
{
72-
return 'FB'.substr(strrchr(\get_called_class(), '\\'), 1);
72+
return 'FB'.substr(strrchr(static::class, '\\'), 1);
7373
}
7474
}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ protected static function createKernel(array $options = []): KernelInterface
6969

7070
protected static function getVarDir()
7171
{
72-
return 'SB'.substr(strrchr(\get_called_class(), '\\'), 1);
72+
return 'SB'.substr(strrchr(static::class, '\\'), 1);
7373
}
7474
}

src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testUnserializable()
5555

5656
public function testVersion()
5757
{
58-
$namespace = str_replace('\\', '.', \get_class($this));
58+
$namespace = str_replace('\\', '.', static::class);
5959

6060
$pool1 = new ApcuAdapter($namespace, 0, 'p1');
6161

@@ -80,7 +80,7 @@ public function testVersion()
8080

8181
public function testNamespace()
8282
{
83-
$namespace = str_replace('\\', '.', \get_class($this));
83+
$namespace = str_replace('\\', '.', static::class);
8484

8585
$pool1 = new ApcuAdapter($namespace.'_1', 0, 'p1');
8686

src/Symfony/Component/Console/Command/Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Command
5555
*/
5656
public static function getDefaultName()
5757
{
58-
$class = \get_called_class();
58+
$class = static::class;
5959
$r = new \ReflectionProperty($class, 'defaultName');
6060

6161
return $class === $r->class ? static::$defaultName : null;
@@ -344,7 +344,7 @@ public function setDefinition($definition)
344344
public function getDefinition()
345345
{
346346
if (null === $this->definition) {
347-
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($this)));
347+
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
348348
}
349349

350350
return $this->definition;

src/Symfony/Component/CssSelector/Node/AbstractNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class AbstractNode implements NodeInterface
3131
public function getNodeName(): string
3232
{
3333
if (null === $this->nodeName) {
34-
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', \get_called_class());
34+
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class);
3535
}
3636

3737
return $this->nodeName;

src/Symfony/Component/DependencyInjection/Extension/Extension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getNamespace()
6565
*/
6666
public function getAlias()
6767
{
68-
$className = \get_class($this);
68+
$className = static::class;
6969
if ('Extension' != substr($className, -9)) {
7070
throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.');
7171
}
@@ -79,7 +79,7 @@ public function getAlias()
7979
*/
8080
public function getConfiguration(array $config, ContainerBuilder $container)
8181
{
82-
$class = \get_class($this);
82+
$class = static::class;
8383

8484
if (false !== strpos($class, "\0")) {
8585
return null; // ignore anonymous classes

src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __call($method, $args)
3131
return $this->{'set'.$method}(...$args);
3232
}
3333

34-
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
34+
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method));
3535
}
3636

3737
/**

src/Symfony/Component/ExpressionLanguage/Node/Node.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __toString()
4343
$attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true)));
4444
}
4545

46-
$repr = [str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', \get_class($this)).'('.implode(', ', $attributes)];
46+
$repr = [str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', static::class).'('.implode(', ', $attributes)];
4747

4848
if (\count($this->nodes)) {
4949
foreach ($this->nodes as $node) {
@@ -79,7 +79,7 @@ public function evaluate($functions, $values)
7979

8080
public function toArray()
8181
{
82-
throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', \get_class($this)));
82+
throw new \BadMethodCallException(sprintf('Dumping a "%s" instance is not supported yet.', static::class));
8383
}
8484

8585
public function dump()

src/Symfony/Component/Form/AbstractType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function configureOptions(OptionsResolver $resolver)
5252
*/
5353
public function getBlockPrefix()
5454
{
55-
return StringUtil::fqcnToBlockPrefix(\get_class($this)) ?: '';
55+
return StringUtil::fqcnToBlockPrefix(static::class) ?: '';
5656
}
5757

5858
/**

src/Symfony/Component/HttpFoundation/RedirectResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(?string $url, int $status = 302, array $headers = []
4747
throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status));
4848
}
4949

50-
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) {
50+
if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, CASE_LOWER))) {
5151
$this->headers->remove('cache-control');
5252
}
5353
}

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function destroy($sessionId)
121121
{
122122
if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) {
123123
if (!$this->sessionName) {
124-
throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', \get_class($this)));
124+
throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class));
125125
}
126126
$cookie = SessionUtils::popSessionCookie($this->sessionName, $sessionId);
127127

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function start()
139139
return true;
140140
}
141141

142-
if (\PHP_SESSION_ACTIVE === session_status()) {
142+
if (PHP_SESSION_ACTIVE === session_status()) {
143143
throw new \RuntimeException('Failed to start the session: already started by PHP.');
144144
}
145145

@@ -202,7 +202,7 @@ public function setName($name)
202202
public function regenerate($destroy = false, $lifetime = null)
203203
{
204204
// Cannot regenerate the session ID for non-active sessions.
205-
if (\PHP_SESSION_ACTIVE !== session_status()) {
205+
if (PHP_SESSION_ACTIVE !== session_status()) {
206206
return false;
207207
}
208208

@@ -362,7 +362,7 @@ public function isStarted()
362362
*/
363363
public function setOptions(array $options)
364364
{
365-
if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
365+
if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) {
366366
return;
367367
}
368368

@@ -427,7 +427,7 @@ public function setSaveHandler($saveHandler = null)
427427
}
428428
$this->saveHandler = $saveHandler;
429429

430-
if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
430+
if (headers_sent() || PHP_SESSION_ACTIVE === session_status()) {
431431
return;
432432
}
433433

src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function isWrapper()
6565
*/
6666
public function isActive()
6767
{
68-
return \PHP_SESSION_ACTIVE === session_status();
68+
return PHP_SESSION_ACTIVE === session_status();
6969
}
7070

7171
/**

src/Symfony/Component/HttpKernel/Log/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,6 @@ private function format(string $level, string $message, array $context): string
101101
$message = strtr($message, $replacements);
102102
}
103103

104-
return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).\PHP_EOL;
104+
return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).PHP_EOL;
105105
}
106106
}

src/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function provideControllerCallables()
9999
'"Regular" callable',
100100
[$this, 'testControllerInspection'],
101101
[
102-
'class' => RequestDataCollectorTest::class,
102+
'class' => self::class,
103103
'method' => 'testControllerInspection',
104104
'file' => __FILE__,
105105
'line' => $r1->getStartLine(),

src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function testContextExceptionKeyCanBeExceptionOrOtherValues()
186186
public function testFormatter()
187187
{
188188
$this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) {
189-
return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).\PHP_EOL;
189+
return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).PHP_EOL;
190190
});
191191

192192
$this->logger->error('An error', ['foo' => 'bar']);

src/Symfony/Component/Intl/Collator/Collator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ public static function create($locale)
109109
public function asort(&$array, $sortFlag = self::SORT_REGULAR)
110110
{
111111
$intlToPlainFlagMap = [
112-
self::SORT_REGULAR => \SORT_REGULAR,
113-
self::SORT_NUMERIC => \SORT_NUMERIC,
114-
self::SORT_STRING => \SORT_STRING,
112+
self::SORT_REGULAR => SORT_REGULAR,
113+
self::SORT_NUMERIC => SORT_NUMERIC,
114+
self::SORT_STRING => SORT_STRING,
115115
];
116116

117117
$plainSortFlag = isset($intlToPlainFlagMap[$sortFlag]) ? $intlToPlainFlagMap[$sortFlag] : self::SORT_REGULAR;

src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ abstract class NumberFormatter
201201
* @see https://php.net/round
202202
*/
203203
private static $phpRoundingMap = [
204-
self::ROUND_HALFDOWN => \PHP_ROUND_HALF_DOWN,
205-
self::ROUND_HALFEVEN => \PHP_ROUND_HALF_EVEN,
206-
self::ROUND_HALFUP => \PHP_ROUND_HALF_UP,
204+
self::ROUND_HALFDOWN => PHP_ROUND_HALF_DOWN,
205+
self::ROUND_HALFEVEN => PHP_ROUND_HALF_EVEN,
206+
self::ROUND_HALFUP => PHP_ROUND_HALF_UP,
207207
];
208208

209209
/**
@@ -357,7 +357,7 @@ public function format($value, $type = self::TYPE_DEFAULT)
357357

358358
// The original NumberFormatter does not support this format type
359359
if (self::TYPE_CURRENCY === $type) {
360-
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
360+
trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING);
361361

362362
return false;
363363
}
@@ -513,7 +513,7 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
513513
$type = (int) $type;
514514

515515
if (self::TYPE_DEFAULT === $type || self::TYPE_CURRENCY === $type) {
516-
trigger_error(__METHOD__.'(): Unsupported format type '.$type, \E_USER_WARNING);
516+
trigger_error(__METHOD__.'(): Unsupported format type '.$type, E_USER_WARNING);
517517

518518
return false;
519519
}

src/Symfony/Component/Process/Tests/PipeStdinInStdoutStdErrStreamSelect.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
$n = stream_select($r, $w, $e, 5);
3030

3131
if (false === $n) {
32-
die(ERR_SELECT_FAILED);
32+
exit(ERR_SELECT_FAILED);
3333
} elseif ($n < 1) {
34-
die(ERR_TIMEOUT);
34+
exit(ERR_TIMEOUT);
3535
}
3636

3737
if (in_array(STDOUT, $w) && strlen($out) > 0) {
3838
$written = fwrite(STDOUT, (string) $out, 32768);
3939
if (false === $written) {
40-
die(ERR_WRITE_FAILED);
40+
exit(ERR_WRITE_FAILED);
4141
}
4242
$out = (string) substr($out, $written);
4343
}
@@ -48,7 +48,7 @@
4848
if (in_array(STDERR, $w) && strlen($err) > 0) {
4949
$written = fwrite(STDERR, (string) $err, 32768);
5050
if (false === $written) {
51-
die(ERR_WRITE_FAILED);
51+
exit(ERR_WRITE_FAILED);
5252
}
5353
$err = (string) substr($err, $written);
5454
}
@@ -65,7 +65,7 @@
6565
if (false === $str || feof(STDIN)) {
6666
$read = null;
6767
if (!feof(STDIN)) {
68-
die(ERR_READ_FAILED);
68+
exit(ERR_READ_FAILED);
6969
}
7070
}
7171
}

src/Symfony/Component/Routing/Annotation/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function __construct(array $data)
7474
foreach ($data as $key => $value) {
7575
$method = 'set'.str_replace('_', '', $key);
7676
if (!method_exists($this, $method)) {
77-
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this)));
77+
throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, static::class));
7878
}
7979
$this->$method($value);
8080
}

src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public function setAttribute($name, $value)
288288
*/
289289
public function __toString()
290290
{
291-
$class = \get_class($this);
291+
$class = static::class;
292292
$class = substr($class, strrpos($class, '\\') + 1);
293293

294294
$roles = [];

src/Symfony/Component/Security/Core/Encoder/Argon2iPasswordEncoder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function isSupported()
5151
return true;
5252
}
5353

54-
return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>=');
54+
return version_compare(\extension_loaded('sodium') ? SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.9', '>=');
5555
}
5656

5757
/**
@@ -104,15 +104,15 @@ public function isPasswordValid($encoded, $raw, $salt)
104104

105105
private function encodePasswordNative(string $raw): string
106106
{
107-
return password_hash($raw, \PASSWORD_ARGON2I, $this->config);
107+
return password_hash($raw, PASSWORD_ARGON2I, $this->config);
108108
}
109109

110110
private function encodePasswordSodiumFunction(string $raw): string
111111
{
112112
$hash = sodium_crypto_pwhash_str(
113113
$raw,
114-
\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
115-
\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
114+
SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
115+
SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
116116
);
117117
sodium_memzero($raw);
118118

src/Symfony/Component/Serializer/Annotation/Groups.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ class Groups
3434
public function __construct(array $data)
3535
{
3636
if (!isset($data['value']) || !$data['value']) {
37-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', \get_class($this)));
37+
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', static::class));
3838
}
3939

4040
$value = (array) $data['value'];
4141
foreach ($value as $group) {
4242
if (!\is_string($group)) {
43-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', \get_class($this)));
43+
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a string or an array of strings.', static::class));
4444
}
4545
}
4646

src/Symfony/Component/Serializer/Annotation/MaxDepth.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ class MaxDepth
3131
public function __construct(array $data)
3232
{
3333
if (!isset($data['value'])) {
34-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', \get_class($this)));
34+
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', static::class));
3535
}
3636

3737
if (!\is_int($data['value']) || $data['value'] <= 0) {
38-
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', \get_class($this)));
38+
throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', static::class));
3939
}
4040

4141
$this->maxDepth = $data['value'];

0 commit comments

Comments
 (0)
0