diff --git a/.php_cs b/.php_cs index 141f75b..404d152 100644 --- a/.php_cs +++ b/.php_cs @@ -1,20 +1,39 @@ level(null); -$config->fixers( - array( - 'indentation', - 'linefeed', - 'trailing_spaces', - 'short_tag', - 'visibility', - 'php_closing_tag', - 'braces', - 'function_declaration', - 'psr0', - 'elseif', - 'eof_ending', - 'unused_use', - ) +$finder = Symfony\CS\Finder\DefaultFinder::create() +->in(__DIR__); + +$config = Symfony\CS\Config\Config::create() +->level(Symfony\CS\FixerInterface::PSR2_LEVEL) +->finder($finder) +->fixers( + [ + 'blankline_after_open_tag', + '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 48b4671..23cf9fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,14 @@ php: - 5.5 - 5.6 - hhvm + - 7 -before_script: - - wget https://scrutinizer-ci.com/ocular.phar - - composer install --prefer-source +install: travis_retry composer install --no-interaction --prefer-source script: - - phpunit --coverage-text --coverage-clover=coverage.clover + - if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then phpunit; fi + - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi after_script: - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - wget https://scrutinizer-ci.com/ocular.phar + - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..54c3db9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Akihito Koriyama + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/Licence.txt b/Licence.txt deleted file mode 100644 index 5d58fa3..0000000 --- a/Licence.txt +++ /dev/null @@ -1,24 +0,0 @@ -Copyright (c) <2015>, -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/composer.json b/composer.json index 24c380d..4f4a1e8 100644 --- a/composer.json +++ b/composer.json @@ -2,9 +2,13 @@ "name": "ray/web-param-module", "description":"Binds the value(s) of a web context to method parameter.", "keywords":[ - "Ray.Di Module", "Web context", "Testability" + "Ray.Di Module", "Web context", "Testability" ], - "license": "BSD-3-Clause", + "license": "MIT", + "require": { + "ray/di": "~2.0", + "doctrine/cache": "~1.0" + }, "autoload":{ "psr-4":{ "Ray\\WebContextParam\\": "src/" @@ -16,16 +20,5 @@ "Ray\\WebContextParam\\": "tests/", "Ray\\WebContextParam\\": "tests/Fake" } - }, - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "branch-alias": { - "dev-develop": "0.1.x-dev" - } - }, - "require": { - "ray/di": "~2.0@dev", - "doctrine/cache": "~1.0" } } diff --git a/phpmd.xml b/phpmd.xml index 0412e29..bd342f1 100644 --- a/phpmd.xml +++ b/phpmd.xml @@ -1,7 +1,9 @@ - + PHP.Skeleton rule set diff --git a/src/Annotation/AbstractWebContextParam.php b/src/Annotation/AbstractWebContextParam.php index b8a26d8..d3f0077 100644 --- a/src/Annotation/AbstractWebContextParam.php +++ b/src/Annotation/AbstractWebContextParam.php @@ -1,8 +1,8 @@ cache->save($id, $meta); } $parameters = $invocation->getMethod()->getParameters(); - $cnt =count($parameters); + $cnt = count($parameters); for ($i = 0; $i < $cnt; $i++) { - $this->setArg($args, $meta ,$i); + $this->setArg($args, $meta, $i); } - return $invocation->proceed(); } @@ -79,6 +78,12 @@ private function getMeta(\ReflectionMethod $method) return $meta; } + /** + * @param array $meta + * @param int $i + * + * @return array + */ private function getParam(array $meta, $i) { list($globalKey, $key) = $meta[$i]; @@ -90,7 +95,6 @@ private function getParam(array $meta, $i) return [false, null]; } - /** * @param AbstractWebContextParam $annotation * @param \ReflectionMethod $method @@ -115,12 +119,12 @@ private function getPos(AbstractWebContextParam $annotation, \ReflectionMethod $ /** * @param Arguments $args * @param array $meta - * @param $i + * @param in $i */ - private function setArg(Arguments $args ,array $meta ,$i) + private function setArg(Arguments $args, array $meta, $i) { if (isset($meta[$i]) && (! isset($args[$i]))) { - list($hasParam ,$param) = $this->getParam($meta ,$i); + list($hasParam, $param) = $this->getParam($meta, $i); if ($hasParam) { $args[$i] = $param; } diff --git a/src/WebContextParamModule.php b/src/WebContextParamModule.php index c112b0f..b9c9edd 100644 --- a/src/WebContextParamModule.php +++ b/src/WebContextParamModule.php @@ -2,7 +2,7 @@ /** * This file is part of the Ray.AuraSqlModule package * - * @license http://opensource.org/licenses/bsd-license.php BSD + * @license http://opensource.org/licenses/bsd-license.php MIT */ namespace Ray\WebContextParam; diff --git a/tests/Fake/FakeConsumer.php b/tests/Fake/FakeConsumer.php index c5bfa54..3f045dd 100644 --- a/tests/Fake/FakeConsumer.php +++ b/tests/Fake/FakeConsumer.php @@ -1,12 +1,11 @@