Skip to content

Commit

Permalink
Merge pull request #1 from ray-di/composer
Browse files Browse the repository at this point in the history
Update meta files
  • Loading branch information
koriym authored Feb 23, 2017
2 parents 78ae796 + 996e6be commit f9f2f77
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 22 deletions.
38 changes: 38 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->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;
32 changes: 24 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 13 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
3 changes: 1 addition & 2 deletions docs/demo/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
19 changes: 19 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<ruleset>
<!-- 2. General -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<!-- Include the whole PSR-2 standard -->
<rule ref="PSR2">
<exclude name="Generic.Files.LineLength"/>
</rule>
<rule ref="PEAR.Commenting.FunctionComment">
<exclude name="PEAR.Commenting.FunctionComment.MissingReturn"/>
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="PEAR.Commenting.FunctionComment.SpacingBeforeTags"/>
<exclude name="PEAR.Commenting.FunctionComment.MissingParamTag"/>
<exclude name="PEAR.Commenting.FunctionComment.Missing"/>
<exclude name="PEAR.Commenting.FunctionComment.ParameterCommentsNotAligned"/>
</rule>
</ruleset>
45 changes: 45 additions & 0 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<ruleset
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/ExcessiveClassLength"/>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength"/>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>
<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>
<rule ref="rulesets/codesize.xml/TooManyFields"/>
<rule ref="rulesets/codesize.xml/TooManyMethods"/>
<!--design-->
<rule ref="rulesets/design.xml/EvalExpression"/>
<rule ref="rulesets/design.xml/ExitExpression"/>
<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="15"/>
</properties>
</rule>
<!--naming-->
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
<rule ref="rulesets/naming.xml/BooleanGetMethodName"/>
<!--unusedcode-->
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"/>
<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"/>
</ruleset>
2 changes: 1 addition & 1 deletion src/DbalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 1 addition & 2 deletions src/DbalProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit f9f2f77

Please sign in to comment.