Skip to content

Commit c815d17

Browse files
ajgarlagchalasr
authored andcommitted
New directory structure
1 parent cee1e71 commit c815d17

File tree

14 files changed

+36
-15
lines changed

14 files changed

+36
-15
lines changed

Resources/config/routes.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
trigger_deprecation('league/oauth2-server-bundle', '0.11', 'Loading resource "@LeagueOAuth2ServerBundle/Resources/config/routes.php" is deprecated. Load "@LeagueOAuth2ServerBundle/config/routes.php" instead.');
6+
7+
return require __DIR__ . '/../../config/routes.php';

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"league/oauth2-server": "^9.2",
2424
"nyholm/psr7": "^1.4",
2525
"psr/http-factory": "^1.0",
26+
"symfony/deprecation-contracts": "^3",
2627
"symfony/event-dispatcher": "^6.4|^7.0",
2728
"symfony/filesystem": "^6.4|^7.0",
2829
"symfony/framework-bundle": "^6.4|^7.0",

config/routes.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
6+
7+
return function (RoutingConfigurator $routes) {
8+
$routes
9+
->add('oauth2_authorize', '/authorize')
10+
->controller(['league.oauth2_server.controller.authorization', 'indexAction'])
11+
12+
->add('oauth2_token', '/token')
13+
->controller(['league.oauth2_server.controller.token', 'indexAction'])
14+
->methods(['POST'])
15+
;
16+
};
File renamed without changes.

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ security:
136136

137137
```yaml
138138
oauth2:
139-
resource: '@LeagueOAuth2ServerBundle/Resources/config/routes.php'
139+
resource: '@LeagueOAuth2ServerBundle/config/routes.php'
140140
type: php
141141
```
142142

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
<directory>.</directory>
3636
</include>
3737
<exclude>
38-
<directory>./resources</directory>
3938
<directory>./tests</directory>
4039
<directory>./vendor</directory>
4140
</exclude>

src/DependencyInjection/LeagueOAuth2ServerExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ final class LeagueOAuth2ServerExtension extends Extension implements PrependExte
5555
*/
5656
public function load(array $configs, ContainerBuilder $container)
5757
{
58-
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
58+
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
5959
$loader->load('services.php');
6060

6161
$config = $this->processConfiguration(new Configuration(), $configs);

src/LeagueOAuth2ServerBundle.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,11 @@ private function configureDoctrineExtension(ContainerBuilder $container): void
5454

5555
$container->addCompilerPass(new EncryptionKeyPass());
5656
}
57+
58+
public function getPath(): string
59+
{
60+
$reflected = new \ReflectionObject($this);
61+
62+
return \dirname($reflected->getFileName() ?: __FILE__, 2);
63+
}
5764
}

src/Resources/config/routes.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
5+
trigger_deprecation('league/oauth2-server-bundle', '0.11', 'Loading file "%s" is deprecated. Load "%s" instead.', __FILE__, realpath(__DIR__ . '/../../../config/routes.php'));
66

7-
return function (RoutingConfigurator $routes) {
8-
$routes
9-
->add('oauth2_authorize', '/authorize')
10-
->controller(['league.oauth2_server.controller.authorization', 'indexAction'])
11-
12-
->add('oauth2_token', '/token')
13-
->controller(['league.oauth2_server.controller.token', 'indexAction'])
14-
->methods(['POST'])
15-
;
16-
};
7+
return require __DIR__ . '/../../../config/routes.php';

tests/Fixtures/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
77

88
return function (RoutingConfigurator $routes) {
9-
$routes->import('@LeagueOAuth2ServerBundle/Resources/config/routes.php');
9+
$routes->import('@LeagueOAuth2ServerBundle/config/routes.php');
1010

1111
$routes
1212
->add('security_test', '/security-test')

0 commit comments

Comments
 (0)