Skip to content

Commit

Permalink
Merge pull request #37 from koriym/php7
Browse files Browse the repository at this point in the history
Drop PHP 5.x suppport
  • Loading branch information
koriym authored Apr 4, 2018
2 parents 276d4f9 + b49bb70 commit e33941e
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 47 deletions.
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ language: php
sudo: false
dist: trusty
php:
- 5.6
- 7.0
- 7
- 7.1
- hhvm
- 7.2
cache:
directories:
- vendor
Expand All @@ -17,9 +16,11 @@ env:
before_script:
- composer self-update
- composer update $DEPENDENCIES
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then COVERAGE="--coverage-clover=coverage.clover"; else phpenv config-rm xdebug.ini; fi
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then composer require --dev phpstan/phpstan-shim friendsofphp/php-cs-fixer; fi
script:
- ./vendor/bin/phpunit --coverage-clover=coverage.clover;
- if [ "$TRAVIS_PHP_VERSION" = "7.1" ]; then wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar && php php-cs-fixer-v2.phar fix --config=.php_cs -v --dry-run --using-cache=no --path-mode=intersection `git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE`; fi

- ./vendor/bin/phpunit $COVERAGE;
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${TRAVIS_COMMIT_RANGE}")); unset IFS && ./vendor/bin/php-cs-fixer fix --config=.php_cs -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}";fi
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then ./vendor/bin/phpstan analyse -l max -c phpstan.neon src tests --no-progress --no-interaction; fi
after_script:
- if [ "$TRAVIS_PHP_VERSION" = "7.1" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
- if [[ $TRAVIS_PHP_VERSION = '7.1' ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Various config files are ready for continuous integration.
* .php_cs for [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
* .travis.yml for [Travis CI](https://travis-ci.org/)
* .scrutinizer for [scrutinizer-ci](https://scrutinizer-ci.com/)
* phpstan.neon for [phpstan](https://github.com/phpstan/phpstan)

## Getting started

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
}
],
"require": {
"php": ">=5.6.0"
"php": ">=7.0.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.0",
"squizlabs/php_codesniffer": "^2.8",
"friendsofphp/php-cs-fixer": "^2.3",
"phpmd/phpmd": "^2.6"
"phpunit/phpunit": "^6.5",
"squizlabs/php_codesniffer": "^3.2",
"friendsofphp/php-cs-fixer": "^2.11",
"phpmd/phpmd": "^2.6",
"phpstan/phpstan-shim" : "^0.9"
},
"autoload": {
"psr-4": {
Expand All @@ -46,8 +47,7 @@
"Koriym\\PhpSkeleton\\Installer::postInstall",
"composer update"
],
"test": ["phpmd src text ./phpmd.xml", "@cs", "phpunit"
],
"test": ["@cs", "phpmd src text ./phpmd.xml", "phpstan analyse -l max src tests -c phpstan.neon --no-progress", "phpunit"],
"coverage": ["php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"],
"cs": ["php-cs-fixer fix -v --dry-run", "phpcs --standard=./phpcs.xml src"],
"cs-fix": ["php-cs-fixer fix -v", "phpcbf src"],
Expand Down
33 changes: 19 additions & 14 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
<ruleset
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<!--codesize-->
<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
<rule ref="rulesets/codesize.xml/NPathComplexity"/>
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity"/>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<properties>
<property name="reportLevel" value="20"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/NPathComplexity">
<properties>
<property name="minimum" value="200"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity">
<properties>
<property name="maximum" value="100"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassLength"/>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
Expand All @@ -16,14 +28,10 @@
<!--design-->
<rule ref="rulesets/design.xml/EvalExpression"/>
<rule ref="rulesets/design.xml/ExitExpression"/>
<rule ref="rulesets/design.xml/GotoStatement"/>
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/NumberOfChildren"/>
<rule ref="rulesets/design.xml/DepthOfInheritance"/>
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<properties>
<property name="minimum" value="14"/>
</properties>
</rule>
<!-- <rule ref="rulesets/design.xml/CouplingBetweenObjects" /> -->
<!--naming-->
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
<rule ref="rulesets/naming.xml/BooleanGetMethodName"/>
Expand All @@ -33,13 +41,10 @@
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
<!--controversial-->
<rule ref="rulesets/controversial.xml/Superglobals"/>
<rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
<rule ref="rulesets/controversial.xml/CamelCasePropertyName"/>
<rule ref="rulesets/controversial.xml/CamelCaseMethodName"/>
<rule ref="rulesets/controversial.xml/CamelCaseParameterName"/>
<rule ref="rulesets/controversial.xml/CamelCaseVariableName"/>
<!--cleancode-->
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag"/>
<rule ref="rulesets/cleancode.xml/ElseExpression"/>
<!-- <rule ref="rulesets/cleancode.xml/ElseExpression" /> -->
</ruleset>
Empty file added phpstan.neon
Empty file.
5 changes: 4 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<phpunit bootstrap="tests/bootstrap.php">
<phpunit bootstrap="./vendor/autoload.php">
<testsuites>
<testsuite>
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1" />
</php>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
Expand Down
11 changes: 0 additions & 11 deletions src/Exception/ExceptionInterface.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Exception/LogicException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
*/
namespace __Vendor__\__Package__\Exception;

class LogicException extends \LogicException implements ExceptionInterface
class LogicException extends \LogicException
{
}
2 changes: 1 addition & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
*/
namespace __Vendor__\__Package__\Exception;

class RuntimeException extends \RuntimeException implements ExceptionInterface
class RuntimeException extends \RuntimeException
{
}
1 change: 0 additions & 1 deletion tests/SkeletonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class __Package__Test extends TestCase

protected function setUp()
{
parent::setUp();
$this->skeleton = new __Package__;
}

Expand Down
4 changes: 0 additions & 4 deletions tests/bootstrap.php

This file was deleted.

0 comments on commit e33941e

Please sign in to comment.