Skip to content

Commit 6c2a1c9

Browse files
Merge branch '3.4' into 4.4
* 3.4: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public
2 parents 52719f2 + 4351a70 commit 6c2a1c9

File tree

588 files changed

+1940
-1942
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

588 files changed

+1940
-1942
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ return PhpCsFixer\Config::create()
1313
'array_syntax' => ['syntax' => 'short'],
1414
'fopen_flags' => false,
1515
'protected_to_private' => false,
16+
'native_constant_invocation' => true,
1617
'combine_nested_dirname' => true,
1718
])
1819
->setRiskyAllowed(true)

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ protected function detectMetadataDriver($dir, ContainerBuilder $container)
253253
$configPath = $this->getMappingResourceConfigDirectory();
254254
$extension = $this->getMappingResourceExtension();
255255

256-
if (glob($dir.'/'.$configPath.'/*.'.$extension.'.xml', GLOB_NOSORT)) {
256+
if (glob($dir.'/'.$configPath.'/*.'.$extension.'.xml', \GLOB_NOSORT)) {
257257
$driver = 'xml';
258-
} elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.yml', GLOB_NOSORT)) {
258+
} elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.yml', \GLOB_NOSORT)) {
259259
$driver = 'yml';
260-
} elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.php', GLOB_NOSORT)) {
260+
} elseif (glob($dir.'/'.$configPath.'/*.'.$extension.'.php', \GLOB_NOSORT)) {
261261
$driver = 'php';
262262
} else {
263263
// add the closest existing directory as a resource
@@ -435,7 +435,7 @@ abstract protected function getMappingResourceExtension();
435435
*/
436436
protected function getMetadataDriverClass(string $driverType): string
437437
{
438-
@trigger_error(sprintf('Not declaring the "%s" method in class "%s" is deprecated since Symfony 4.4. This method will be abstract in Symfony 5.0.', __METHOD__, static::class), E_USER_DEPRECATED);
438+
@trigger_error(sprintf('Not declaring the "%s" method in class "%s" is deprecated since Symfony 4.4. This method will be abstract in Symfony 5.0.', __METHOD__, static::class), \E_USER_DEPRECATED);
439439

440440
return '%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%');
441441
}

