Skip to content

Commit

Permalink
bug symfony#228 Fix bundle auto-detection when a namespace does not e…
Browse files Browse the repository at this point in the history
…nd with Bundle (fabpot)

This PR was merged into the 1.0-dev branch.

Discussion
----------

Fix bundle auto-detection when a namespace does not end with Bundle

Commits
-------

ada48bb fixed bundle auto-detection when a namespace does not end with Bundle
  • Loading branch information
fabpot committed Dec 4, 2017
2 parents 061fb1d + ada48bb commit 8917eb9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/SymfonyBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ private function extractClassNames(string $namespace): array
$class = $namespace.'\\';
$parts = explode('\\', $namespace);
$suffix = $parts[count($parts) - 1];
if ('Bundle' !== substr($suffix, -6)) {
$suffix .= 'Bundle';
}
$classes = [$class.$suffix];
$acc = '';
foreach (array_slice($parts, 0, -1) as $part) {
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions tests/SymfonyBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public function getNamespaces()
['psr-4' => ['EasyCorp\\Bundle\\EasyDeployBundle\\' => ['src', 'tests']]],
'EasyCorp\\Bundle\\EasyDeployBundle\\EasyDeployBundle',
],
[
'web-token/jwt-bundle',
['psr-4' => ['Jose\\Bundle\\JoseFramework\\' => ['']]],
'Jose\\Bundle\\JoseFramework\\JoseFrameworkBundle',
],
];
}
}

0 comments on commit 8917eb9

Please sign in to comment.