Skip to content

Commit be8adfa

Browse files
Merge branch '5.0'
* 5.0: updated VERSION for 3.4.40 update CONTRIBUTORS for 3.4.40 updated CHANGELOG for 3.4.40 [WebProfilerBundle] changed label of peak memory usage in the time & memory panels (MB into MiB) add tests for the ConstraintViolationBuilder class Improve dirname usage [PhpUnitBridge] Use COMPOSER_BINARY env var if available Allow invalidateTags calls to be traced by data collector [YAML] escape DEL(\x7f) fix compatibility with phpunit 9 [Cache] skip APCu in chains when the backend is disabled [Mailer] Add a comment to avoid more wrong PRs on this piece of code [Form] apply automatically step=1 for datetime-local input remove getContainer overwrites in tests Fixing a bug where class_alias would cause incorrect items in debug:autowiring [DependencyInjection][ServiceSubscriber] Support late aliases Fix profiler nullable string type
2 parents 4170346 + 77cdbff commit be8adfa

File tree

29 files changed

+348
-91
lines changed

29 files changed

+348
-91
lines changed

CONTRIBUTORS.md

Lines changed: 47 additions & 30 deletions
Large diffs are not rendered by default.

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ class SymfonyTestsListenerTrait
5050
*/
5151
public function __construct(array $mockedNamespaces = [])
5252
{
53-
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 2;
53+
if (method_exists(Blacklist::class, 'addDirectory')) {
54+
(new BlackList())->getBlacklistedDirectories();
55+
Blacklist::addDirectory(\dirname((new \ReflectionClass(__CLASS__))->getFileName(), 2));
56+
} else {
57+
Blacklist::$blacklistedClassNames[__CLASS__] = 2;
58+
}
5459

5560
$enableDebugClassLoader = class_exists(DebugClassLoader::class) || class_exists(LegacyDebugClassLoader::class);
5661

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@
215215
if (!class_exists('SymfonyBlacklistPhpunit', false)) {
216216
class SymfonyBlacklistPhpunit {}
217217
}
218-
if (class_exists('PHPUnit_Util_Blacklist')) {
219-
PHPUnit_Util_Blacklist::$blacklistedClassNames['SymfonyBlacklistPhpunit'] = 1;
220-
PHPUnit_Util_Blacklist::$blacklistedClassNames['SymfonyBlacklistSimplePhpunit'] = 1;
218+
if (method_exists('PHPUnit\Util\Blacklist', 'addDirectory')) {
219+
(new PHPUnit\Util\BlackList())->getBlacklistedDirectories();
220+
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyBlacklistPhpunit'))->getFileName()));
221+
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyBlacklistSimplePhpunit'))->getFileName()));
221222
} else {
222223
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistPhpunit'] = 1;
223224
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyBlacklistSimplePhpunit'] = 1;

src/Symfony/Bridge/PhpUnit/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
2525
},
2626
"conflict": {
27-
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0"
27+
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0|9.1.2"
2828
},
2929
"autoload": {
3030
"files": [ "bootstrap.php" ],

src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
103103
$serviceIdsNb = 0;
104104
foreach ($serviceIds as $serviceId) {
105105
$text = [];
106+
$resolvedServiceId = $serviceId;
106107
if (0 !== strpos($serviceId, $previousId)) {
107108
$text[] = '';
108-
if ('' !== $description = Descriptor::getClassDescription($serviceId, $serviceId)) {
109+
if ('' !== $description = Descriptor::getClassDescription($serviceId, $resolvedServiceId)) {
109110
if (isset($hasAlias[$serviceId])) {
110111
continue;
111112
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
4+
5+
class_alias(
6+
ClassAliasTargetClass::class,
7+
__NAMESPACE__ . '\ClassAliasExampleClass'
8+
);
9+
10+
if (false) {
11+
class ClassAliasExampleClass
12+
{
13+
}
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
4+
5+
class ClassAliasTargetClass
6+
{
7+
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,16 @@ public function testSearchNotAliasedServiceWithAll()
9797
$tester->run(['command' => 'debug:autowiring', 'search' => 'redirect', '--all' => true]);
9898
$this->assertStringContainsString('Pro-tip: use interfaces in your type-hints instead of classes to benefit from the dependency inversion principle.', $tester->getDisplay());
9999
}
100+
101+
public function testNotConfusedByClassAliases()
102+
{
103+
static::bootKernel(['test_case' => 'ContainerDebug', 'root_config' => 'config.yml']);
104+
105+
$application = new Application(static::$kernel);
106+
$application->setAutoExit(false);
107+
108+
$tester = new ApplicationTester($application);
109+
$tester->run(['command' => 'debug:autowiring', 'search' => 'ClassAlias']);
110+
$this->assertStringContainsString('Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasExampleClass (public)', $tester->getDisplay());
111+
}
100112
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Config\Definition\ConfigurationInterface;
1717
use Symfony\Component\Config\Loader\LoaderInterface;
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
19-
use Symfony\Component\DependencyInjection\ContainerInterface;
2019
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
2120
use Symfony\Component\Filesystem\Filesystem;
2221
use Symfony\Component\HttpKernel\Kernel;
@@ -101,15 +100,6 @@ protected function getKernelParameters(): array
101100
return $parameters;
102101
}
103102

104-
public function getContainer(): ContainerInterface
105-
{
106-
if (!$this->container) {
107-
throw new \LogicException('Cannot access the container on a non-booted kernel. Did you forget to boot it?');
108-
}
109-
110-
return parent::getContainer();
111-
}
112-
113103
public function getConfigTreeBuilder()
114104
{
115105
$treeBuilder = new TreeBuilder('foo');

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/ContainerDebug/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ services:
1313
public: false
1414
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BackslashClass:
1515
class: Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BackslashClass
16+
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasExampleClass: '@public'
1617
env:
1718
class: stdClass
1819
arguments:

0 commit comments

Comments
 (0)