From 179b643f768afc1d12495a3569c062358d061c6d Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Thu, 8 Mar 2018 12:37:04 +0100 Subject: [PATCH] [TASK] Rename the configuration directory to config/ This brings the project more in line with the default Symfony project structure. --- .github/CONTRIBUTING.md | 8 ++++---- .gitignore | 8 ++++---- .travis.yml | 4 ++-- CHANGELOG.md | 2 +- README.md | 2 +- {Configuration => config}/PHPMD/rules.xml | 0 .../PhpCodeSniffer/ruleset.xml | 0 {Configuration => config}/config.yml | 2 +- {Configuration => config}/config_dev.yml | 2 +- {Configuration => config}/config_prod.yml | 0 {Configuration => config}/config_test.yml | 0 {Configuration => config}/parameters.yml.dist | 0 {Configuration => config}/repositories.yml | 0 {Configuration => config}/routing.yml | 0 {Configuration => config}/routing_dev.yml | 0 {Configuration => config}/services.yml | 0 src/Composer/ModuleFinder.php | 6 +++--- src/Composer/ScriptHandler.php | 18 +++++++++--------- src/Core/ApplicationKernel.php | 8 ++++---- src/Routing/ExtraLoader.php | 2 +- tests/Integration/Composer/ScriptsTest.php | 8 ++++---- 21 files changed, 35 insertions(+), 35 deletions(-) rename {Configuration => config}/PHPMD/rules.xml (100%) rename {Configuration => config}/PhpCodeSniffer/ruleset.xml (100%) rename {Configuration => config}/config.yml (96%) rename {Configuration => config}/config_dev.yml (93%) rename {Configuration => config}/config_prod.yml (100%) rename {Configuration => config}/config_test.yml (100%) rename {Configuration => config}/parameters.yml.dist (100%) rename {Configuration => config}/repositories.yml (100%) rename {Configuration => config}/routing.yml (100%) rename {Configuration => config}/routing_dev.yml (100%) rename {Configuration => config}/services.yml (100%) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 0895005b..1c897736 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -97,7 +97,7 @@ mysql -u phplist_test --password=batterystaple phplist_test < resources/Database ``` For running the integration tests, please first enter the database name -and access credentials in `Configuration/parameters.yml`. +and access credentials in `config/parameters.yml`. After that has been done, you can run the integration tests: @@ -118,13 +118,13 @@ We will only merge pull requests that follow the project's coding style. Please check your code with the provided PHP_CodeSniffer standard: ```bash -vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ bin/ src/ tests/ public/ +vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/ ``` Please also check the code structure using PHPMD: ```bash -vendor/bin/phpmd src/ text Configuration/PHPMD/rules.xml +vendor/bin/phpmd src/ text config/PHPMD/rules.xml ``` And also please run the static code analysis: @@ -136,7 +136,7 @@ vendor/bin/phpstan analyse -l 5 bin/ src/ tests/ public/ You can also run all code style checks using one long line from a bash shell: ```bash -find src/ tests/ public/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l && php -l bin/* && vendor/bin/phpstan analyse -l 5 bin/ src/ tests/ public/ && vendor/bin/phpmd src/ text Configuration/PHPMD/rules.xml && vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ bin/ src/ tests/ public/ +find src/ tests/ public/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l && php -l bin/* && vendor/bin/phpstan analyse -l 5 bin/ src/ tests/ public/ && vendor/bin/phpmd src/ text config/PHPMD/rules.xml && vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/ ``` This will execute all tests except for the unit tests and the integration diff --git a/.gitignore b/.gitignore index aefd513f..52927d04 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,10 @@ /.web-server-pid /.webprj /composer.lock -/Configuration/bundles.yml -/Configuration/config_modules.yml -/Configuration/parameters.yml -/Configuration/routing_modules.yml +/config/bundles.yml +/config/config_modules.yml +/config/parameters.yml +/config/routing_modules.yml /nbproject /var/ /vendor/ diff --git a/.travis.yml b/.travis.yml index 48b2f316..fe74d8d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,9 +84,9 @@ script: - > echo; echo "Running PHPMD"; - vendor/bin/phpmd src/ text Configuration/PHPMD/rules.xml; + vendor/bin/phpmd src/ text config/PHPMD/rules.xml; - > echo; echo "Running PHP_CodeSniffer"; - vendor/bin/phpcs --standard=Configuration/PhpCodeSniffer/ bin/ src/ tests/ public/; + vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/; diff --git a/CHANGELOG.md b/CHANGELOG.md index c7ce8e47..f47a355d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Move the PHPUnit configuration file (#283) - Rename the Composer package to "phplist/core" (#275) - Remove the obsolete core classes (#267) -- Adopt more of the default Symfony project structure (#265, #268, #269, #270, #285) +- Adopt more of the default Symfony project structure (#265, #268, #269, #270, #285, #291) ### Deprecated diff --git a/README.md b/README.md index 10310bc2..8cf6207a 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ this code. The phpList application is configured so that the built-in PHP web server can run in development and testing mode, while Apache can run in production mode. -Please first set the database credentials in `Configuration/parameters.yml`. +Please first set the database credentials in `config/parameters.yml`. ### Development diff --git a/Configuration/PHPMD/rules.xml b/config/PHPMD/rules.xml similarity index 100% rename from Configuration/PHPMD/rules.xml rename to config/PHPMD/rules.xml diff --git a/Configuration/PhpCodeSniffer/ruleset.xml b/config/PhpCodeSniffer/ruleset.xml similarity index 100% rename from Configuration/PhpCodeSniffer/ruleset.xml rename to config/PhpCodeSniffer/ruleset.xml diff --git a/Configuration/config.yml b/config/config.yml similarity index 96% rename from Configuration/config.yml rename to config/config.yml index 9f6825be..0e8deaa5 100644 --- a/Configuration/config.yml +++ b/config/config.yml @@ -12,7 +12,7 @@ framework: #translator: { fallbacks: ['%locale%'] } secret: '%secret%' router: - resource: '%kernel.project_dir%/Configuration/routing.yml' + resource: '%kernel.project_dir%/config/routing.yml' strict_requirements: ~ form: ~ csrf_protection: ~ diff --git a/Configuration/config_dev.yml b/config/config_dev.yml similarity index 93% rename from Configuration/config_dev.yml rename to config/config_dev.yml index f6c44c14..0e0dd414 100644 --- a/Configuration/config_dev.yml +++ b/config/config_dev.yml @@ -3,7 +3,7 @@ imports: framework: router: - resource: '%kernel.project_dir%/Configuration/routing_dev.yml' + resource: '%kernel.project_dir%/config/routing_dev.yml' strict_requirements: true profiler: { only_exceptions: false } diff --git a/Configuration/config_prod.yml b/config/config_prod.yml similarity index 100% rename from Configuration/config_prod.yml rename to config/config_prod.yml diff --git a/Configuration/config_test.yml b/config/config_test.yml similarity index 100% rename from Configuration/config_test.yml rename to config/config_test.yml diff --git a/Configuration/parameters.yml.dist b/config/parameters.yml.dist similarity index 100% rename from Configuration/parameters.yml.dist rename to config/parameters.yml.dist diff --git a/Configuration/repositories.yml b/config/repositories.yml similarity index 100% rename from Configuration/repositories.yml rename to config/repositories.yml diff --git a/Configuration/routing.yml b/config/routing.yml similarity index 100% rename from Configuration/routing.yml rename to config/routing.yml diff --git a/Configuration/routing_dev.yml b/config/routing_dev.yml similarity index 100% rename from Configuration/routing_dev.yml rename to config/routing_dev.yml diff --git a/Configuration/services.yml b/config/services.yml similarity index 100% rename from Configuration/services.yml rename to config/services.yml diff --git a/src/Composer/ModuleFinder.php b/src/Composer/ModuleFinder.php index 40bd875e..d5344177 100644 --- a/src/Composer/ModuleFinder.php +++ b/src/Composer/ModuleFinder.php @@ -119,7 +119,7 @@ private function validatePhpListSectionInExtra(array $extra) /** * Builds the YAML configuration file contents for the registered bundles in all modules. * - * The returned string is intended to be written to Configuration/bundles.yml. + * The returned string is intended to be written to config/bundles.yml. * * @return string */ @@ -202,7 +202,7 @@ private function validateRoutesSectionInExtra(array $extra) /** * Builds the YAML configuration file contents for the registered routes in all modules. * - * The returned string is intended to be written to Configuration/routing_modules.yml. + * The returned string is intended to be written to config/routing_modules.yml. * * @return string */ @@ -267,7 +267,7 @@ private function validateGeneralConfigurationSectionInExtra(array $extra) /** * Builds the YAML configuration file contents all modules. * - * The returned string is intended to be written to Configuration/config_modules.yml. + * The returned string is intended to be written to config/config_modules.yml. * * @return string */ diff --git a/src/Composer/ScriptHandler.php b/src/Composer/ScriptHandler.php index 63da4163..ac8d2587 100644 --- a/src/Composer/ScriptHandler.php +++ b/src/Composer/ScriptHandler.php @@ -24,27 +24,27 @@ class ScriptHandler extends SensioScriptHandler /** * @var string */ - const BUNDLE_CONFIGURATION_FILE = '/Configuration/bundles.yml'; + const BUNDLE_CONFIGURATION_FILE = '/config/bundles.yml'; /** * @var string */ - const ROUTES_CONFIGURATION_FILE = '/Configuration/routing_modules.yml'; + const ROUTES_CONFIGURATION_FILE = '/config/routing_modules.yml'; /** * @var string */ - const PARAMETERS_CONFIGURATION_FILE = '/Configuration/parameters.yml'; + const PARAMETERS_CONFIGURATION_FILE = '/config/parameters.yml'; /** * @var string */ - const GENERAL_CONFIGURATION_FILE = '/Configuration/config_modules.yml'; + const GENERAL_CONFIGURATION_FILE = '/config/config_modules.yml'; /** * @var string */ - const PARAMETERS_TEMPLATE_FILE = '/Configuration/parameters.yml.dist'; + const PARAMETERS_TEMPLATE_FILE = '/config/parameters.yml.dist'; /** * @return string absolute application root directory without the trailing slash @@ -179,7 +179,7 @@ private static function calculateMaximumPackageNameLength(array $modules): int } /** - * Creates Configuration/bundles.yml + * Creates config/bundles.yml * (the configuration file for the Symfony bundles provided by the modules). * * @param Event $event @@ -220,7 +220,7 @@ private static function createAndWriteFile(string $path, string $contents) } /** - * Creates Configuration/routing_modules.yml + * Creates config/routing_modules.yml * (the routes file for the Symfony bundles provided by the modules). * * @param Event $event @@ -280,7 +280,7 @@ public static function warmProductionCache(Event $event) } /** - * Creates Configuration/parameters.yml (the parameters configuration file). + * Creates config/parameters.yml (the parameters configuration file). * * @return void */ @@ -301,7 +301,7 @@ public static function createParametersConfiguration() } /** - * Creates Configuration/config_modules.yml (the general configuration provided by the modules). + * Creates config/config_modules.yml (the general configuration provided by the modules). * * @param Event $event * diff --git a/src/Core/ApplicationKernel.php b/src/Core/ApplicationKernel.php index bd8c7bcd..70995c3f 100644 --- a/src/Core/ApplicationKernel.php +++ b/src/Core/ApplicationKernel.php @@ -121,9 +121,9 @@ protected function build(ContainerBuilder $container) */ public function registerContainerConfiguration(LoaderInterface $loader) { - $loader->load($this->getApplicationDir() . '/Configuration/parameters.yml'); - $loader->load($this->getRootDir() . '/Configuration/config_' . $this->getEnvironment() . '.yml'); - $loader->load($this->getApplicationDir() . '/Configuration/config_modules.yml'); + $loader->load($this->getApplicationDir() . '/config/parameters.yml'); + $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); + $loader->load($this->getApplicationDir() . '/config/config_modules.yml'); } /** @@ -166,7 +166,7 @@ private function bundlesFromConfiguration(): array */ private function readBundleConfiguration(): array { - $configurationFilePath = $this->getApplicationDir() . '/Configuration/bundles.yml'; + $configurationFilePath = $this->getApplicationDir() . '/config/bundles.yml'; if (!is_readable($configurationFilePath)) { throw new \RuntimeException('The file "' . $configurationFilePath . '" could not be read.', 1504272377); } diff --git a/src/Routing/ExtraLoader.php b/src/Routing/ExtraLoader.php index 55ec64a1..f12586b1 100644 --- a/src/Routing/ExtraLoader.php +++ b/src/Routing/ExtraLoader.php @@ -17,7 +17,7 @@ class ExtraLoader extends Loader /** * @var string */ - const MODULE_ROUTING_CONFIGURATION_FILE = '/Configuration/routing_modules.yml'; + const MODULE_ROUTING_CONFIGURATION_FILE = '/config/routing_modules.yml'; /** * @var bool diff --git a/tests/Integration/Composer/ScriptsTest.php b/tests/Integration/Composer/ScriptsTest.php index 27e66136..c7bd84c9 100644 --- a/tests/Integration/Composer/ScriptsTest.php +++ b/tests/Integration/Composer/ScriptsTest.php @@ -17,7 +17,7 @@ class ScriptsTest extends TestCase */ private function getBundleConfigurationFilePath(): string { - return dirname(__DIR__, 3) . '/Configuration/bundles.yml'; + return dirname(__DIR__, 3) . '/config/bundles.yml'; } /** @@ -58,7 +58,7 @@ public function bundleConfigurationFileContainsModuleBundles(string $bundleClass */ private function getModuleRoutesConfigurationFilePath(): string { - return dirname(__DIR__, 3) . '/Configuration/routing_modules.yml'; + return dirname(__DIR__, 3) . '/config/routing_modules.yml'; } /** @@ -98,7 +98,7 @@ public function moduleRoutesConfigurationFileContainsModuleRoutes(string $routeS */ public function parametersConfigurationFileExists() { - static::assertFileExists(dirname(__DIR__, 3) . '/Configuration/parameters.yml'); + static::assertFileExists(dirname(__DIR__, 3) . '/config/parameters.yml'); } /** @@ -106,6 +106,6 @@ public function parametersConfigurationFileExists() */ public function modulesConfigurationFileExists() { - static::assertFileExists(dirname(__DIR__, 3) . '/Configuration/config_modules.yml'); + static::assertFileExists(dirname(__DIR__, 3) . '/config/config_modules.yml'); } }