src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(ObjectManager $manager, string $class, IdReader $idR
4747
$classMetadata = $manager->getClassMetadata($class);
4848

4949
if ($idReader && !$idReader->isSingleId()) {
50-
@trigger_error(sprintf('Passing an instance of "%s" to "%s" with an entity class "%s" that has a composite id is deprecated since Symfony 4.3 and will throw an exception in 5.0.', IdReader::class, __CLASS__, $class), E_USER_DEPRECATED);
50+
@trigger_error(sprintf('Passing an instance of "%s" to "%s" with an entity class "%s" that has a composite id is deprecated since Symfony 4.3 and will throw an exception in 5.0.', IdReader::class, __CLASS__, $class), \E_USER_DEPRECATED);
5151

5252
// In Symfony 5.0
5353
// throw new \InvalidArgumentException(sprintf('The second argument `$idReader` of "%s" must be null when the query cannot be optimized because of composite id fields.', __METHOD__));
@@ -57,7 +57,7 @@ public function __construct(ObjectManager $manager, string $class, IdReader $idR
5757
$idReader = new IdReader($manager, $classMetadata);
5858

5959
if ($idReader->isSingleId()) {
60-
@trigger_error(sprintf('Not explicitly passing an instance of "%s" to "%s" when it can optimize single id entity "%s" has been deprecated in 4.3 and will not apply any optimization in 5.0.', IdReader::class, __CLASS__, $class), E_USER_DEPRECATED);
60+
@trigger_error(sprintf('Not explicitly passing an instance of "%s" to "%s" when it can optimize single id entity "%s" has been deprecated in 4.3 and will not apply any optimization in 5.0.', IdReader::class, __CLASS__, $class), \E_USER_DEPRECATED);
6161
} else {
6262
$idReader = null;
6363
}

src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($entityManager)
4444
if ($entityManager instanceof EntityManagerInterface) {
4545
$this->entityManager = $entityManager;
4646
} elseif ($entityManager instanceof ClassMetadataFactory) {
47-
@trigger_error(sprintf('Injecting an instance of "%s" in "%s" is deprecated since Symfony 4.2, inject an instance of "%s" instead.', ClassMetadataFactory::class, __CLASS__, EntityManagerInterface::class), E_USER_DEPRECATED);
47+
@trigger_error(sprintf('Injecting an instance of "%s" in "%s" is deprecated since Symfony 4.2, inject an instance of "%s" instead.', ClassMetadataFactory::class, __CLASS__, EntityManagerInterface::class), \E_USER_DEPRECATED);
4848
$this->classMetadataFactory = $entityManager;
4949
} else {
5050
throw new \TypeError(sprintf('$entityManager must be an instance of "%s", "%s" given.', EntityManagerInterface::class, \is_object($entityManager) ? \get_class($entityManager) : \gettype($entityManager)));

src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function handle(array $record)
6767

6868
try {
6969
if (-1 === stream_socket_sendto($this->socket, $recordFormatted)) {
70-
stream_socket_shutdown($this->socket, STREAM_SHUT_RDWR);
70+
stream_socket_shutdown($this->socket, \STREAM_SHUT_RDWR);
7171

7272
// Let's retry: the persistent connection might just be stale
7373
if ($this->socket = $this->createSocket()) {
@@ -97,7 +97,7 @@ private static function nullErrorHandler()
9797

9898
private function createSocket()
9999
{
100-
$socket = stream_socket_client($this->host, $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_PERSISTENT, $this->context);
100+
$socket = stream_socket_client($this->host, $errno, $errstr, 0, \STREAM_CLIENT_CONNECT | \STREAM_CLIENT_ASYNC_CONNECT | \STREAM_CLIENT_PERSISTENT, $this->context);
101101

102102
if ($socket) {
103103
stream_set_blocking($socket, false);

src/Symfony/Bridge/Monolog/Logger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface
3030
public function getLogs(/* Request $request = null */)
3131
{
3232
if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
33-
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
33+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
3434
}
3535

3636
if ($logger = $this->getDebugLogger()) {
@@ -48,7 +48,7 @@ public function getLogs(/* Request $request = null */)
4848
public function countErrors(/* Request $request = null */)
4949
{
5050
if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
51-
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
51+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
5252
}
5353

5454
if ($logger = $this->getDebugLogger()) {

src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __invoke(array $record)
6464
public function getLogs(/* Request $request = null */)
6565
{
6666
if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
67-
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
67+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
6868
}
6969

7070
if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) {
@@ -86,7 +86,7 @@ public function getLogs(/* Request $request = null */)
8686
public function countErrors(/* Request $request = null */)
8787
{
8888
if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) {
89-
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED);
89+
@trigger_error(sprintf('The "%s()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
9090
}
9191

9292
if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) {

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static function collectDeprecations($outputFile)
9696
{
9797
$deprecations = [];
9898
$previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$previousErrorHandler) {
99-
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type && (E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) {
99+
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) {
100100
if ($previousErrorHandler) {
101101
return $previousErrorHandler($type, $msg, $file, $line, $context);
102102
}
@@ -128,7 +128,7 @@ public static function collectDeprecations($outputFile)
128128
*/
129129
public function handleError($type, $msg, $file, $line, $context = [])
130130
{
131-
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type && (E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) {
131+
if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) {
132132
return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
133133
}
134134

@@ -338,7 +338,7 @@ private static function getPhpUnitErrorHandler()
338338
return 'PHPUnit\Util\ErrorHandler::handleError';
339339
}
340340

341-
foreach (debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
341+
foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
342342
if (isset($frame['object']) && $frame['object'] instanceof TestResult) {
343343
return new ErrorHandler(
344344
$frame['object']->getConvertDeprecationsToExceptions(),
@@ -377,21 +377,21 @@ private static function hasColorSupport()
377377

378378
if (\DIRECTORY_SEPARATOR === '\\') {
379379
return (\function_exists('sapi_windows_vt100_support')
380-
&& sapi_windows_vt100_support(STDOUT))
380+
&& sapi_windows_vt100_support(\STDOUT))
381381
|| false !== getenv('ANSICON')
382382
|| 'ON' === getenv('ConEmuANSI')
383383
|| 'xterm' === getenv('TERM');
384384
}
385385

386386
if (\function_exists('stream_isatty')) {
387-
return stream_isatty(STDOUT);
387+
return stream_isatty(\STDOUT);
388388
}
389389

390390
if (\function_exists('posix_isatty')) {
391-
return posix_isatty(STDOUT);
391+
return posix_isatty(\STDOUT);
392392
}
393393

394-
$stat = fstat(STDOUT);
394+
$stat = fstat(\STDOUT);
395395

396396
// Check if formatted mode is S_IFCHR
397397
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;

src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ public function testDnsGetRecord()
141141

142142
$this->assertFalse(DnsMock::dns_get_record('foobar.com'));
143143
$this->assertSame($records, DnsMock::dns_get_record('example.com'));
144-
$this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_ALL));
145-
$this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_A | DNS_PTR));
146-
$this->assertSame([$ptr], DnsMock::dns_get_record('example.com', DNS_PTR));
144+
$this->assertSame($records, DnsMock::dns_get_record('example.com', \DNS_ALL));
145+
$this->assertSame($records, DnsMock::dns_get_record('example.com', \DNS_A | \DNS_PTR));
146+
$this->assertSame([$ptr], DnsMock::dns_get_record('example.com', \DNS_PTR));
147147
}
148148
}

src/Symfony/Bridge/PhpUnit/Tests/ExpectedDeprecationAnnotationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class ExpectedDeprecationAnnotationTest extends TestCase
2424
*/
2525
public function testOne()
2626
{
27-
@trigger_error('foo', E_USER_DEPRECATED);
27+
@trigger_error('foo', \E_USER_DEPRECATED);
2828
}
2929

3030
/**
@@ -37,7 +37,7 @@ public function testOne()
3737
*/
3838
public function testMany()
3939
{
40-
@trigger_error('foo', E_USER_DEPRECATED);
41-
@trigger_error('bar', E_USER_DEPRECATED);
40+
@trigger_error('foo', \E_USER_DEPRECATED);
41+
@trigger_error('bar', \E_USER_DEPRECATED);
4242
}
4343
}

0 commit comments

Comments
 (0)