Skip to content

Commit f84d036

Browse files
Merge branch '5.2' into 5.x
* 5.2: (23 commits) [Console] Fix Windows code page support [SecurityBundle] Allow ips parameter in access_control accept comma-separated string [Form] Add TranslatableMessage support to choice_label option of ChoiceType Remove code that deals with legacy behavior of PHP_Incomplete_Class [Config][DependencyInjection] Uniformize trailing slash handling [PropertyInfo] Make ReflectionExtractor correctly extract nullability [PropertyInfo] fix attribute namespace with recursive traits [PhpUnitBridge] Fix tests with `@doesNotPerformAssertions` annotations Check redis extension version [Security] Update Russian translations [Notifier] Fix return SentMessage then Messenger not used [VarExporter] Add support of PHP enumerations [Security] Added missing Japanese translations [Security] Added missing Polish translations [Security] Add missing Italian translations #41051 [Security] Missing translations pt_BR getProtocolVersion may return null Fix return type on isAllowedProperty method Make FailoverTransport always pick the first transport [TwigBridge] Fix HTML for translatable custom-file label in Bootstrap 4 theme ...
2 parents f47b3fb + 3439216 commit f84d036

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

Loader/FileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ private function findClasses(string $namespace, string $pattern, array $excludeP
180180
$excludePrefix = $resource->getPrefix();
181181
}
182182

183-
// normalize Windows slashes
184-
$excludePaths[str_replace('\\', '/', $path)] = true;
183+
// normalize Windows slashes and remove trailing slashes
184+
$excludePaths[rtrim(str_replace('\\', '/', $path), '/')] = true;
185185
}
186186
}
187187

Tests/Loader/FileLoaderTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,35 @@ public function testRegisterClassesWithIncompatibleExclude()
244244
);
245245
}
246246

247+
/**
248+
* @dataProvider excludeTrailingSlashConsistencyProvider
249+
*/
250+
public function testExcludeTrailingSlashConsistency(string $exclude)
251+
{
252+
$container = new ContainerBuilder();
253+
$loader = new TestFileLoader($container, new FileLocator(self::$fixturesPath.'/Fixtures'));
254+
$loader->registerClasses(
255+
new Definition(),
256+
'Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\\',
257+
'Prototype/*',
258+
$exclude
259+
);
260+
261+
$this->assertTrue($container->has(Foo::class));
262+
$this->assertFalse($container->has(DeeperBaz::class));
263+
}
264+
265+
public function excludeTrailingSlashConsistencyProvider(): iterable
266+
{
267+
yield ['Prototype/OtherDir/AnotherSub/'];
268+
yield ['Prototype/OtherDir/AnotherSub'];
269+
yield ['Prototype/OtherDir/AnotherSub/*'];
270+
yield ['Prototype/*/AnotherSub'];
271+
yield ['Prototype/*/AnotherSub/'];
272+
yield ['Prototype/*/AnotherSub/*'];
273+
yield ['Prototype/OtherDir/AnotherSub/DeeperBaz.php'];
274+
}
275+
247276
/**
248277
* @requires PHP 8
249278
*

0 commit comments

Comments
 (0)