diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..ff96ac7 --- /dev/null +++ b/.php_cs @@ -0,0 +1,38 @@ +in(__DIR__); + +$config = Symfony\CS\Config\Config::create() +->level(Symfony\CS\FixerInterface::PSR2_LEVEL) +->finder($finder) +->fixers( + [ + 'extra_empty_lines', + 'no_blank_lines_after_class_opening', + 'no_empty_lines_after_phpdocs', + 'operators_spaces', + 'duplicate_semicolon', + 'namespace_no_leading_whitespace', + 'phpdoc_indent', + 'phpdoc_no_empty_return', + 'phpdoc_no_package', + 'phpdoc_params', + 'phpdoc_separation', + 'phpdoc_to_comment', + 'phpdoc_trim', + 'phpdoc_var_without_name', + 'remove_leading_slash_use', + 'remove_lines_between_uses', + 'return', + 'single_array_no_trailing_comma', + 'single_quote', + 'spaces_before_semicolon', + 'spaces_cast', + 'standardize_not_equal', + 'ternary_spaces', + 'whitespacy_lines', + 'ordered_use', + 'short_array_syntax' + ] +); +return $config; diff --git a/.travis.yml b/.travis.yml index f7fdf6e..b0fedd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,30 @@ language: php - php: - - 5.5 - 5.6 + - 7.0 + - 7.1 - hhvm - +sudo: false +cache: + directories: + - $HOME/.composer/cache +matrix: + include: + - php: 5.6 + env: dependencies=lowest + - php: hhvm + env: dependencies=lowest + - php: 7.0 + env: dependencies=lowest + - php: 7.1 + env: dependencies=lowest +before_script: + - composer self-update + - if [ -z "$dependencies" ]; then composer install; fi; + - if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest; fi; script: - - composer install --prefer-source - - phpunit --coverage-text --coverage-clover=coverage.clover - + - if [ "$TRAVIS_PHP_VERSION" != "7.1" ]; then phpunit; fi + - if [ "$TRAVIS_PHP_VERSION" == "7.1" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - wget https://scrutinizer-ci.com/ocular.phar + - if [ "$TRAVIS_PHP_VERSION" == "7.1" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/composer.json b/composer.json index 59bea0f..cac5a19 100644 --- a/composer.json +++ b/composer.json @@ -5,21 +5,25 @@ "dbal" ], "description": "doctrine/dbal module for Ray.Di", - "license": "BSD-3-Clause", + "license": "MIT", "require": { - "ray/di": "~2.0@dev", - "doctrine/dbal": "~2.5" + "ray/di": "^2.5.0", + "doctrine/dbal": "^2.5.12" }, "autoload": { "psr-4": { "Ray\\DbalModule\\": "src/" } }, - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "branch-alias": { - "dev-develop": "0.1.x-dev" - } + "scripts" : { + "test": [ + "phpmd src text ./phpmd.xml", + "phpcs src tests", + "phpunit" + ], + "cs-fix": [ + "php-cs-fixer fix --config-file=./.php_cs", + "phpcbf src" + ] } } diff --git a/docs/demo/run.php b/docs/demo/run.php index 5f1a0e5..37f1e00 100644 --- a/docs/demo/run.php +++ b/docs/demo/run.php @@ -19,5 +19,4 @@ public function foo() $fake = (new Injector(new DbalModule('driver=pdo_sqlite&memory=true')))->getInstance(Fake::class); $works = ($fake->foo() instanceof \Doctrine\DBAL\Driver\Connection); -echo ($works ? 'It works!' : 'It DOES NOT work!') . PHP_EOL; - +echo($works ? 'It works!' : 'It DOES NOT work!') . PHP_EOL; diff --git a/phpcs.xml b/phpcs.xml new file mode 100755 index 0000000..76dc14b --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/phpmd.xml b/phpmd.xml new file mode 100644 index 0000000..9d1299e --- /dev/null +++ b/phpmd.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DbalModule.php b/src/DbalModule.php index 0f6fa8a..cb1da5c 100644 --- a/src/DbalModule.php +++ b/src/DbalModule.php @@ -7,10 +7,10 @@ namespace Ray\DbalModule; use Doctrine\Common\Annotations\AnnotationRegistry; +use Doctrine\DBAL\Driver\Connection; use Ray\DbalModule\Annotation\DbalConfig; use Ray\Di\AbstractModule; use Ray\Di\Scope; -use Doctrine\DBAL\Driver\Connection; class DbalModule extends AbstractModule { diff --git a/src/DbalProvider.php b/src/DbalProvider.php index 0ca0f79..d40b197 100644 --- a/src/DbalProvider.php +++ b/src/DbalProvider.php @@ -6,10 +6,9 @@ */ namespace Ray\DbalModule; +use Doctrine\DBAL\DriverManager; use Ray\DbalModule\Annotation\DbalConfig; -use Ray\Di\Di\Named; use Ray\Di\ProviderInterface; -use Doctrine\DBAL\DriverManager; class DbalProvider implements ProviderInterface {