diff --git a/.gitattributes b/.gitattributes index 7325c690..ea5703b5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,5 +4,5 @@ .gitattributes export-ignore .gitignore export-ignore .travis.yml export-ignore -.php_cs export-ignore +phpcs.xml export-ignore phpunit.xml.dist export-ignore diff --git a/.gitignore b/.gitignore index d41a109a..ffc7e232 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,5 @@ vendor/ zf-mkdoc-theme/ clover.xml -composer.lock coveralls-upload.json phpunit.xml diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 8f4dd5aa..00000000 --- a/.php_cs +++ /dev/null @@ -1,45 +0,0 @@ -in('src') - ->in('test') - ->notPath('TestAsset') - ->notPath('_files') - ->filter(function (SplFileInfo $file) { - if (strstr($file->getPath(), 'compatibility')) { - return false; - } - }); -$config = Symfony\CS\Config\Config::create(); -$config->level(null); -$config->fixers( - array( - 'braces', - 'duplicate_semicolon', - 'elseif', - 'empty_return', - 'encoding', - 'eof_ending', - 'function_call_space', - 'function_declaration', - 'indentation', - 'join_function', - 'line_after_namespace', - 'linefeed', - 'lowercase_keywords', - 'parenthesis', - 'multiple_use', - 'method_argument_space', - 'object_operator', - 'php_closing_tag', - 'remove_lines_between_uses', - 'short_array_syntax', - 'short_tag', - 'standardize_not_equal', - 'trailing_spaces', - 'unused_use', - 'visibility', - 'whitespacy_lines', - ) -); -$config->finder($finder); -return $config; diff --git a/.travis.yml b/.travis.yml index ec5aa8de..5a969711 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,25 +15,47 @@ cache: env: global: - - SITE_URL: https://zendframework.github.io/zend-server - - GH_USER_NAME: "Matthew Weier O'Phinney" - - GH_USER_EMAIL: matthew@weierophinney.net - - GH_REF: github.com/zendframework/zend-server.git + - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" + - SITE_URL=https://zendframework.github.io/zend-server + - GH_USER_NAME="Matthew Weier O'Phinney" + - GH_USER_EMAIL=matthew@weierophinney.net + - GH_REF=github.com/zendframework/zend-server.git - secure: "mC9p7uCm+nD72XFKyMxK9AprWHl6xzq1iuz5Hg9AUpGxHskemnBugCWaet8YsZpIsEBlT6BWH0xzT3AB5RMYdLJS0ctV5xCEd2FccPPvEGdxmrGQZl+vIf60xOv8O+zy37gXOH5tmce+KMpGOsZ4Zz+4RKU5F3Lz2/AmrBUdKvA+k/ZGoHWQfTfBugi5ej0hU+yzsmk6qbw7Q9ViuuLY3OsTTnLQKXGDk+7pvYBpfMpSOHZ5GL14ZYxC56k2PCjcKZIaev4Py8IqFJVXdnMxrqGWnt8bWxQkQaKLwZGtw3a8BVbgChixGNvdiZXd3EmK16xpNHhhGV75VVx6EBgEU7lfsv/2bAy/1KCUt79vLXB3awoex9+Yeof3fxNpldVNHb9x5XwxykRP1AXVkB6SSDrRovgtjqmCYN/97KMXwfLx6xD1OtIfztfIYQHd5WpU8ddLf2ObSsdzM8bTbcEuD9TUwwSeLYgRLzL4LjboRqR1bCtJ60VQge6Tpj8n0lMAnGnhvZoszQfO1YreHAeLeDMMmG+eCYx0RzLmwsac5jGB3OjcHde3NpxsCtX4Xcb91G3e+ZT1R1CaFA+en8rNqOdfWIJljyiIa5yC9ddt/DzruPQdoCBKLdcEhrUPTlzY74rnaR4VMuha19nG6PW+FqkqtFTuuaLTrtzdpldVv+o=" matrix: fast_finish: true include: - - php: 5.5 + - php: 5.6 env: - - EXECUTE_CS_CHECK=true + - DEPS=lowest - php: 5.6 env: - - EXECUTE_TEST_COVERALLS=true + - DEPS=locked + - TEST_COVERAGE=true - DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)" - PATH="$HOME/.local/bin:$PATH" + - php: 5.6 + env: + - DEPS=latest + - php: 7 + env: + - DEPS=lowest + - php: 7 + env: + - DEPS=locked + - CS_CHECK=true - php: 7 + env: + - DEPS=latest + - php: hhvm + env: + - DEPS=lowest - php: hhvm + env: + - DEPS=locked + - php: hhvm + env: + - DEPS=latest allow_failures: - php: hhvm @@ -42,21 +64,24 @@ notifications: email: false before_install: - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - - composer self-update - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi + - travis_retry composer self-update + - if [[ $TRAVIS_PHP_VERSION != "hhvm" && $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini ; fi install: - - travis_retry composer install --no-interaction --ignore-platform-reqs + - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi + - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS satooshi/php-coveralls:^1.0 ; fi + - travis_retry composer install $COMPOSER_ARGS + - composer show script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi - - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi - - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi + - if [[ $TEST_COVERAGE != 'true' ]]; then ./vendor/bin/phpunit ; fi + - if [[ $CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs ; fi - if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi after_success: - if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi after_script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then ./vendor/bin/coveralls ; fi diff --git a/composer.json b/composer.json index 0343f2ac..378088cf 100644 --- a/composer.json +++ b/composer.json @@ -14,13 +14,13 @@ } }, "require": { - "php": "^5.5 || ^7.0", + "php": "^5.6 || ^7.0", "zendframework/zend-stdlib": "^2.5 || ^3.0", - "zendframework/zend-code": "^2.5" + "zendframework/zend-code": "^2.5 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "^1.7.0", - "phpunit/PHPUnit": "^4.0" + "phpunit/phpUnit": "^4.8", + "squizlabs/php_codesniffer": "^2.3.1" }, "autoload": { "psr-4": { @@ -30,6 +30,9 @@ "autoload-dev": { "psr-4": { "ZendTest\\Server\\": "test/" - } + }, + "files": [ + "test/TestAsset/reflectionTestFunction.php" + ] } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..c3173409 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1355 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "3df882c920dac6a817267fdb427bc683", + "content-hash": "40d432af69dc02ab455872e5fc9f995a", + "packages": [ + { + "name": "zendframework/zend-code", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-code.git", + "reference": "57cfbcf794a79985278d6308325bc86060af588c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-code/zipball/57cfbcf794a79985278d6308325bc86060af588c", + "reference": "57cfbcf794a79985278d6308325bc86060af588c", + "shasum": "" + }, + "require": { + "php": "^5.5 || 7.0.0 - 7.0.4 || ^7.0.6", + "zendframework/zend-eventmanager": "^2.6 || ^3.0" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "ext-phar": "*", + "phpunit/phpunit": "^4.8.21", + "squizlabs/php_codesniffer": "^2.5", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "suggest": { + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", + "zendframework/zend-stdlib": "Zend\\Stdlib component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides facilities to generate arbitrary code using an object oriented interface", + "homepage": "https://github.com/zendframework/zend-code", + "keywords": [ + "code", + "zf2" + ], + "time": "2016-04-20 17:34:49" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/5c80bdee0e952be112dcec0968bad770082c3a6e", + "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "event", + "eventmanager", + "events", + "zf2" + ], + "time": "2016-02-18 20:53:00" + }, + { + "name": "zendframework/zend-stdlib", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "8bafa58574204bdff03c275d1d618aaa601588ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/8bafa58574204bdff03c275d1d618aaa601588ae", + "reference": "8bafa58574204bdff03c275d1d618aaa601588ae", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "~0.1", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-stdlib", + "keywords": [ + "stdlib", + "zf2" + ], + "time": "2016-04-12 21:19:36" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", + "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-06-10 09:48:41" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", + "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-06-10 07:14:17" + }, + { + "name": "phpspec/prophecy", + "version": "v1.6.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-06-07 08:13:47" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06 15:47:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12 18:03:57" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.26", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74", + "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2016-05-17 03:09:28" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02 06:51:40" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-05-17 03:18:57" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17 09:04:28" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.6.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2016-05-30 22:24:32" + }, + { + "name": "symfony/yaml", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c5a7e7fc273c758b92b85dcb9c46149ccda89623", + "reference": "c5a7e7fc273c758b92b85dcb9c46149ccda89623", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-06-14 11:18:07" + }, + { + "name": "webmozart/assert", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2015-08-24 13:29:44" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.6 || ^7.0" + }, + "platform-dev": [] +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 00000000..25a3ac67 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,24 @@ + + + Zend Framework coding standard + + + + + + + + + + + + + + + + src + test + */TestAsset/* + */_files/* + */compatibility/* + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 609a829e..973aaafa 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ diff --git a/src/AbstractServer.php b/src/AbstractServer.php index 33ff1074..f14e8178 100644 --- a/src/AbstractServer.php +++ b/src/AbstractServer.php @@ -53,11 +53,14 @@ public function getFunctions() /** * Build callback for method signature * + * @deprecated Since 2.7.0; method will have private visibility starting in 3.0. * @param Reflection\AbstractFunction $reflection * @return Method\Callback */ + // @codingStandardsIgnoreStart protected function _buildCallback(Reflection\AbstractFunction $reflection) { + // @codingStandardsIgnoreEnd $callback = new Method\Callback(); if ($reflection instanceof Reflection\ReflectionMethod) { $callback->setType($reflection->isStatic() ? 'static' : 'instance') @@ -73,13 +76,17 @@ protected function _buildCallback(Reflection\AbstractFunction $reflection) /** * Build a method signature * + * @deprecated Since 2.7.0; method will be renamed to remove underscore + * prefix in 3.0. * @param Reflection\AbstractFunction $reflection * @param null|string|object $class * @return Method\Definition * @throws Exception\RuntimeException on duplicate entry */ + // @codingStandardsIgnoreStart protected function _buildSignature(Reflection\AbstractFunction $reflection, $class = null) { + // @codingStandardsIgnoreEnd $ns = $reflection->getNamespace(); $name = $reflection->getName(); $method = empty($ns) ? $name : $ns . '.' . $name; @@ -120,12 +127,16 @@ protected function _buildSignature(Reflection\AbstractFunction $reflection, $cla /** * Dispatch method * + * @deprecated Since 2.7.0; method will be renamed to remove underscore + * prefix in 3.0. * @param Method\Definition $invokable * @param array $params * @return mixed */ + // @codingStandardsIgnoreStart protected function _dispatch(Method\Definition $invokable, array $params) { + // @codingStandardsIgnoreEnd $callback = $invokable->getCallback(); $type = $callback->getType(); @@ -154,11 +165,15 @@ protected function _dispatch(Method\Definition $invokable, array $params) return call_user_func_array([$object, $method], $params); } + // @codingStandardsIgnoreStart /** * Map PHP type to protocol type * + * @deprecated Since 2.7.0; method will be renamed to remove underscore + * prefix in 3.0. * @param string $type * @return string */ abstract protected function _fixType($type); + // @codingStandardsIgnoreEnd } diff --git a/src/Method/Callback.php b/src/Method/Callback.php index a16c8e7a..0b6152f2 100644 --- a/src/Method/Callback.php +++ b/src/Method/Callback.php @@ -150,7 +150,11 @@ public function getMethod() public function setType($type) { if (!in_array($type, $this->types)) { - throw new Server\Exception\InvalidArgumentException('Invalid method callback type "' . $type . '" passed to ' . __CLASS__ . '::' . __METHOD__); + throw new Server\Exception\InvalidArgumentException(sprintf( + 'Invalid method callback type "%s" passed to %s', + $type, + __METHOD__ + )); } $this->type = $type; return $this; diff --git a/src/Method/Definition.php b/src/Method/Definition.php index 105db729..e6bafd2d 100644 --- a/src/Method/Definition.php +++ b/src/Method/Definition.php @@ -212,7 +212,10 @@ public function getMethodHelp() public function setObject($object) { if (!is_object($object) && (null !== $object)) { - throw new Server\Exception\InvalidArgumentException('Invalid object passed to ' . __CLASS__ . '::' . __METHOD__); + throw new Server\Exception\InvalidArgumentException(sprintf( + 'Invalid object passed to %s', + __METHOD__ + )); } $this->object = $object; return $this; diff --git a/src/Reflection/AbstractFunction.php b/src/Reflection/AbstractFunction.php index 9bea2db3..33b1e938 100644 --- a/src/Reflection/AbstractFunction.php +++ b/src/Reflection/AbstractFunction.php @@ -213,7 +213,11 @@ protected function buildSignatures($return, $returnDesc, $paramTypes, $paramDesc $return = new ReflectionReturnValue(array_shift($signature), $this->returnDesc); $tmp = []; foreach ($signature as $key => $type) { - $param = new ReflectionParameter($params[$key], $type, (isset($this->paramDesc[$key]) ? $this->paramDesc[$key] : null)); + $param = new ReflectionParameter( + $params[$key], + $type, + (isset($this->paramDesc[$key]) ? $this->paramDesc[$key] : null) + ); $param->setPosition($key); $tmp[] = $param; } diff --git a/src/Reflection/ReflectionMethod.php b/src/Reflection/ReflectionMethod.php index 969dd9c5..20fb32a6 100644 --- a/src/Reflection/ReflectionMethod.php +++ b/src/Reflection/ReflectionMethod.php @@ -85,7 +85,11 @@ public function getDeclaringClass() */ public function __wakeup() { - $this->classReflection = new ReflectionClass(new \ReflectionClass($this->class), $this->getNamespace(), $this->getInvokeArguments()); + $this->classReflection = new ReflectionClass( + new \ReflectionClass($this->class), + $this->getNamespace(), + $this->getInvokeArguments() + ); $this->reflection = new \ReflectionMethod($this->classReflection->getName(), $this->getName()); } diff --git a/test/Reflection/NodeTest.php b/test/Reflection/NodeTest.php index 5b5c285e..36b6c864 100644 --- a/test/Reflection/NodeTest.php +++ b/test/Reflection/NodeTest.php @@ -21,7 +21,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase /** * __construct() test */ - public function test__construct() + public function testConstructor() { $node = new Node('string'); $this->assertInstanceOf('Zend\Server\Reflection\Node', $node); @@ -173,6 +173,10 @@ public function testGetEndPoints() 'child2grand2great2' ]; - $this->assertEquals($test, $endPointsArray, 'Test was [' . var_export($test, 1) . ']; endPoints were [' . var_export($endPointsArray, 1) . ']'); + $this->assertEquals( + $test, + $endPointsArray, + 'Test was [' . var_export($test, 1) . ']; endPoints were [' . var_export($endPointsArray, 1) . ']' + ); } } diff --git a/test/Reflection/PrototypeTest.php b/test/Reflection/PrototypeTest.php index 95bceeed..b73e0eaf 100644 --- a/test/Reflection/PrototypeTest.php +++ b/test/Reflection/PrototypeTest.php @@ -22,19 +22,19 @@ class PrototypeTest extends \PHPUnit_Framework_TestCase * \Zend\Server\Reflection\Prototype object * @var \Zend\Server\Reflection\Prototype */ - protected $_r; + protected $r; /** * Array of ReflectionParameters * @var array */ - protected $_parametersRaw; + protected $parametersRaw; /** * Array of \Zend\Server\Reflection\Parameters * @var array */ - protected $_parameters; + protected $parameters; /** * Setup environment @@ -44,15 +44,15 @@ public function setUp() $class = new \ReflectionClass('\Zend\Server\Reflection'); $method = $class->getMethod('reflectClass'); $parameters = $method->getParameters(); - $this->_parametersRaw = $parameters; + $this->parametersRaw = $parameters; $fParameters = []; foreach ($parameters as $p) { $fParameters[] = new Reflection\ReflectionParameter($p); } - $this->_parameters = $fParameters; + $this->parameters = $fParameters; - $this->_r = new Reflection\Prototype(new Reflection\ReflectionReturnValue('void', 'No return')); + $this->r = new Reflection\Prototype(new Reflection\ReflectionReturnValue('void', 'No return')); } /** @@ -60,9 +60,9 @@ public function setUp() */ public function tearDown() { - unset($this->_r); - unset($this->_parameters); - unset($this->_parametersRaw); + unset($this->r); + unset($this->parameters); + unset($this->parametersRaw); } /** @@ -78,13 +78,16 @@ public function tearDown() */ public function testConstructWorks() { - $this->assertInstanceOf('Zend\Server\Reflection\Prototype', $this->_r); + $this->assertInstanceOf('Zend\Server\Reflection\Prototype', $this->r); } public function testConstructionThrowsExceptionOnInvalidParam() { - $this->setExpectedException('Zend\Server\Reflection\Exception\InvalidArgumentException', 'One or more params are invalid'); - $r1 = new Reflection\Prototype($this->_r->getReturnValue(), $this->_parametersRaw); + $this->setExpectedException( + 'Zend\Server\Reflection\Exception\InvalidArgumentException', + 'One or more params are invalid' + ); + $r1 = new Reflection\Prototype($this->r->getReturnValue(), $this->parametersRaw); } /** @@ -96,7 +99,7 @@ public function testConstructionThrowsExceptionOnInvalidParam() */ public function testGetReturnType() { - $this->assertEquals('void', $this->_r->getReturnType()); + $this->assertEquals('void', $this->r->getReturnType()); } /** @@ -108,7 +111,7 @@ public function testGetReturnType() */ public function testGetReturnValue() { - $this->assertInstanceOf('Zend\Server\Reflection\ReflectionReturnValue', $this->_r->getReturnValue()); + $this->assertInstanceOf('Zend\Server\Reflection\ReflectionReturnValue', $this->r->getReturnValue()); } /** @@ -120,7 +123,7 @@ public function testGetReturnValue() */ public function testGetParameters() { - $r = new Reflection\Prototype($this->_r->getReturnValue(), $this->_parameters); + $r = new Reflection\Prototype($this->r->getReturnValue(), $this->parameters); $p = $r->getParameters(); $this->assertInternalType('array', $p); @@ -128,6 +131,6 @@ public function testGetParameters() $this->assertInstanceOf('Zend\Server\Reflection\ReflectionParameter', $parameter); } - $this->assertEquals($this->_parameters, $p); + $this->assertEquals($this->parameters, $p); } } diff --git a/test/Reflection/ReflectionClassTest.php b/test/Reflection/ReflectionClassTest.php index 5981cca8..4db4ba11 100644 --- a/test/Reflection/ReflectionClassTest.php +++ b/test/Reflection/ReflectionClassTest.php @@ -30,7 +30,7 @@ class ReflectionClassTest extends \PHPUnit_Framework_TestCase * * Returns: void */ - public function test__construct() + public function testConstructor() { $r = new Reflection\ReflectionClass(new \ReflectionClass('\Zend\Server\Reflection')); $this->assertInstanceOf('Zend\Server\Reflection\ReflectionClass', $r); @@ -57,7 +57,7 @@ public function test__construct() * * Returns: mixed */ - public function test__call() + public function testMethodOverloading() { $r = new Reflection\ReflectionClass(new \ReflectionClass('\Zend\Server\Reflection')); $this->assertInternalType('string', $r->getName()); @@ -110,7 +110,7 @@ public function testGetNamespace() * * Returns: void */ - public function test__wakeup() + public function testClassWakeup() { $r = new Reflection\ReflectionClass(new \ReflectionClass('\Zend\Server\Reflection')); $s = serialize($r); diff --git a/test/Reflection/ReflectionFunctionTest.php b/test/Reflection/ReflectionFunctionTest.php index a0364d94..a92740a1 100644 --- a/test/Reflection/ReflectionFunctionTest.php +++ b/test/Reflection/ReflectionFunctionTest.php @@ -16,7 +16,7 @@ */ class ReflectionFunctionTest extends \PHPUnit_Framework_TestCase { - public function test__construct() + public function testConstructor() { $function = new \ReflectionFunction('\ZendTest\Server\Reflection\function1'); $r = new Reflection\ReflectionFunction($function); @@ -37,7 +37,7 @@ public function test__construct() $this->assertNotEmpty($prototypes); } - public function test__getSet() + public function testPropertyOverloading() { $function = new \ReflectionFunction('\ZendTest\Server\Reflection\function1'); $r = new Reflection\ReflectionFunction($function); @@ -109,7 +109,7 @@ public function testGetInvokeArguments() $this->assertEquals($argv, $args); } - public function test__wakeup() + public function testClassWakeup() { $function = new \ReflectionFunction('\ZendTest\Server\Reflection\function1'); $r = new Reflection\ReflectionFunction($function); diff --git a/test/Reflection/ReflectionMethodTest.php b/test/Reflection/ReflectionMethodTest.php index 76b4d438..9e3e534b 100644 --- a/test/Reflection/ReflectionMethodTest.php +++ b/test/Reflection/ReflectionMethodTest.php @@ -11,67 +11,17 @@ use Zend\Server\Reflection; -/** - * Interface ReflectionMethodInterface - */ -interface ReflectionMethodInterface -{ - /** - * Test method - * - * @param ReflectionMethodTest $reflectionMethodTest Reflection method - * @param array $anything Some array information - */ - public function testMethod(ReflectionMethodTest $reflectionMethodTest, array $anything); -} - -/** - * Class ReflectionMethodTestInstance - * for testing only - */ -class ReflectionMethodTestInstance implements ReflectionMethodInterface -{ - - /** - * {@inheritdoc} - */ - public function testMethod(ReflectionMethodTest $reflectionMethodTest, array $anything) - { - // it doesn`t matter - } -} - -/** - * Class ReflectionMethodNode - * for testing only - */ -class ReflectionMethodNode extends Reflection\Node -{ - /** - * {@inheritdoc} - */ - public function setParent(Reflection\Node $node, $new = false) - { - // it doesn`t matter - } -} - -/** - * Test case for \Zend\Server\Reflection\ReflectionMethod - * - * @group Zend_Server - */ class ReflectionMethodTest extends \PHPUnit_Framework_TestCase { - protected $_classRaw; - protected $_class; - protected $_method; + protected $classRaw; + protected $class; + protected $method; protected function setUp() { - $this->_classRaw = new \ReflectionClass('\Zend\Server\Reflection'); - $this->_method = $this->_classRaw->getMethod('reflectClass'); - $this->_class = new Reflection\ReflectionClass($this->_classRaw); + $this->classRaw = new \ReflectionClass('\Zend\Server\Reflection'); + $this->method = $this->classRaw->getMethod('reflectClass'); + $this->class = new Reflection\ReflectionClass($this->classRaw); } /** @@ -87,13 +37,13 @@ protected function setUp() * * Returns: void */ - public function test__construct() + public function testConstructor() { - $r = new Reflection\ReflectionMethod($this->_class, $this->_method); + $r = new Reflection\ReflectionMethod($this->class, $this->method); $this->assertInstanceOf('Zend\Server\Reflection\ReflectionMethod', $r); $this->assertInstanceOf('Zend\Server\Reflection\AbstractFunction', $r); - $r = new Reflection\ReflectionMethod($this->_class, $this->_method, 'namespace'); + $r = new Reflection\ReflectionMethod($this->class, $this->method, 'namespace'); $this->assertEquals('namespace', $r->getNamespace()); } @@ -106,12 +56,12 @@ public function test__construct() */ public function testGetDeclaringClass() { - $r = new Reflection\ReflectionMethod($this->_class, $this->_method); + $r = new Reflection\ReflectionMethod($this->class, $this->method); $class = $r->getDeclaringClass(); $this->assertInstanceOf('Zend\Server\Reflection\ReflectionClass', $class); - $this->assertEquals($this->_class, $class); + $this->assertEquals($this->class, $class); } /** @@ -121,9 +71,9 @@ public function testGetDeclaringClass() * * Returns: void */ - public function test__wakeup() + public function testClassWakeup() { - $r = new Reflection\ReflectionMethod($this->_class, $this->_method); + $r = new Reflection\ReflectionMethod($this->class, $this->method); $s = serialize($r); $u = unserialize($s); @@ -138,10 +88,13 @@ public function test__wakeup() */ public function testMethodDocBlockFromInterface() { - $reflectionClass = new \ReflectionClass('ZendTest\Server\Reflection\ReflectionMethodTestInstance'); + $reflectionClass = new \ReflectionClass(TestAsset\ReflectionMethodTestInstance::class); $reflectionMethod = $reflectionClass->getMethod('testMethod'); - $zendReflectionMethod = new Reflection\ReflectionMethod(new Reflection\ReflectionClass($reflectionClass), $reflectionMethod); + $zendReflectionMethod = new Reflection\ReflectionMethod( + new Reflection\ReflectionClass($reflectionClass), + $reflectionMethod + ); list($prototype) = $zendReflectionMethod->getPrototypes(); list($first, $second) = $prototype->getParameters(); @@ -154,10 +107,13 @@ public function testMethodDocBlockFromInterface() */ public function testMethodDocBlockFromParent() { - $reflectionClass = new \ReflectionClass('ZendTest\Server\Reflection\ReflectionMethodNode'); + $reflectionClass = new \ReflectionClass(TestAsset\ReflectionMethodNode::class); $reflectionMethod = $reflectionClass->getMethod('setParent'); - $zendReflectionMethod = new Reflection\ReflectionMethod(new Reflection\ReflectionClass($reflectionClass), $reflectionMethod); + $zendReflectionMethod = new Reflection\ReflectionMethod( + new Reflection\ReflectionClass($reflectionClass), + $reflectionMethod + ); $prototypes = $zendReflectionMethod->getPrototypes(); list($first, $second) = $prototypes[1]->getParameters(); diff --git a/test/Reflection/ReflectionParameterTest.php b/test/Reflection/ReflectionParameterTest.php index 3d032a64..62033d47 100644 --- a/test/Reflection/ReflectionParameterTest.php +++ b/test/Reflection/ReflectionParameterTest.php @@ -18,7 +18,7 @@ */ class ReflectionParameterTest extends \PHPUnit_Framework_TestCase { - protected function _getParameter() + protected function getParameter() { $method = new \ReflectionMethod('\Zend\Server\Reflection\ReflectionParameter', 'setType'); $parameters = $method->getParameters(); @@ -37,9 +37,9 @@ protected function _getParameter() * * Returns: void */ - public function test__construct() + public function testConstructor() { - $parameter = $this->_getParameter(); + $parameter = $this->getParameter(); $reflection = new Reflection\ReflectionParameter($parameter); $this->assertInstanceOf('Zend\Server\Reflection\ReflectionParameter', $reflection); @@ -56,9 +56,9 @@ public function test__construct() * * Returns: mixed */ - public function test__call() + public function testMethodOverloading() { - $r = new Reflection\ReflectionParameter($this->_getParameter()); + $r = new Reflection\ReflectionParameter($this->getParameter()); // just test a few call proxies... $this->assertInternalType('bool', $r->allowsNull()); @@ -70,7 +70,7 @@ public function test__call() */ public function testGetSetType() { - $r = new Reflection\ReflectionParameter($this->_getParameter()); + $r = new Reflection\ReflectionParameter($this->getParameter()); $this->assertEquals('mixed', $r->getType()); $r->setType('string'); @@ -82,7 +82,7 @@ public function testGetSetType() */ public function testGetDescription() { - $r = new Reflection\ReflectionParameter($this->_getParameter()); + $r = new Reflection\ReflectionParameter($this->getParameter()); $this->assertEquals('', $r->getDescription()); $r->setDescription('parameter description'); @@ -94,7 +94,7 @@ public function testGetDescription() */ public function testSetPosition() { - $r = new Reflection\ReflectionParameter($this->_getParameter()); + $r = new Reflection\ReflectionParameter($this->getParameter()); $this->assertEquals(null, $r->getPosition()); $r->setPosition(3); diff --git a/test/Reflection/ReflectionReturnValueTest.php b/test/Reflection/ReflectionReturnValueTest.php index c7c4a4ff..4f25c013 100644 --- a/test/Reflection/ReflectionReturnValueTest.php +++ b/test/Reflection/ReflectionReturnValueTest.php @@ -29,7 +29,7 @@ class ReflectionReturnValueTest extends \PHPUnit_Framework_TestCase * * Returns: void */ - public function test__construct() + public function testConstructor() { $obj = new Reflection\ReflectionReturnValue(); $this->assertInstanceOf('Zend\Server\Reflection\ReflectionReturnValue', $obj); diff --git a/test/Reflection/TestAsset/ReflectionMethodInterface.php b/test/Reflection/TestAsset/ReflectionMethodInterface.php new file mode 100644 index 00000000..ab00b926 --- /dev/null +++ b/test/Reflection/TestAsset/ReflectionMethodInterface.php @@ -0,0 +1,21 @@ +assertInstanceOf('Zend\Server\Reflection\ReflectionClass', $reflection); - $reflection = Reflection::reflectClass(new ReflectionTestClass()); + $reflection = Reflection::reflectClass(new TestAsset\ReflectionTestClass()); $this->assertInstanceOf('Zend\Server\Reflection\ReflectionClass', $reflection); } public function testReflectClassThrowsExceptionOnInvalidClass() { - $this->setExpectedException('Zend\Server\Reflection\Exception\InvalidArgumentException', 'Invalid argv argument passed to reflectClass'); - $reflection = Reflection::reflectClass('ZendTest\Server\ReflectionTestClass', 'string'); + $this->setExpectedException( + Reflection\Exception\InvalidArgumentException::class, + 'Invalid argv argument passed to reflectClass' + ); + $reflection = Reflection::reflectClass(TestAsset\ReflectionTestClass::class, 'string'); } public function testReflectClassThrowsExceptionOnInvalidParameter() { - $this->setExpectedException('Zend\Server\Reflection\Exception\InvalidArgumentException', 'Invalid class or object passed to attachClass'); + $this->setExpectedException( + Reflection\Exception\InvalidArgumentException::class, + 'Invalid class or object passed to attachClass' + ); $reflection = Reflection::reflectClass(false); } @@ -45,7 +51,7 @@ public function testReflectClassThrowsExceptionOnInvalidParameter() */ public function testReflectClass2() { - $reflection = Reflection::reflectClass('ZendTest\Server\ReflectionTestClass', false, 'zsr'); + $reflection = Reflection::reflectClass(TestAsset\ReflectionTestClass::class, false, 'zsr'); $this->assertEquals('zsr', $reflection->getNamespace()); } @@ -54,14 +60,14 @@ public function testReflectClass2() */ public function testReflectFunction() { - $reflection = Reflection::reflectFunction('ZendTest\Server\reflectionTestFunction'); + $reflection = Reflection::reflectFunction('ZendTest\Server\TestAsset\reflectionTestFunction'); $this->assertInstanceOf('Zend\Server\Reflection\ReflectionFunction', $reflection); } public function testReflectFunctionThrowsExceptionOnInvalidFunction() { $this->setExpectedException('Zend\Server\Reflection\Exception\InvalidArgumentException', 'Invalid function'); - $reflection = Reflection::reflectFunction('ZendTest\Server\ReflectionTestClass', 'string'); + $reflection = Reflection::reflectFunction(TestAsset\ReflectionTestClass::class, 'string'); } public function testReflectFunctionThrowsExceptionOnInvalidParam() @@ -75,74 +81,7 @@ public function testReflectFunctionThrowsExceptionOnInvalidParam() */ public function testReflectFunction2() { - $reflection = Reflection::reflectFunction('ZendTest\Server\reflectionTestFunction', false, 'zsr'); + $reflection = Reflection::reflectFunction('ZendTest\Server\TestAsset\reflectionTestFunction', false, 'zsr'); $this->assertEquals('zsr', $reflection->getNamespace()); } } - -/** - * \ZendTest\Server\reflectionTestClass - * - * Used to test reflectFunction generation of signatures - * - * @param bool $arg1 - * @param string|array $arg2 - * @param string $arg3 Optional argument - * @param string|struct|false $arg4 Optional argument - * @return bool|array - */ -function reflectionTestFunction($arg1, $arg2, $arg3 = 'string', $arg4 = 'array') -{ -} - -/** - * \ZendTest\Server\ReflectionTestClass -- test class reflection - */ -class ReflectionTestClass -{ - /** - * Constructor - * - * This shouldn't be reflected - * - * @param mixed $arg - */ - public function __construct($arg = null) - { - } - - /** - * Public one - * - * @param string $arg1 - * @param array $arg2 - * @return string - */ - public function one($arg1, $arg2 = null) - { - } - - /** - * Protected _one - * - * Should not be reflected - * - * @param string $arg1 - * @param array $arg2 - * @return string - */ - protected function _one($arg1, $arg2 = null) - { - } - - /** - * Public two - * - * @param string $arg1 - * @param string $arg2 - * @return bool|array - */ - public static function two($arg1, $arg2) - { - } -} diff --git a/test/TestAsset/ReflectionTestClass.php b/test/TestAsset/ReflectionTestClass.php new file mode 100644 index 00000000..64a32864 --- /dev/null +++ b/test/TestAsset/ReflectionTestClass.php @@ -0,0 +1,60 @@ +