From 6a6f88ecd62728803b79433a5fb36bd9fd0daf3f Mon Sep 17 00:00:00 2001 From: Jay Klehr Date: Thu, 31 May 2018 08:04:59 -0600 Subject: [PATCH] adding grumphp, fixing style, narrowing autoload namespace (#1) * adding grumphp, fixing style, narrowing autoload namespace * removing travis matrix to see if default test stages go away --- .github/settings.yml | 2 ++ .gitignore | 3 ++- .php_cs | 25 +++++++++++++++++++++++++ .travis.yml | 22 ++++++++++++++-------- composer.json | 10 +++++++--- grumphp.yml.dist | 12 ++++++++++++ phpstan.neon | 2 ++ src/Zend/Service/Abstract.php | 1 - src/Zend/Service/Exception.php | 4 ++-- 9 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 .github/settings.yml create mode 100644 .php_cs create mode 100644 grumphp.yml.dist diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..b0fc372 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,2 @@ +repository: + name: zf1-service \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7602b69..e7d8838 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor -/composer.lock \ No newline at end of file +/composer.lock +.php_cs.cache \ No newline at end of file diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..5b8df85 --- /dev/null +++ b/.php_cs @@ -0,0 +1,25 @@ +exclude('vendor') + ->files() + ->in(__DIR__) +; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules([ + '@PSR2' => true, + '@PHPUnit60Migration:risky' => true, + 'binary_operator_spaces' => [ + 'default' => 'align_single_space_minimal', + 'operators' => ['||' => null, '&&' => null] + ], + 'single_quote' => true, + 'array_syntax' => ['syntax' => 'long'], + 'concat_space' => ['spacing' => 'one'], + 'psr0' => true + ]) + ->setUsingCache(true) + ->setFinder($finder); +; diff --git a/.travis.yml b/.travis.yml index 6592e40..609911e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,6 @@ language: php sudo: false -php: - - 7 - - 7.1 - - 7.2 - - nightly - env: TMPDIR=/tmp branches: @@ -18,10 +12,22 @@ install: - phpenv rehash - travis_retry composer install --no-interaction --prefer-source -script: - - composer phpstan +stages: + - style check + - phpstan analysis jobs: fast_finish: true allow_failures: - php: nightly + include: + - stage: style check + php: 7.1 + env: TMPDIR=/tmp USE_XDEBUG=false + script: + - composer style-check + - stage: phpstan analysis + php: 7.1 + env: TMPDIR=/tmp USE_XDEBUG=false + script: + - composer phpstan \ No newline at end of file diff --git a/composer.json b/composer.json index 2da5575..8d06465 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,18 @@ }, "autoload": { "psr-0": { - "Zend_": "src/" + "Zend_Service_": "src/" } }, "require-dev": { "phpunit/phpunit": "^6.0", - "phpstan/phpstan": "^0.9.2" + "phpstan/phpstan": "^0.9.2", + "friendsofphp/php-cs-fixer": "^2.11", + "maglnet/composer-require-checker": "^0.1.6 | ^0.2.1", + "phpro/grumphp": "^0.14.0" }, "scripts": { - "phpstan": "phpstan analyze -l7 -c phpstan.neon --no-progress ./src --ansi" + "phpstan": "phpstan analyze -l7 -c phpstan.neon --no-progress ./ --ansi", + "style-check": "php-cs-fixer fix --dry-run -vv" } } diff --git a/grumphp.yml.dist b/grumphp.yml.dist new file mode 100644 index 0000000..e02cf91 --- /dev/null +++ b/grumphp.yml.dist @@ -0,0 +1,12 @@ +# grumphp.yml +parameters: + tasks: + composer: + strict: true + composer_require_checker: ~ + phpcsfixer2: + allow_risky: true + config: .php_cs + phpstan: + level: 7 + configuration: phpstan.neon diff --git a/phpstan.neon b/phpstan.neon index 096cae4..4184f13 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,2 +1,4 @@ parameters: + excludes_analyse: + - %rootDir%/../../../vendor/* ignoreErrors: diff --git a/src/Zend/Service/Abstract.php b/src/Zend/Service/Abstract.php index 18147dc..d8aaacf 100644 --- a/src/Zend/Service/Abstract.php +++ b/src/Zend/Service/Abstract.php @@ -62,4 +62,3 @@ final public static function getHttpClient() return self::$_httpClient; } } - diff --git a/src/Zend/Service/Exception.php b/src/Zend/Service/Exception.php index 0efaf57..d684802 100644 --- a/src/Zend/Service/Exception.php +++ b/src/Zend/Service/Exception.php @@ -27,5 +27,5 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Service_Exception extends Zend_Exception -{} - +{ +}