diff --git a/.travis.yml b/.travis.yml index f76d7dff..07d62c62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ matrix: - php: 7.1 - php: 7.2 - php: 7.3 + - php: 7.4snapshot - php: 7.1 env: SYMFONY_VERSION='3.4.*' - php: 7.1 diff --git a/Command/DumpCommand.php b/Command/DumpCommand.php index d6d9c514..e9cd2774 100644 --- a/Command/DumpCommand.php +++ b/Command/DumpCommand.php @@ -28,11 +28,6 @@ class DumpCommand extends Command { protected static $defaultName = 'fos:js-routing:dump'; - /** - * @var string - */ - private $targetPath; - /** * @var ExposedRoutesExtractorInterface */ @@ -46,18 +41,18 @@ class DumpCommand extends Command /** * @var string */ - private $rootDir; + private $projectDir; /** * @var string */ private $requestContextBaseUrl; - public function __construct(ExposedRoutesExtractorInterface $extractor, SerializerInterface $serializer, $rootDir, $requestContextBaseUrl = null) + public function __construct(ExposedRoutesExtractorInterface $extractor, SerializerInterface $serializer, $projectDir, $requestContextBaseUrl = null) { $this->extractor = $extractor; $this->serializer = $serializer; - $this->rootDir = $rootDir; + $this->projectDir = $projectDir; $this->requestContextBaseUrl = $requestContextBaseUrl; parent::__construct(); @@ -145,8 +140,8 @@ private function doDump(InputInterface $input, OutputInterface $output) $serializer = $this->serializer; $targetPath = $input->getOption('target') ?: sprintf( - '%s/../web/js/fos_js_routes%s.%s', - $this->rootDir, + '%s/web/js/fos_js_routes%s.%s', + $this->projectDir, empty($domain) ? '' : ('_' . implode('_', $domain)), $input->getOption('format') ); diff --git a/Extractor/ExposedRoutesExtractor.php b/Extractor/ExposedRoutesExtractor.php index 8b423dbd..a8bdfc36 100644 --- a/Extractor/ExposedRoutesExtractor.php +++ b/Extractor/ExposedRoutesExtractor.php @@ -253,10 +253,10 @@ protected function buildPattern($domainPatterns) foreach ($domainPatterns as $domain => $items) { - $patterns[] = '(?P<' . $domain . '>' . implode($items, '|') . ')'; + $patterns[] = '(?P<' . $domain . '>' . implode('|', $items) . ')'; } - return implode($patterns, '|'); + return implode('|', $patterns); } /** diff --git a/Resources/config/services.xml b/Resources/config/services.xml index ea3ae385..efdd6715 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -18,7 +18,7 @@ - %kernel.root_dir% + %kernel.project_dir% %fos_js_routing.request_context_base_url% diff --git a/Tests/Command/DumpCommandTest.php b/Tests/Command/DumpCommandTest.php index 50230c3d..6d8da188 100644 --- a/Tests/Command/DumpCommandTest.php +++ b/Tests/Command/DumpCommandTest.php @@ -98,7 +98,7 @@ public function testExecuteFormatOption() public function testExecuteUnableToCreateDirectory() { $this->expectException(\RuntimeException::class); - $this->expectExceptionMessage('Unable to create directory /root/dir/../web/js'); + $this->expectExceptionMessage('Unable to create directory /root/dir/web/js'); $command = new DumpCommand($this->extractor, $this->serializer, '/root/dir'); $tester = new CommandTester($command); diff --git a/composer.json b/composer.json index 2dc049b9..bcf0ee89 100644 --- a/composer.json +++ b/composer.json @@ -17,13 +17,13 @@ ], "require": { "php": "^7.1", - "symfony/framework-bundle": "~3.0|^4.0|^5.0", - "symfony/serializer": "~3.0|^4.0|^5.0", - "symfony/console": "~3.0|^4.0|^5.0", + "symfony/framework-bundle": "~3.3|^4.0|^5.0", + "symfony/serializer": "~3.3|^4.0|^5.0", + "symfony/console": "~3.3|^4.0|^5.0", "willdurand/jsonp-callback-validator": "~1.0" }, "require-dev": { - "symfony/expression-language": "~3.0|^4.0|^5.0", + "symfony/expression-language": "~3.3|^4.0|^5.0", "symfony/phpunit-bridge": "^3.3|^4.0" }, "autoload": {