diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 8f4dd5a..0000000 --- a/.php_cs +++ /dev/null @@ -1,45 +0,0 @@ -in('src') - ->in('test') - ->notPath('TestAsset') - ->notPath('_files') - ->filter(function (SplFileInfo $file) { - if (strstr($file->getPath(), 'compatibility')) { - return false; - } - }); -$config = Symfony\CS\Config\Config::create(); -$config->level(null); -$config->fixers( - array( - 'braces', - 'duplicate_semicolon', - 'elseif', - 'empty_return', - 'encoding', - 'eof_ending', - 'function_call_space', - 'function_declaration', - 'indentation', - 'join_function', - 'line_after_namespace', - 'linefeed', - 'lowercase_keywords', - 'parenthesis', - 'multiple_use', - 'method_argument_space', - 'object_operator', - 'php_closing_tag', - 'remove_lines_between_uses', - 'short_array_syntax', - 'short_tag', - 'standardize_not_equal', - 'trailing_spaces', - 'unused_use', - 'visibility', - 'whitespacy_lines', - ) -); -$config->finder($finder); -return $config; diff --git a/.travis.yml b/.travis.yml index 5a69e0a..659cb07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,14 +28,14 @@ matrix: include: - php: 5.5 env: - - EXECUTE_CS_CHECK=true + - CS_CHECK=true - php: 5.5 env: - EVENT_MANAGER_VERSION="^2.6.2" - SERVICE_MANAGER_VERSION="^2.7.5" - php: 5.6 env: - - EXECUTE_TEST_COVERALLS=true + - TEST_COVERAGE=true - DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)" - PATH="$HOME/.local/bin:$PATH" - php: 5.6 @@ -60,9 +60,9 @@ notifications: email: false before_install: - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi + - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - composer self-update - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi - composer require --no-update "zendframework/zend-eventmanager:$EVENT_MANAGER_VERSION" - composer require --dev --no-update "zendframework/zend-servicemanager:$SERVICE_MANAGER_VERSION" @@ -70,13 +70,12 @@ install: - travis_retry composer install --no-interaction --ignore-platform-reqs script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi - - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi + - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi - if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then travis_retry curl -sSL https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh | bash ; fi after_success: - if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi after_script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7f6d20e..c1753c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,24 +77,24 @@ To do so: ## Running Coding Standards Checks -This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding +This component uses [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) for coding standards checks, and provides configuration for our selected checks. -`php-cs-fixer` is installed by default via Composer. +`phpcs` is installed by default via Composer. To run checks only: ```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs +$ composer cs-check ``` -To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` -flag: +`phpcs` also includes a tool for fixing most CS violations, `phpcbf`: + ```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs +$ composer cs-fix ``` -If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure +If you allow `phpcbf` to fix CS issues, please re-run the tests to ensure they pass, and make sure you add and commit the changes after verification. ## Recommended Workflow for Contributions diff --git a/composer.json b/composer.json index 4e7c419..4d68c37 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,8 @@ "zendframework/zend-loader": "^2.5", "zendframework/zend-mvc": "^2.7", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "~4.0" + "phpunit/PHPUnit": "~4.0", + "zendframework/zend-coding-standard": "~1.0.0" }, "suggest": { "zendframework/zend-config": "Zend\\Config component", @@ -46,5 +46,16 @@ "psr-4": { "ZendTest\\ModuleManager\\": "test/" } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", + "upload-coverage": "coveralls -v" } } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..9e6a751 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,8 @@ + + + + + + src + test + diff --git a/src/Feature/ConsoleBannerProviderInterface.php b/src/Feature/ConsoleBannerProviderInterface.php index 3ec2ebd..1757d69 100644 --- a/src/Feature/ConsoleBannerProviderInterface.php +++ b/src/Feature/ConsoleBannerProviderInterface.php @@ -18,8 +18,8 @@ interface ConsoleBannerProviderInterface * The banner is shown in the console window, when the user supplies invalid command-line parameters or invokes * the application with no parameters. * - * The method is called with active Zend\Console\Adapter\AdapterInterface that can be used to directly access Console and send - * output. + * The method is called with active Zend\Console\Adapter\AdapterInterface that can be used to directly access + * Console and send output. * * @param AdapterInterface $console * @return string|null diff --git a/src/Listener/AutoloaderListener.php b/src/Listener/AutoloaderListener.php index 8c35d88..e90b1b5 100644 --- a/src/Listener/AutoloaderListener.php +++ b/src/Listener/AutoloaderListener.php @@ -25,8 +25,8 @@ class AutoloaderListener extends AbstractListener public function __invoke(ModuleEvent $e) { $module = $e->getModule(); - if (!$module instanceof AutoloaderProviderInterface - && !method_exists($module, 'getAutoloaderConfig') + if (! $module instanceof AutoloaderProviderInterface + && ! method_exists($module, 'getAutoloaderConfig') ) { return; } diff --git a/src/Listener/ConfigListener.php b/src/Listener/ConfigListener.php index 3dc0af0..3970a8f 100644 --- a/src/Listener/ConfigListener.php +++ b/src/Listener/ConfigListener.php @@ -115,8 +115,8 @@ public function onLoadModule(ModuleEvent $e) { $module = $e->getModule(); - if (!$module instanceof ConfigProviderInterface - && !is_callable([$module, 'getConfig']) + if (! $module instanceof ConfigProviderInterface + && ! is_callable([$module, 'getConfig']) ) { return $this; } @@ -274,7 +274,7 @@ protected function addConfigPaths($paths, $type) $paths = ArrayUtils::iteratorToArray($paths); } - if (!is_array($paths)) { + if (! is_array($paths)) { throw new Exception\InvalidArgumentException( sprintf( 'Argument passed to %::%s() must be an array, ' @@ -302,7 +302,7 @@ protected function addConfigPaths($paths, $type) */ protected function addConfigPath($path, $type) { - if (!is_string($path)) { + if (! is_string($path)) { throw new Exception\InvalidArgumentException( sprintf( 'Parameter to %s::%s() must be a string; %s given.', @@ -328,7 +328,7 @@ protected function addConfig($key, $config) $config = ArrayUtils::iteratorToArray($config); } - if (!is_array($config)) { + if (! is_array($config)) { throw new Exception\InvalidArgumentException( sprintf( 'Config being merged must be an array, ' diff --git a/src/Listener/DefaultListenerAggregate.php b/src/Listener/DefaultListenerAggregate.php index a8c53f0..e1a56a6 100644 --- a/src/Listener/DefaultListenerAggregate.php +++ b/src/Listener/DefaultListenerAggregate.php @@ -54,7 +54,11 @@ public function attach(EventManagerInterface $events, $priority = 1) $this->listeners[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULE, new AutoloaderListener($options), 9000); if ($options->getCheckDependencies()) { - $this->listeners[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULE, new ModuleDependencyCheckerListener, 8000); + $this->listeners[] = $events->attach( + ModuleEvent::EVENT_LOAD_MODULE, + new ModuleDependencyCheckerListener, + 8000 + ); } $this->listeners[] = $events->attach(ModuleEvent::EVENT_LOAD_MODULE, new InitTrigger($options)); @@ -94,7 +98,7 @@ public function detach(EventManagerInterface $events) */ public function getConfigListener() { - if (!$this->configListener instanceof ConfigMergerInterface) { + if (! $this->configListener instanceof ConfigMergerInterface) { $this->setConfigListener(new ConfigListener($this->getOptions())); } return $this->configListener; diff --git a/src/Listener/InitTrigger.php b/src/Listener/InitTrigger.php index 4487b2e..af9f34e 100644 --- a/src/Listener/InitTrigger.php +++ b/src/Listener/InitTrigger.php @@ -24,8 +24,8 @@ class InitTrigger extends AbstractListener public function __invoke(ModuleEvent $e) { $module = $e->getModule(); - if (!$module instanceof InitProviderInterface - && !method_exists($module, 'init') + if (! $module instanceof InitProviderInterface + && ! method_exists($module, 'init') ) { return; } diff --git a/src/Listener/ListenerOptions.php b/src/Listener/ListenerOptions.php index 03c6ccd..f23c149 100644 --- a/src/Listener/ListenerOptions.php +++ b/src/Listener/ListenerOptions.php @@ -86,7 +86,7 @@ public function getModulePaths() */ public function setModulePaths($modulePaths) { - if (!is_array($modulePaths) && !$modulePaths instanceof Traversable) { + if (! is_array($modulePaths) && ! $modulePaths instanceof Traversable) { throw new Exception\InvalidArgumentException( sprintf( 'Argument passed to %s::%s() must be an array, ' @@ -132,7 +132,7 @@ public function getConfigStaticPaths() */ public function setConfigGlobPaths($configGlobPaths) { - if (!is_array($configGlobPaths) && !$configGlobPaths instanceof Traversable) { + if (! is_array($configGlobPaths) && ! $configGlobPaths instanceof Traversable) { throw new Exception\InvalidArgumentException( sprintf( 'Argument passed to %s::%s() must be an array, ' @@ -158,7 +158,7 @@ public function setConfigGlobPaths($configGlobPaths) */ public function setConfigStaticPaths($configStaticPaths) { - if (!is_array($configStaticPaths) && !$configStaticPaths instanceof Traversable) { + if (! is_array($configStaticPaths) && ! $configStaticPaths instanceof Traversable) { throw new Exception\InvalidArgumentException( sprintf( 'Argument passed to %s::%s() must be an array, ' @@ -195,7 +195,7 @@ public function getExtraConfig() */ public function setExtraConfig($extraConfig) { - if (!is_array($extraConfig) && !$extraConfig instanceof Traversable) { + if (! is_array($extraConfig) && ! $extraConfig instanceof Traversable) { throw new Exception\InvalidArgumentException( sprintf( 'Argument passed to %s::%s() must be an array, ' diff --git a/src/Listener/LocatorRegistrationListener.php b/src/Listener/LocatorRegistrationListener.php index 9d11294..e5b3b36 100644 --- a/src/Listener/LocatorRegistrationListener.php +++ b/src/Listener/LocatorRegistrationListener.php @@ -65,16 +65,21 @@ public function onLoadModules(ModuleEvent $e) } // Shared instance for module manager - $events->attach('Zend\Mvc\Application', ModuleManager::EVENT_BOOTSTRAP, function (MvcEvent $e) use ($moduleManager) { - $moduleClassName = get_class($moduleManager); - $moduleClassNameArray = explode('\\', $moduleClassName); - $moduleClassNameAlias = end($moduleClassNameArray); - $application = $e->getApplication(); - $services = $application->getServiceManager(); - if (! $services->has($moduleClassName)) { - $services->setAlias($moduleClassName, $moduleClassNameAlias); - } - }, 1000); + $events->attach( + 'Zend\Mvc\Application', + ModuleManager::EVENT_BOOTSTRAP, + function (MvcEvent $e) use ($moduleManager) { + $moduleClassName = get_class($moduleManager); + $moduleClassNameArray = explode('\\', $moduleClassName); + $moduleClassNameAlias = end($moduleClassNameArray); + $application = $e->getApplication(); + $services = $application->getServiceManager(); + if (! $services->has($moduleClassName)) { + $services->setAlias($moduleClassName, $moduleClassNameAlias); + } + }, + 1000 + ); if (0 === count($this->modules)) { return; diff --git a/src/Listener/ModuleDependencyCheckerListener.php b/src/Listener/ModuleDependencyCheckerListener.php index 8608f6a..8870930 100644 --- a/src/Listener/ModuleDependencyCheckerListener.php +++ b/src/Listener/ModuleDependencyCheckerListener.php @@ -36,7 +36,7 @@ public function __invoke(ModuleEvent $e) $dependencies = $module->getModuleDependencies(); foreach ($dependencies as $dependencyModule) { - if (!isset($this->loaded[$dependencyModule])) { + if (! isset($this->loaded[$dependencyModule])) { throw new Exception\MissingDependencyModuleException( sprintf( 'Module "%s" depends on module "%s", which was not initialized before it', diff --git a/src/Listener/ModuleResolverListener.php b/src/Listener/ModuleResolverListener.php index b058796..fc2cf5b 100644 --- a/src/Listener/ModuleResolverListener.php +++ b/src/Listener/ModuleResolverListener.php @@ -25,7 +25,7 @@ public function __invoke(ModuleEvent $e) $moduleName = $e->getModuleName(); $class = $moduleName . '\Module'; - if (!class_exists($class)) { + if (! class_exists($class)) { return false; } diff --git a/src/Listener/OnBootstrapListener.php b/src/Listener/OnBootstrapListener.php index adcd543..eec602f 100644 --- a/src/Listener/OnBootstrapListener.php +++ b/src/Listener/OnBootstrapListener.php @@ -25,8 +25,8 @@ class OnBootstrapListener extends AbstractListener public function __invoke(ModuleEvent $e) { $module = $e->getModule(); - if (!$module instanceof BootstrapListenerInterface - && !method_exists($module, 'onBootstrap') + if (! $module instanceof BootstrapListenerInterface + && ! method_exists($module, 'onBootstrap') ) { return; } diff --git a/src/Listener/ServiceListener.php b/src/Listener/ServiceListener.php index d9f8e5c..6d3af60 100644 --- a/src/Listener/ServiceListener.php +++ b/src/Listener/ServiceListener.php @@ -298,7 +298,7 @@ private function mergeServiceConfiguration($key, array $metadata, array $config) { if (isset($config[$metadata['config_key']]) && is_array($config[$metadata['config_key']]) - && !empty($config[$metadata['config_key']]) + && ! empty($config[$metadata['config_key']]) ) { $this->serviceManagers[$key]['configuration']['merged_config'] = $config[$metadata['config_key']]; } diff --git a/src/ModuleEvent.php b/src/ModuleEvent.php index 994d2bd..f1f3d67 100644 --- a/src/ModuleEvent.php +++ b/src/ModuleEvent.php @@ -62,7 +62,7 @@ public function getModuleName() */ public function setModuleName($moduleName) { - if (!is_string($moduleName)) { + if (! is_string($moduleName)) { throw new Exception\InvalidArgumentException( sprintf( '%s expects a string as an argument; %s provided', @@ -96,7 +96,7 @@ public function getModule() */ public function setModule($module) { - if (!is_object($module)) { + if (! is_object($module)) { throw new Exception\InvalidArgumentException( sprintf( '%s expects a module object as an argument; %s provided', diff --git a/src/ModuleManager.php b/src/ModuleManager.php index 01376d0..632cf9a 100644 --- a/src/ModuleManager.php +++ b/src/ModuleManager.php @@ -162,7 +162,7 @@ public function loadModule($module) * To load a module, we clone the event if we are inside a nested * loadModule() call, and use the original event otherwise. */ - if (!isset($this->loadFinished)) { + if (! isset($this->loadFinished)) { $this->loadFinished = 0; } @@ -171,7 +171,7 @@ public function loadModule($module) $this->loadFinished++; - if (!is_object($module)) { + if (! is_object($module)) { $module = $this->loadModuleByName($event); } $event->setModule($module); @@ -199,7 +199,7 @@ protected function loadModuleByName(ModuleEvent $event) }, $event); $module = $result->last(); - if (!is_object($module)) { + if (! is_object($module)) { throw new Exception\RuntimeException(sprintf( 'Module (%s) could not be initialized.', $event->getModuleName() @@ -232,7 +232,7 @@ public function getLoadedModules($loadModules = false) */ public function getModule($moduleName) { - if (!isset($this->loadedModules[$moduleName])) { + if (! isset($this->loadedModules[$moduleName])) { return; } return $this->loadedModules[$moduleName]; @@ -278,7 +278,7 @@ public function setModules($modules) */ public function getEvent() { - if (!$this->event instanceof ModuleEvent) { + if (! $this->event instanceof ModuleEvent) { $this->setEvent(new ModuleEvent()); } return $this->event; @@ -324,7 +324,7 @@ public function setEventManager(EventManagerInterface $events) */ public function getEventManager() { - if (!$this->events instanceof EventManagerInterface) { + if (! $this->events instanceof EventManagerInterface) { $this->setEventManager(new EventManager()); } return $this->events; diff --git a/test/Listener/AutoloaderListenerTest.php b/test/Listener/AutoloaderListenerTest.php index 18957de..056ac1e 100644 --- a/test/Listener/AutoloaderListenerTest.php +++ b/test/Listener/AutoloaderListenerTest.php @@ -42,7 +42,7 @@ public function testAutoloadersRegisteredByAutoloaderListener() $this->assertTrue($modules['ListenerTestModule']->getAutoloaderConfigCalled); $this->assertTrue(class_exists('Foo\Bar')); } - + // @codingStandardsIgnoreStart public function testAutoloadersRegisteredIfModuleDoesNotInheritAutoloaderProviderInterfaceButDefinesGetAutoloaderConfigMethod() { $moduleManager = $this->moduleManager; @@ -52,4 +52,5 @@ public function testAutoloadersRegisteredIfModuleDoesNotInheritAutoloaderProvide $this->assertTrue($modules['NotAutoloaderModule']->getAutoloaderConfigCalled); $this->assertTrue(class_exists('Foo\Bar')); } + // @codingStandardsIgnoreEnd } diff --git a/test/Listener/ConfigListenerTest.php b/test/Listener/ConfigListenerTest.php index 692416e..abf2130 100644 --- a/test/Listener/ConfigListenerTest.php +++ b/test/Listener/ConfigListenerTest.php @@ -36,7 +36,11 @@ class ConfigListenerTest extends AbstractListenerTestCase public function setUp() { $this->moduleManager = new ModuleManager([]); - $this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000); + $this->moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, + new ModuleResolverListener, + 1000 + ); } public function testMultipleConfigsAreMerged() @@ -75,7 +79,11 @@ public function testCanCacheMergedConfig() // Now we check to make sure it uses the config and doesn't hit // the module objects getConfig() method(s) $moduleManager = new ModuleManager(['SomeModule', 'ListenerTestModule']); - $moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000); + $moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, + new ModuleResolverListener, + 1000 + ); $configListener = new ConfigListener($options); $configListener->attach($moduleManager->getEventManager()); $moduleManager->loadModules(); @@ -220,7 +228,11 @@ public function testCanCacheMergedConfigFromGlob() // This time, don't add the glob path $configListener = new ConfigListener($options); $moduleManager = new ModuleManager(['SomeModule']); - $moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000); + $moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, + new ModuleResolverListener, + 1000 + ); $configListener->attach($moduleManager->getEventManager()); @@ -260,7 +272,11 @@ public function testCanCacheMergedConfigFromStatic() // This time, don't add the glob path $configListener = new ConfigListener($options); $moduleManager = new ModuleManager(['SomeModule']); - $moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000); + $moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, + new ModuleResolverListener, + 1000 + ); $configListener->attach($moduleManager->getEventManager()); diff --git a/test/Listener/InitTriggerTest.php b/test/Listener/InitTriggerTest.php index 20305ee..d5a4846 100644 --- a/test/Listener/InitTriggerTest.php +++ b/test/Listener/InitTriggerTest.php @@ -28,7 +28,11 @@ class InitTriggerTest extends AbstractListenerTestCase public function setUp() { $this->moduleManager = new ModuleManager([]); - $this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000); + $this->moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, + new ModuleResolverListener, + 1000 + ); $this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, new InitTrigger, 2000); } diff --git a/test/Listener/ListenerOptionsTest.php b/test/Listener/ListenerOptionsTest.php index e7f29ea..ffd541b 100644 --- a/test/Listener/ListenerOptionsTest.php +++ b/test/Listener/ListenerOptionsTest.php @@ -49,7 +49,7 @@ public function testConfigCacheFileWithEmptyCacheKey() 'module_paths' => ['module', 'paths'], 'config_glob_paths' => ['glob', 'paths'], 'config_static_paths' => ['static', 'custom_paths'], - ]); + ]); $this->assertEquals(__DIR__ . '/module-config-cache.php', $options->getConfigCacheFile()); $options->setConfigCacheKey('foo'); @@ -67,7 +67,7 @@ public function testModuleMapCacheFileWithEmptyCacheKey() 'module_paths' => ['module', 'paths'], 'config_glob_paths' => ['glob', 'paths'], 'config_static_paths' => ['static', 'custom_paths'], - ]); + ]); $this->assertEquals(__DIR__ . '/module-classmap-cache.php', $options->getModuleMapCacheFile()); $options->setModuleMapCacheKey('foo'); diff --git a/test/Listener/LocatorRegistrationListenerTest.php b/test/Listener/LocatorRegistrationListenerTest.php index 31ee88a..1344d59 100644 --- a/test/Listener/LocatorRegistrationListenerTest.php +++ b/test/Listener/LocatorRegistrationListenerTest.php @@ -53,7 +53,11 @@ public function setUp() $this->moduleManager = new ModuleManager(['ListenerTestModule']); $this->moduleManager->setEventManager($this->createEventManager($this->sharedEvents)); - $this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000); + $this->moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, + new ModuleResolverListener, + 1000 + ); $this->application = new MockApplication; $events = $this->createEventManager($this->sharedEvents); @@ -136,7 +140,7 @@ public function testModuleClassIsRegisteredWithDiAndInjectedWithSharedInstances( $message .= "\n" . $e->getMessage(); } } - if (!$foo) { + if (! $foo) { $this->fail($message); } $this->assertSame($module, $foo->module); diff --git a/test/Listener/ModuleDependencyCheckerListenerTest.php b/test/Listener/ModuleDependencyCheckerListenerTest.php index 53157e7..e8a8a2f 100644 --- a/test/Listener/ModuleDependencyCheckerListenerTest.php +++ b/test/Listener/ModuleDependencyCheckerListenerTest.php @@ -25,7 +25,11 @@ class ModuleDependencyCheckerListenerTest extends TestCase public function testCallsGetModuleDependenciesOnModuleImplementingInterface() { //$moduleManager = new ModuleManager(array()); - //$moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE, new ModuleDependencyCheckerListener(), 2000); + /*$moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE, + new ModuleDependencyCheckerListener(), + 2000 + ); */ $module = $this->getMock('Zend\ModuleManager\Feature\DependencyIndicatorInterface'); $module->expects($this->once())->method('getModuleDependencies')->will($this->returnValue([])); diff --git a/test/Listener/ModuleLoaderListenerTest.php b/test/Listener/ModuleLoaderListenerTest.php index 0ccd881..89ce445 100644 --- a/test/Listener/ModuleLoaderListenerTest.php +++ b/test/Listener/ModuleLoaderListenerTest.php @@ -34,7 +34,11 @@ class ModuleLoaderListenerTest extends AbstractListenerTestCase public function setUp() { $this->moduleManager = new ModuleManager([]); - $this->moduleManager->getEventManager()->attach(ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, new ModuleResolverListener, 1000); + $this->moduleManager->getEventManager()->attach( + ModuleEvent::EVENT_LOAD_MODULE_RESOLVE, + new ModuleResolverListener, + 1000 + ); } public function testModuleLoaderListenerFunctionsAsAggregateListenerEnabledCache() diff --git a/test/Listener/_files/good/config.php b/test/Listener/_files/good/config.php index 6408bad..057b5ae 100644 --- a/test/Listener/_files/good/config.php +++ b/test/Listener/_files/good/config.php @@ -1,4 +1,4 @@ 'loaded', -); +]; diff --git a/test/Listener/_files/good/merge1.php b/test/Listener/_files/good/merge1.php index 70bc649..7743911 100644 --- a/test/Listener/_files/good/merge1.php +++ b/test/Listener/_files/good/merge1.php @@ -1,5 +1,5 @@ array('foo'), +return [ + 'indexed' => ['foo'], 'keyed' => 'foo', -); +]; diff --git a/test/Listener/_files/good/merge2.php b/test/Listener/_files/good/merge2.php index 2d032ca..b158155 100644 --- a/test/Listener/_files/good/merge2.php +++ b/test/Listener/_files/good/merge2.php @@ -1,5 +1,5 @@ array('bar'), +return [ + 'indexed' => ['bar'], 'keyed' => 'bar', -); +]; diff --git a/test/TestAsset/BafModule/configs/config.php b/test/TestAsset/BafModule/configs/config.php index 89df1a5..94fcfdb 100644 --- a/test/TestAsset/BafModule/configs/config.php +++ b/test/TestAsset/BafModule/configs/config.php @@ -1,4 +1,4 @@ 'foo', -); +]; diff --git a/test/TestAsset/BamModule/configs/config.php b/test/TestAsset/BamModule/configs/config.php index 89df1a5..94fcfdb 100644 --- a/test/TestAsset/BamModule/configs/config.php +++ b/test/TestAsset/BamModule/configs/config.php @@ -1,4 +1,4 @@ 'foo', -); +]; diff --git a/test/TestAsset/BarModule/configs/config.php b/test/TestAsset/BarModule/configs/config.php index 89df1a5..94fcfdb 100644 --- a/test/TestAsset/BarModule/configs/config.php +++ b/test/TestAsset/BarModule/configs/config.php @@ -1,4 +1,4 @@ 'foo', -); +]; diff --git a/test/TestAsset/BazModule/configs/config.php b/test/TestAsset/BazModule/configs/config.php index 48ef259..083c6f2 100644 --- a/test/TestAsset/BazModule/configs/config.php +++ b/test/TestAsset/BazModule/configs/config.php @@ -1,4 +1,4 @@ 'bar', -); +]; diff --git a/test/TestAsset/BooModule/configs/config.php b/test/TestAsset/BooModule/configs/config.php index 89df1a5..94fcfdb 100644 --- a/test/TestAsset/BooModule/configs/config.php +++ b/test/TestAsset/BooModule/configs/config.php @@ -1,4 +1,4 @@ 'foo', -); +]; diff --git a/test/TestAsset/BorModule/configs/config.php b/test/TestAsset/BorModule/configs/config.php index 89df1a5..94fcfdb 100644 --- a/test/TestAsset/BorModule/configs/config.php +++ b/test/TestAsset/BorModule/configs/config.php @@ -1,4 +1,4 @@ 'foo', -); +]; diff --git a/test/TestAsset/ListenerTestModule/Module.php b/test/TestAsset/ListenerTestModule/Module.php index 2d31715..d1e9268 100644 --- a/test/TestAsset/ListenerTestModule/Module.php +++ b/test/TestAsset/ListenerTestModule/Module.php @@ -32,21 +32,21 @@ public function init($moduleManager = null) public function getConfig() { $this->getConfigCalled = true; - return array( + return [ 'listener' => 'test' - ); + ]; } public function getAutoloaderConfig() { $this->getAutoloaderConfigCalled = true; - return array( - 'Zend\Loader\StandardAutoloader' => array( - 'namespaces' => array( + return [ + 'Zend\Loader\StandardAutoloader' => [ + 'namespaces' => [ 'Foo' => __DIR__ . '/src/Foo', - ), - ), - ); + ], + ], + ]; } public function onBootstrap(EventInterface $e) diff --git a/test/TestAsset/LoadBarModule/Module.php b/test/TestAsset/LoadBarModule/Module.php index 7848646..1b65b7e 100644 --- a/test/TestAsset/LoadBarModule/Module.php +++ b/test/TestAsset/LoadBarModule/Module.php @@ -20,9 +20,9 @@ public function init(ModuleManager $moduleManager) public function getConfig() { - return array( + return [ 'bar' => 'bar', 'foo' => 'bar', - ); + ]; } } diff --git a/test/TestAsset/LoadFooModule/Module.php b/test/TestAsset/LoadFooModule/Module.php index c6387c6..a957d30 100644 --- a/test/TestAsset/LoadFooModule/Module.php +++ b/test/TestAsset/LoadFooModule/Module.php @@ -20,9 +20,9 @@ public function init(ModuleManager $moduleManager) public function getConfig() { - return array( + return [ 'bar' => 'foo', 'foo' => 'foo', - ); + ]; } } diff --git a/test/TestAsset/LoadOtherModule/Module.php b/test/TestAsset/LoadOtherModule/Module.php index 6966c5b..8aecd53 100644 --- a/test/TestAsset/LoadOtherModule/Module.php +++ b/test/TestAsset/LoadOtherModule/Module.php @@ -9,7 +9,6 @@ namespace LoadOtherModule; - use Zend\ModuleManager\ModuleManager; class Module @@ -22,6 +21,6 @@ public function init(ModuleManager $moduleManager) public function getConfig() { - return array('loaded' => 'oh, yeah baby!'); + return ['loaded' => 'oh, yeah baby!']; } } diff --git a/test/TestAsset/NotAutoloaderModule/Module.php b/test/TestAsset/NotAutoloaderModule/Module.php index 0a20522..2e91475 100644 --- a/test/TestAsset/NotAutoloaderModule/Module.php +++ b/test/TestAsset/NotAutoloaderModule/Module.php @@ -16,12 +16,12 @@ class Module public function getAutoloaderConfig() { $this->getAutoloaderConfigCalled = true; - return array( - 'Zend\Loader\StandardAutoloader' => array( - 'namespaces' => array( + return [ + 'Zend\Loader\StandardAutoloader' => [ + 'namespaces' => [ 'Foo' => __DIR__ . '/src/Foo', - ), - ), - ); + ], + ], + ]; } } diff --git a/test/TestAsset/NotAutoloaderModule/src/Foo/Bar.php b/test/TestAsset/NotAutoloaderModule/src/Foo/Bar.php index 0155c14..d216bb1 100644 --- a/test/TestAsset/NotAutoloaderModule/src/Foo/Bar.php +++ b/test/TestAsset/NotAutoloaderModule/src/Foo/Bar.php @@ -10,4 +10,7 @@ namespace Foo; class Bar -{} +{ + + +} diff --git a/test/TestAsset/SomeModule/configs/config.php b/test/TestAsset/SomeModule/configs/config.php index b5fa555..e6c7224 100644 --- a/test/TestAsset/SomeModule/configs/config.php +++ b/test/TestAsset/SomeModule/configs/config.php @@ -1,4 +1,4 @@ 'thing', -); +]; diff --git a/test/_files/config.php b/test/_files/config.php index 6e754c4..1a871a6 100644 --- a/test/_files/config.php +++ b/test/_files/config.php @@ -1,6 +1,6 @@ array( +return [ + 'all' => [ 'php' => 'yes' - ), -); + ], +];