Skip to content

Commit 52cb63c

Browse files
committed
minor #1776 Support dot notation for resources in symfony flex (tomaszhanc)
This PR was merged into the 2.2-dev branch. Discussion ---------- Support dot notation for resources in symfony flex Symfony Flex introduced a new notation for routes resources: ``` controllers: resource: "../src/Controller" ``` The current implementation of `DirecotryRouteLoader` supports only @ notation to locate a resource by file locator. That PR fix it for Symfony Flex notation. Commits ------- ba79b41 Support dot notation for resources in symfony flex
2 parents d88d596 + ba79b41 commit 52cb63c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Routing/Loader/DirectoryRouteLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(FileLocatorInterface $fileLocator, RestRouteProcesso
3737
*/
3838
public function load($resource, $type = null)
3939
{
40-
if (isset($resource[0]) && '@' === $resource[0]) {
40+
if (isset($resource[0]) && in_array($resource[0], ['@', '.'], true)) {
4141
$resource = $this->fileLocator->locate($resource);
4242
}
4343

@@ -68,7 +68,7 @@ public function supports($resource, $type = null)
6868
return false;
6969
}
7070

71-
if (isset($resource[0]) && '@' === $resource[0]) {
71+
if (isset($resource[0]) && in_array($resource[0], ['@', '.'], true)) {
7272
$resource = $this->fileLocator->locate($resource);
7373
}
7474

0 commit comments

Comments
 (0)