Skip to content

Commit 52503b7

Browse files
authored
Merge pull request #369 from FriendsOfSymfony/fix-root-dir-deprecation
Fix root dir deprecation and fix PHP 7.4 deprecation
2 parents 4c6eb91 + cb5c7ac commit 52503b7

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ matrix:
55
- php: 7.1
66
- php: 7.2
77
- php: 7.3
8+
- php: 7.4snapshot
89
- php: 7.1
910
env: SYMFONY_VERSION='3.4.*'
1011
- php: 7.1

Command/DumpCommand.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ class DumpCommand extends Command
2828
{
2929
protected static $defaultName = 'fos:js-routing:dump';
3030

31-
/**
32-
* @var string
33-
*/
34-
private $targetPath;
35-
3631
/**
3732
* @var ExposedRoutesExtractorInterface
3833
*/
@@ -46,18 +41,18 @@ class DumpCommand extends Command
4641
/**
4742
* @var string
4843
*/
49-
private $rootDir;
44+
private $projectDir;
5045

5146
/**
5247
* @var string
5348
*/
5449
private $requestContextBaseUrl;
5550

56-
public function __construct(ExposedRoutesExtractorInterface $extractor, SerializerInterface $serializer, $rootDir, $requestContextBaseUrl = null)
51+
public function __construct(ExposedRoutesExtractorInterface $extractor, SerializerInterface $serializer, $projectDir, $requestContextBaseUrl = null)
5752
{
5853
$this->extractor = $extractor;
5954
$this->serializer = $serializer;
60-
$this->rootDir = $rootDir;
55+
$this->projectDir = $projectDir;
6156
$this->requestContextBaseUrl = $requestContextBaseUrl;
6257

6358
parent::__construct();
@@ -145,8 +140,8 @@ private function doDump(InputInterface $input, OutputInterface $output)
145140
$serializer = $this->serializer;
146141
$targetPath = $input->getOption('target') ?:
147142
sprintf(
148-
'%s/../web/js/fos_js_routes%s.%s',
149-
$this->rootDir,
143+
'%s/web/js/fos_js_routes%s.%s',
144+
$this->projectDir,
150145
empty($domain) ? '' : ('_' . implode('_', $domain)),
151146
$input->getOption('format')
152147
);

Extractor/ExposedRoutesExtractor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ protected function buildPattern($domainPatterns)
253253

254254
foreach ($domainPatterns as $domain => $items) {
255255

256-
$patterns[] = '(?P<' . $domain . '>' . implode($items, '|') . ')';
256+
$patterns[] = '(?P<' . $domain . '>' . implode('|', $items) . ')';
257257
}
258258

259-
return implode($patterns, '|');
259+
return implode('|', $patterns);
260260
}
261261

262262
/**

Resources/config/services.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<service id="fos_js_routing.dump_command" class="FOS\JsRoutingBundle\Command\DumpCommand">
1919
<argument type="service" id="fos_js_routing.extractor" />
2020
<argument type="service" id="fos_js_routing.serializer" />
21-
<argument>%kernel.root_dir%</argument>
21+
<argument>%kernel.project_dir%</argument>
2222
<argument>%fos_js_routing.request_context_base_url%</argument>
2323
<tag name="console.command" />
2424
</service>

Tests/Command/DumpCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testExecuteFormatOption()
9898
public function testExecuteUnableToCreateDirectory()
9999
{
100100
$this->expectException(\RuntimeException::class);
101-
$this->expectExceptionMessage('Unable to create directory /root/dir/../web/js');
101+
$this->expectExceptionMessage('Unable to create directory /root/dir/web/js');
102102
$command = new DumpCommand($this->extractor, $this->serializer, '/root/dir');
103103

104104
$tester = new CommandTester($command);

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
],
1818
"require": {
1919
"php": "^7.1",
20-
"symfony/framework-bundle": "~3.0|^4.0|^5.0",
21-
"symfony/serializer": "~3.0|^4.0|^5.0",
22-
"symfony/console": "~3.0|^4.0|^5.0",
20+
"symfony/framework-bundle": "~3.3|^4.0|^5.0",
21+
"symfony/serializer": "~3.3|^4.0|^5.0",
22+
"symfony/console": "~3.3|^4.0|^5.0",
2323
"willdurand/jsonp-callback-validator": "~1.0"
2424
},
2525
"require-dev": {
26-
"symfony/expression-language": "~3.0|^4.0|^5.0",
26+
"symfony/expression-language": "~3.3|^4.0|^5.0",
2727
"symfony/phpunit-bridge": "^3.3|^4.0"
2828
},
2929
"autoload": {

0 commit comments

Comments
 (0)