diff --git a/.coveralls.yml b/.coveralls.yml index 53bda829c..bc71b62f8 100644 --- a/.coveralls.yml +++ b/.coveralls.yml @@ -1,3 +1,2 @@ coverage_clover: clover.xml json_path: coveralls-upload.json -src_dir: src diff --git a/.gitattributes b/.gitattributes index 7325c6902..5ad1a226f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,12 @@ -/test export-ignore -/vendor export-ignore -.coveralls.yml export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.travis.yml export-ignore -.php_cs export-ignore -phpunit.xml.dist export-ignore +/.coveralls.yml export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.travis.yml export-ignore +/benchmark/ export-ignore +/composer.lock export-ignore +/docs/ export-ignore +/mkdocs.yml export-ignore +/phpbench.json export-ignore +/phpcs.xml export-ignore +/phpunit.xml.dist export-ignore +/test/ export-ignore diff --git a/.gitignore b/.gitignore index f146c8613..245087af8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,7 @@ -.buildpath -.DS_Store -.idea -.project -.settings/ -.*.sw* -.*.un~ -nbproject -doc/html/ -tmp/ -zf-mkdoc-theme/ - -clover.xml -composer.lock -coveralls-upload.json -phpunit.xml -vendor +/clover.xml +/coveralls-upload.json +/docs/html/ +/phpunit.xml +/vendor/ +/zf-mkdoc-theme.tgz +/zf-mkdoc-theme/ diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 8f4dd5aac..000000000 --- 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 7edfb983e..fd41f105d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,61 +2,86 @@ sudo: false language: php -branches: - except: - - /^release-.*$/ - - /^ghgfk-.*$/ - cache: directories: - $HOME/.composer/cache - - $HOME/.local - - zf-mkdoc-theme env: global: - - SITE_URL: https://zendframework.github.io/zend-stdlib - - GH_USER_NAME: "Matthew Weier O'Phinney" - - GH_USER_EMAIL: matthew@weierophinney.net - - GH_REF: github.com/zendframework/zend-stdlib.git - - secure: "l+YU9Igd9IUA60PE+iC4AZt2hHY9hpsSB7S2jck9fjPm0+15UCGk2G1qg5hCi+FlPslXhk6wOLLDPc40BiCrwH+m5CP9cIdkGTuNc9rVF9S5IiRLkOVxeTcdE+JRm7hZ2NBgxEiTuBLs5RlN39o41zPDFllgnJv69UmmUIMHuG3NwJJiRE9NA2EMIhZwx3UT/Zqq94MzAbYXi2xspoQ53Z/rfvVSJK6tdARp31q4NWvlYsc2YVcEWv+j3VY5luMSCMVQVNBIuXdd0hYpGt2o3H6S9azzcKRQB7saoAT/tiAEj5121tv3j3cKNQQMzI4xv7RrtQEiAhumeU3AsVDyqBmqqUQNwpnWH0RZdRry4jUKJgx0TK0yZH8ewdz6DhktBqS+c2a/FzfO3yc+LeuIy3i73NezNwCgwviOBYbWPAo4LqKtJ7gdTbVVdJaUeCtKTZ1b1k4MtaxjZjz0IK5+rxJsZ1DQF5fhJIzkjXqEEON2mHQu/qE+I7ow4Jvfs0T+KYJW6Yf5qFzBkrTUNjV60rmawaEjgxgMvtwN+MvcQ/X2OWkdjdzqzQIDdjssdRu9IBPU/G2uqzS8POL9o1j8H3NE430Tsbg+jiENlqmU+ra5wuRrmTBToli1kpgl9LyhgvjGokxAB+mwwKv7FiIQtBmSgEvsD112eSYl3HVWpdE=" + - COMPOSER_ARGS="--no-interaction" + - COVERAGE_DEPS="php-coveralls/php-coveralls" matrix: - fast_finish: true include: - - php: 5.5 + - php: 5.6 + env: + - DEPS=lowest + - php: 5.6 env: - - EXECUTE_CS_CHECK=true + - DEPS=locked + - LEGACY_DEPS="phpbench/phpbench phpunit/phpunit" - php: 5.6 env: - - EXECUTE_TEST_COVERALLS=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" + - DEPS=latest - php: 7 - - php: hhvm - allow_failures: - - php: hhvm - -notifications: - irc: "irc.freenode.org#zftalk.dev" - email: false + env: + - DEPS=lowest + - php: 7 + env: + - DEPS=locked + - LEGACY_DEPS="phpbench/phpbench phpunit/phpunit" + - php: 7 + env: + - DEPS=latest + - php: 7.1 + env: + - DEPS=lowest + - php: 7.1 + env: + - DEPS=locked + - CS_CHECK=true + - BENCHMARKS=true + - TEST_COVERAGE=true + - php: 7.1 + env: + - DEPS=latest + - php: 7.2 + env: + - DEPS=lowest + - php: 7.2 + env: + - DEPS=locked + - php: 7.2 + env: + - DEPS=latest + - php: 7.3 + env: + - DEPS=lowest + - php: 7.3 + env: + - DEPS=locked + - php: 7.3 + env: + - DEPS=latest 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 + - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi install: - - travis_retry composer install --no-interaction --ignore-platform-reqs + - travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs + - if [[ $LEGACY_DEPS != '' ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi + - 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 $COVERAGE_DEPS ; fi + - stty cols 120 && 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 [[ $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 + - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi + - if [[ $BENCHMARKS == 'true' ]]; then vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate ; fi + - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi after_script: - - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry php vendor/bin/php-coveralls -v ; fi + +notifications: + email: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 65177990d..45c94f66e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,127 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## 3.2.2 - TBD + +### Added + +- [#96](https://github.com/zendframework/zend-stdlib/pull/96) Added PHP 7.3 support + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + +## 3.2.1 - 2018-08-28 + +### Added + +- Nothing. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#92](https://github.com/zendframework/zend-stdlib/pull/92) fixes serialization of `SplPriorityQueue` by ensuring its `$serial` + property is also serialized. + +- [#91](https://github.com/zendframework/zend-stdlib/pull/91) fixes behavior in the `ArrayObject` implementation that was not + compatible with PHP 7.3. + +## 3.2.0 - 2018-04-30 + +### Added + +- [#87](https://github.com/zendframework/zend-stdlib/pull/87) adds support for PHP 7.2. + +### Changed + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- [#87](https://github.com/zendframework/zend-stdlib/pull/87) removes support for HHVM. + +### Fixed + +- Nothing. + +## 3.1.1 - 2018-04-12 + +### Added + +- Nothing. + +### Changed + +- [#67](https://github.com/zendframework/zend-stdlib/pull/67) changes the typehint of the `$content` property + of the `Message` class to indicate it is a string. All known implementations + already assumed this. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#60](https://github.com/zendframework/zend-stdlib/pull/60) fixes an issue whereby calling `remove()` would + incorrectly re-calculate the maximum priority stored in the queue. + +- [#60](https://github.com/zendframework/zend-stdlib/pull/60) fixes an infinite loop condition that can occur when + inserting an item at 0 priority. + +## 3.1.0 - 2016-09-13 + +### Added + +- [#63](https://github.com/zendframework/zend-stdlib/pull/63) adds a new + `Zend\Stdlib\ConsoleHelper` class, providing minimal support for writing + output to `STDOUT` and `STDERR`, with optional colorization, when the console + supports that feature. + +### Deprecated + +- [#38](https://github.com/zendframework/zend-stdlib/pull/38) deprecates + `Zend\Stdlib\JsonSerializable`, as all supported version of PHP now support + it. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + ## 3.0.1 - 2016-04-12 ### Added diff --git a/LICENSE.md b/LICENSE.md index dbb1b49c0..d44ab5dc7 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,16 +1,15 @@ -Copyright (c) 2005-2015, Zend Technologies USA, Inc. - +Copyright (c) 2005-2018, Zend Technologies USA, Inc. 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 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. +- 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 Zend Technologies USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this diff --git a/README.md b/README.md index f4ca9532d..67fe719cb 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,16 @@ # zend-stdlib +> ## Repository abandoned 2019-12-31 +> +> This repository has moved to [laminas/laminas-stdlib](https://github.com/laminas/laminas-stdlib). + [![Build Status](https://secure.travis-ci.org/zendframework/zend-stdlib.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-stdlib) -[![Coverage Status](https://coveralls.io/repos/zendframework/zend-stdlib/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-stdlib?branch=master) +[![Coverage Status](https://coveralls.io/repos/github/zendframework/zend-stdlib/badge.svg?branch=master)](https://coveralls.io/github/zendframework/zend-stdlib?branch=master) `Zend\Stdlib` is a set of components that implements general purpose utility class for different scopes like: - array utilities functions; -- json serializable interfaces; - general messaging systems; - string wrappers; - etc. @@ -15,4 +18,16 @@ class for different scopes like: --- - File issues at https://github.com/zendframework/zend-stdlib/issues -- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-stdlib +- Documentation is at https://docs.zendframework.com/zend-stdlib/ + +## Benchmarks + +We provide scripts for benchmarking zend-stdlib using the +[PHPBench](https://github.com/phpbench/phpbench) framework; these can be +found in the `benchmark/` directory. + +To execute the benchmarks you can run the following command: + +```bash +$ vendor/bin/phpbench run --report=aggregate +``` diff --git a/benchmark/ExtractPriorityQueue.php b/benchmark/ExtractPriorityQueueBench.php similarity index 71% rename from benchmark/ExtractPriorityQueue.php rename to benchmark/ExtractPriorityQueueBench.php index 8fa7527ab..5311a7bfd 100644 --- a/benchmark/ExtractPriorityQueue.php +++ b/benchmark/ExtractPriorityQueueBench.php @@ -9,14 +9,21 @@ namespace ZendBench\Stdlib; -use Athletic\AthleticEvent; +use PhpBench\Benchmark\Metadata\Annotations\Iterations; +use PhpBench\Benchmark\Metadata\Annotations\Revs; +use PhpBench\Benchmark\Metadata\Annotations\Warmup; use Zend\Stdlib\FastPriorityQueue; use Zend\Stdlib\PriorityQueue; use Zend\Stdlib\SplPriorityQueue; -class ExtractPriorityQueue extends AthleticEvent +/** + * @Revs(1000) + * @Iterations(10) + * @Warmup(2) + */ +class ExtractPriorityQueueBench { - public function classSetUp() + public function __construct() { $this->splPriorityQueue = new SplPriorityQueue(); $this->fastPriorityQueue = new FastPriorityQueue(); @@ -30,26 +37,17 @@ public function classSetUp() } } - /** - * @iterations 5000 - */ - public function extractSplPriorityQueue() + public function benchExtractSplPriorityQueue() { $this->splPriorityQueue->extract(); } - /** - * @iterations 5000 - */ - public function extractPriorityQueue() + public function benchExtractPriorityQueue() { $this->priorityQueue->extract(); } - /** - * @iterations 5000 - */ - public function extractFastPriorityQueue() + public function benchExtractFastPriorityQueue() { $this->fastPriorityQueue->extract(); } diff --git a/benchmark/InsertPriorityQueue.php b/benchmark/InsertPriorityQueueBench.php similarity index 66% rename from benchmark/InsertPriorityQueue.php rename to benchmark/InsertPriorityQueueBench.php index 561c53597..db2bf5af7 100644 --- a/benchmark/InsertPriorityQueue.php +++ b/benchmark/InsertPriorityQueueBench.php @@ -9,40 +9,38 @@ namespace ZendBench\Stdlib; -use Athletic\AthleticEvent; +use PhpBench\Benchmark\Metadata\Annotations\Iterations; +use PhpBench\Benchmark\Metadata\Annotations\Revs; +use PhpBench\Benchmark\Metadata\Annotations\Warmup; use Zend\Stdlib\FastPriorityQueue; use Zend\Stdlib\PriorityQueue; use Zend\Stdlib\SplPriorityQueue; -class InsertPriorityQueue extends AthleticEvent +/** + * @Revs(1000) + * @Iterations(10) + * @Warmup(2) + */ +class InsertPriorityQueueBench { - public function classSetUp() + public function __construct() { $this->splPriorityQueue = new SplPriorityQueue(); $this->fastPriorityQueue = new FastPriorityQueue(); $this->priorityQueue = new PriorityQueue(); } - /** - * @iterations 5000 - */ - public function insertSplPriorityQueue() + public function benchInsertSplPriorityQueue() { $this->splPriorityQueue->insert('foo', rand(1, 100)); } - /** - * @iterations 5000 - */ - public function insertPriorityQueue() + public function benchInsertPriorityQueue() { $this->priorityQueue->insert('foo', rand(1, 100)); } - /** - * @iterations 5000 - */ - public function insertFastPriorityQueue() + public function benchInsertFastPriorityQueue() { $this->fastPriorityQueue->insert('foo', rand(1, 100)); } diff --git a/benchmark/RemovePriorityQueue.php b/benchmark/RemovePriorityQueueBench.php similarity index 69% rename from benchmark/RemovePriorityQueue.php rename to benchmark/RemovePriorityQueueBench.php index 1cfd35b74..b7cbbb177 100644 --- a/benchmark/RemovePriorityQueue.php +++ b/benchmark/RemovePriorityQueueBench.php @@ -9,13 +9,20 @@ namespace ZendBench\Stdlib; -use Athletic\AthleticEvent; +use PhpBench\Benchmark\Metadata\Annotations\Iterations; +use PhpBench\Benchmark\Metadata\Annotations\Revs; +use PhpBench\Benchmark\Metadata\Annotations\Warmup; use Zend\Stdlib\FastPriorityQueue; use Zend\Stdlib\PriorityQueue; -class RemovePriorityQueue extends AthleticEvent +/** + * @Revs(1000) + * @Iterations(10) + * @Warmup(2) + */ +class RemovePriorityQueueBench { - public function classSetUp() + public function __construct() { $this->fastPriorityQueue = new FastPriorityQueue(); $this->priorityQueue = new PriorityQueue(); @@ -27,18 +34,12 @@ public function classSetUp() } } - /** - * @iterations 1000 - */ - public function removePriorityQueue() + public function benchRemovePriorityQueue() { $this->priorityQueue->remove('foo'); } - /** - * @iterations 1000 - */ - public function removeFastPriorityQueue() + public function benchRemoveFastPriorityQueue() { $this->fastPriorityQueue->remove('foo'); } diff --git a/composer.json b/composer.json index 46f6af007..8c9900963 100644 --- a/composer.json +++ b/composer.json @@ -1,29 +1,31 @@ { "name": "zendframework/zend-stdlib", - "description": " ", + "description": "SPL extensions, array utilities, error handlers, and more", "license": "BSD-3-Clause", "keywords": [ - "zf2", + "zf", + "zendframework", "stdlib" ], - "homepage": "https://github.com/zendframework/zend-stdlib", - "autoload": { - "psr-4": { - "Zend\\Stdlib\\": "src/" - } + "support": { + "docs": "https://docs.zendframework.com/zend-stdlib/", + "issues": "https://github.com/zendframework/zend-stdlib/issues", + "source": "https://github.com/zendframework/zend-stdlib", + "rss": "https://github.com/zendframework/zend-stdlib/releases.atom", + "slack": "https://zendframework-slack.herokuapp.com", + "forum": "https://discourse.zendframework.com/c/questions/components" }, "require": { - "php": "^5.5 || ^7.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/PHPUnit": "~4.0", - "athletic/athletic": "~0.1" + "phpbench/phpbench": "^0.13", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0" }, - "extra": { - "branch-alias": { - "dev-master": "3.0-dev", - "dev-develop": "3.1-dev" + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" } }, "autoload-dev": { @@ -31,5 +33,24 @@ "ZendTest\\Stdlib\\": "test/", "ZendBench\\Stdlib\\": "benchmark/" } + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev", + "dev-develop": "3.3.x-dev" + } + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..b3a094dcb --- /dev/null +++ b/composer.lock @@ -0,0 +1,2584 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "cfa5123334c27f017bbe73a34a88c572", + "packages": [], + "packages-dev": [ + { + "name": "beberlei/assert", + "version": "v2.9.4", + "source": { + "type": "git", + "url": "https://github.com/beberlei/assert.git", + "reference": "7c24bedba95c600bba7b6021185a7d7fa2deb961" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/beberlei/assert/zipball/7c24bedba95c600bba7b6021185a7d7fa2deb961", + "reference": "7c24bedba95c600bba7b6021185a7d7fa2deb961", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.1.1", + "phpunit/phpunit": "^4.8.35|^5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Assert\\": "lib/Assert" + }, + "files": [ + "lib/Assert/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de", + "role": "Lead Developer" + }, + { + "name": "Richard Quadling", + "email": "rquadling@gmail.com", + "role": "Collaborator" + } + ], + "description": "Thin assertion library for input validation in business models.", + "keywords": [ + "assert", + "assertion", + "validation" + ], + "time": "2018-04-09T14:40:28+00:00" + }, + { + "name": "doctrine/annotations", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-12-06T07:11:42+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.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": "2017-07-22T11:58:36+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "lstrojny/functional-php", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/lstrojny/functional-php.git", + "reference": "7c2091ddea572e012aa980e5d19d242d3a06ad5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lstrojny/functional-php/zipball/7c2091ddea572e012aa980e5d19d242d3a06ad5b", + "reference": "7c2091ddea572e012aa980e5d19d242d3a06ad5b", + "shasum": "" + }, + "require": { + "php": "~7" + }, + "require-dev": { + "phpunit/phpunit": "~6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Functional\\": "src/Functional" + }, + "files": [ + "src/Functional/Average.php", + "src/Functional/Capture.php", + "src/Functional/ConstFunction.php", + "src/Functional/CompareOn.php", + "src/Functional/CompareObjectHashOn.php", + "src/Functional/Compose.php", + "src/Functional/Concat.php", + "src/Functional/Contains.php", + "src/Functional/Curry.php", + "src/Functional/CurryN.php", + "src/Functional/Difference.php", + "src/Functional/DropFirst.php", + "src/Functional/DropLast.php", + "src/Functional/Each.php", + "src/Functional/Equal.php", + "src/Functional/ErrorToException.php", + "src/Functional/Every.php", + "src/Functional/False.php", + "src/Functional/Falsy.php", + "src/Functional/Filter.php", + "src/Functional/First.php", + "src/Functional/FirstIndexOf.php", + "src/Functional/FlatMap.php", + "src/Functional/Flatten.php", + "src/Functional/Flip.php", + "src/Functional/GreaterThan.php", + "src/Functional/GreaterThanOrEqual.php", + "src/Functional/Group.php", + "src/Functional/Head.php", + "src/Functional/Id.php", + "src/Functional/IfElse.php", + "src/Functional/Identical.php", + "src/Functional/IndexesOf.php", + "src/Functional/Intersperse.php", + "src/Functional/Invoke.php", + "src/Functional/InvokeFirst.php", + "src/Functional/InvokeIf.php", + "src/Functional/InvokeLast.php", + "src/Functional/Invoker.php", + "src/Functional/Last.php", + "src/Functional/LastIndexOf.php", + "src/Functional/LessThan.php", + "src/Functional/LessThanOrEqual.php", + "src/Functional/LexicographicCompare.php", + "src/Functional/Map.php", + "src/Functional/Match.php", + "src/Functional/Maximum.php", + "src/Functional/Memoize.php", + "src/Functional/Minimum.php", + "src/Functional/None.php", + "src/Functional/Not.php", + "src/Functional/PartialAny.php", + "src/Functional/PartialLeft.php", + "src/Functional/PartialMethod.php", + "src/Functional/PartialRight.php", + "src/Functional/Partition.php", + "src/Functional/Pick.php", + "src/Functional/Pluck.php", + "src/Functional/Poll.php", + "src/Functional/Product.php", + "src/Functional/Ratio.php", + "src/Functional/ReduceLeft.php", + "src/Functional/ReduceRight.php", + "src/Functional/Reindex.php", + "src/Functional/Reject.php", + "src/Functional/Retry.php", + "src/Functional/Select.php", + "src/Functional/SelectKeys.php", + "src/Functional/SequenceConstant.php", + "src/Functional/SequenceExponential.php", + "src/Functional/SequenceLinear.php", + "src/Functional/Some.php", + "src/Functional/Sort.php", + "src/Functional/Sum.php", + "src/Functional/SuppressError.php", + "src/Functional/Tap.php", + "src/Functional/Tail.php", + "src/Functional/TailRecursion.php", + "src/Functional/True.php", + "src/Functional/Truthy.php", + "src/Functional/Unique.php", + "src/Functional/With.php", + "src/Functional/Zip.php", + "src/Functional/ZipAll.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Strojny", + "email": "lstrojny@php.net", + "homepage": "http://usrportage.de" + }, + { + "name": "Max Beutel", + "email": "nash12@gmail.com" + } + ], + "description": "Functional primitives for PHP", + "keywords": [ + "functional" + ], + "time": "2018-01-03T10:08:50+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-10-19T19:58:43+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "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": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "phpbench/container", + "version": "1.2", + "source": { + "type": "git", + "url": "https://github.com/phpbench/container.git", + "reference": "c0e3cbf1cd8f867c70b029cb6d1b0b39fe6d409d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpbench/container/zipball/c0e3cbf1cd8f867c70b029cb6d1b0b39fe6d409d", + "reference": "c0e3cbf1cd8f867c70b029cb6d1b0b39fe6d409d", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpBench\\DependencyInjection\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Leech", + "email": "daniel@dantleech.com" + } + ], + "description": "Simple, configurable, service container.", + "time": "2018-02-12T08:08:59+00:00" + }, + { + "name": "phpbench/dom", + "version": "0.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpbench/dom.git", + "reference": "b135378dd0004c05ba5446aeddaf0b83339c1c4c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpbench/dom/zipball/b135378dd0004c05ba5446aeddaf0b83339c1c4c", + "reference": "b135378dd0004c05ba5446aeddaf0b83339c1c4c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": "^5.4|^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpBench\\Dom\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Leech", + "email": "daniel@dantleech.com" + } + ], + "description": "DOM wrapper to simplify working with the PHP DOM implementation", + "time": "2016-02-27T12:15:56+00:00" + }, + { + "name": "phpbench/phpbench", + "version": "0.13.0", + "source": { + "type": "git", + "url": "https://github.com/phpbench/phpbench.git", + "reference": "0dab4d0b6a699c27105d677398b2ea8046706292" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpbench/phpbench/zipball/0dab4d0b6a699c27105d677398b2ea8046706292", + "reference": "0dab4d0b6a699c27105d677398b2ea8046706292", + "shasum": "" + }, + "require": { + "beberlei/assert": "^2.4", + "doctrine/annotations": "^1.2.7", + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "lstrojny/functional-php": "1.0|^1.2.3", + "php": "^5.6|^7.0", + "phpbench/container": "~1.0", + "phpbench/dom": "~0.2.0", + "seld/jsonlint": "^1.0", + "symfony/console": "^2.4|^3.0", + "symfony/debug": "^2.4|^3.0", + "symfony/filesystem": "^2.4|^3.0", + "symfony/finder": "^2.4|^3.0", + "symfony/options-resolver": "^2.6|^3.0", + "symfony/process": "^2.1|^3.0" + }, + "require-dev": { + "doctrine/dbal": "^2.4", + "liip/rmt": "^1.2", + "padraic/phar-updater": "^1.0", + "phpunit/phpunit": "^4.6" + }, + "bin": [ + "bin/phpbench" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpBench\\": "lib/", + "PhpBench\\Extensions\\Dbal\\": "extensions/dbal/lib/", + "PhpBench\\Extensions\\XDebug\\": "extensions/xdebug/lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Leech", + "email": "daniel@dantleech.com" + } + ], + "description": "PHP Benchmarking Framework", + "time": "2016-11-20T22:04:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "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": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.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" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "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": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.7.5", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.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": "2018-02-19T10:16:54+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "774a82c0c5da4c1c7701790c262035d235ab7856" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/774a82c0c5da4c1c7701790c262035d235ab7856", + "reference": "774a82c0c5da4c1c7701790c262035d235ab7856", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.0-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": "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": "2018-04-06T15:39:20+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "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": "2017-11-27T13:52:08+00:00" + }, + { + "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-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-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": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2018-02-01T13:07:23+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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": "2018-02-01T13:16:43+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "6a17c170fb92845896e1b3b00fcb462cd4b3c017" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6a17c170fb92845896e1b3b00fcb462cd4b3c017", + "reference": "6a17c170fb92845896e1b3b00fcb462cd4b3c017", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.1", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "phpunit/phpunit-mock-objects": "^6.1", + "sebastian/comparator": "^2.1", + "sebastian/diff": "^3.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.1-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": "2018-04-10T11:40:22+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "6.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "70c740bde8fd9ea9ea295be1cd875dd7b267e157" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/70c740bde8fd9ea9ea295be1cd875dd7b267e157", + "reference": "70c740bde8fd9ea9ea295be1cd875dd7b267e157", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.1", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-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": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2018-04-11T04:50:36+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "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": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", + "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^2.0 || ^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1.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": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-02-01T13:46:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/e09160918c66281713f1c324c1f4c4c3037ba1e8", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-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", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2018-02-01T13:45:15+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.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": "2017-07-01T08:51:00+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.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": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.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": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "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": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.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": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "seld/jsonlint", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2018-01-24T12:46:19+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.9.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "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": "2017-05-22T02:43:20+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "d4bb70fa24d540c309d88a9d6e43fb2d339b1fbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/d4bb70fa24d540c309d88a9d6e43fb2d339b1fbf", + "reference": "d4bb70fa24d540c309d88a9d6e43fb2d339b1fbf", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "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 Console Component", + "homepage": "https://symfony.com", + "time": "2018-04-03T05:22:50+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "9cf7c2271cfb89ef9727db1b740ca77be57bf9d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/9cf7c2271cfb89ef9727db1b740ca77be57bf9d7", + "reference": "9cf7c2271cfb89ef9727db1b740ca77be57bf9d7", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "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 Debug Component", + "homepage": "https://symfony.com", + "time": "2018-04-03T05:22:50+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/253a4490b528597aa14d2bf5aeded6f5e5e4a541", + "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "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 Filesystem Component", + "homepage": "https://symfony.com", + "time": "2018-02-22T10:48:49+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/bd14efe8b1fabc4de82bf50dce62f05f9a102433", + "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "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 Finder Component", + "homepage": "https://symfony.com", + "time": "2018-04-04T05:07:11+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/f3109a6aedd20e35c3a33190e932c2b063b7b50e", + "reference": "f3109a6aedd20e35c3a33190e932c2b063b7b50e", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "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 OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2018-01-11T07:56:07+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30T19:27:44+00:00" + }, + { + "name": "symfony/process", + "version": "v3.4.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "4b7d64e852886319e93ddfdecff0d744ab87658b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/4b7d64e852886319e93ddfdecff0d744ab87658b", + "reference": "4b7d64e852886319e93ddfdecff0d744ab87658b", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "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 Process Component", + "homepage": "https://symfony.com", + "time": "2018-04-03T05:22:50+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-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": "2018-01-29T19:49:41+00:00" + }, + { + "name": "zendframework/zend-coding-standard", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-coding-standard.git", + "reference": "893316d2904e93f1c74c1384b6d7d57778299cb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-coding-standard/zipball/893316d2904e93f1c74c1384b6d7d57778299cb6", + "reference": "893316d2904e93f1c74c1384b6d7d57778299cb6", + "shasum": "" + }, + "require": { + "squizlabs/php_codesniffer": "^2.7" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Zend Framework coding standard", + "keywords": [ + "Coding Standard", + "zf" + ], + "time": "2016-11-09T21:30:43+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.6 || ^7.0" + }, + "platform-dev": [] +} diff --git a/CONDUCT.md b/docs/CODE_OF_CONDUCT.md similarity index 96% rename from CONDUCT.md rename to docs/CODE_OF_CONDUCT.md index c663d2be9..02fafcd1a 100644 --- a/CONDUCT.md +++ b/docs/CODE_OF_CONDUCT.md @@ -1,6 +1,6 @@ # Contributor Code of Conduct -The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com) +This project adheres to [The Code Manifesto](http://codemanifesto.com) as its guidelines for contributor interactions. ## The Code Manifesto diff --git a/CONTRIBUTING.md b/docs/CONTRIBUTING.md similarity index 50% rename from CONTRIBUTING.md rename to docs/CONTRIBUTING.md index 39327161b..afefd0811 100644 --- a/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -2,73 +2,43 @@ ## RESOURCES -If you wish to contribute to Zend Framework, please be sure to +If you wish to contribute to this project, please be sure to read/subscribe to the following resources: - - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) - - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) - - ZF Contributor's mailing list: - Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html - Subscribe: zf-contributors-subscribe@lists.zend.com - - ZF Contributor's IRC channel: - #zftalk.dev on Freenode.net + - [Coding Standards](https://github.com/zendframework/zend-coding-standard) + - [Forums](https://discourse.zendframework.com/c/contributors) + - [Slack](https://zendframework-slack.herokuapp.com) + - [Code of Conduct](CODE_OF_CONDUCT.md) -If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-stdlib/issues/new). - -## Reporting Potential Security Issues - -If you have encountered a potential security vulnerability, please **DO NOT** report it on the public -issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. -We will work with you to verify the vulnerability and patch it as soon as possible. - -When reporting issues, please provide the following information: - -- Component(s) affected -- A description indicating how to reproduce the issue -- A summary of the security vulnerability and impact - -We request that you contact us via the email address above and give the project -contributors a chance to resolve the vulnerability and issue a new release prior -to any public exposure; this helps protect users and provides them with a chance -to upgrade and/or update in order to protect their applications. - -For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). +If you are working on new features or refactoring +[create a proposal](https://github.com/zendframework/zend-stdlib/issues/new). ## RUNNING TESTS -> ### Note: testing versions prior to 2.4 -> -> This component originates with Zend Framework 2. During the lifetime of ZF2, -> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no -> changes were necessary. However, due to the migration, tests may not run on -> versions < 2.4. As such, you may need to change the PHPUnit dependency if -> attempting a fix on such a version. - To run tests: - Clone the repository: ```console - $ git clone git@github.com:zendframework/zend-stdlib.git - $ cd + $ git clone git://github.com/zendframework/zend-stdlib.git + $ cd zend-stdlib ``` - Install dependencies via composer: ```console - $ curl -sS https://getcomposer.org/installer | php -- - $ ./composer.phar install + $ composer install ``` - If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ + If you don't have `composer` installed, please download it from https://getcomposer.org/download/ -- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: +- Run the tests using the "test" command shipped in the `composer.json`: ```console - $ ./vendor/bin/phpunit + $ composer test ``` -You can turn on conditional tests with the phpunit.xml file. +You can turn on conditional tests with the `phpunit.xml` file. To do so: - Copy `phpunit.xml.dist` file to `phpunit.xml` @@ -77,48 +47,36 @@ To do so: ## Running Coding Standards Checks -This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding -standards checks, and provides configuration for our selected checks. -`php-cs-fixer` is installed by default via Composer. +First, ensure you've installed dependencies via composer, per the previous +section on running tests. -To run checks only: +To run CS checks only: ```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs +$ composer cs-check ``` -To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` -flag: +To attempt to automatically fix common CS issues: ```console -$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs +$ composer cs-fix ``` -If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure +If the above fixes any CS issues, please re-run the tests to ensure they pass, and make sure you add and commit the changes after verification. -## Benchmarks - -We provide benchmark tests for zend-stdlib under the directory [benchmark/](benchmark/), -using. [athletic](https://github.com/polyfractal/athletic). You can execute -the benchmarks running the following command: - -```bash -$ ./vendor/bin/athletic -p benchmark -``` - ## Recommended Workflow for Contributions Your first step is to establish a public repository from which we can pull your work into the master repository. We recommend using [GitHub](https://github.com), as that is where the component is already hosted. -1. Setup a [GitHub account](http://github.com/), if you haven't yet -2. Fork the repository (http://github.com/zendframework/zend-stdlib) +1. Setup a [GitHub account](https://github.com/), if you haven't yet +2. Fork the repository (https://github.com/zendframework/zend-stdlib) 3. Clone the canonical repository locally and enter it. ```console - $ git clone git://github.com:zendframework/zend-stdlib.git + $ git clone git://github.com/zendframework/zend-stdlib.git $ cd zend-stdlib ``` @@ -198,15 +156,7 @@ To send a pull request, you have two options. If using GitHub, you can do the pull request from there. Navigate to your repository, select the branch you just created, and then select the "Pull Request" button in the upper right. Select the user/organization -"zendframework" as the recipient. - -If using your own repository - or even if using GitHub - you can use `git -format-patch` to create a patchset for us to apply; in fact, this is -**recommended** for security-related patches. If you use `format-patch`, please -send the patches as attachments to: - -- zf-devteam@zend.com for patches without security implications -- zf-security@zend.com for security patches +"zendframework" (or whatever the upstream organization is) as the recipient. #### What branch to issue the pull request against? @@ -237,8 +187,3 @@ repository, we suggest doing some cleanup of these branches. ```console $ git push {username} : ``` - - -## Conduct - -Please see our [CONDUCT.md](CONDUCT.md) to understand expected behavior when interacting with others in the project. diff --git a/docs/ISSUE_TEMPLATE.md b/docs/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..55d129570 --- /dev/null +++ b/docs/ISSUE_TEMPLATE.md @@ -0,0 +1,19 @@ + - [ ] I was not able to find an [open](https://github.com/zendframework/zend-stdlib/issues?q=is%3Aopen) or [closed](https://github.com/zendframework/zend-stdlib/issues?q=is%3Aclosed) issue matching what I'm seeing. + - [ ] This is not a question. (Questions should be asked on [slack](https://zendframework.slack.com/) ([Signup for Slack here](https://zendframework-slack.herokuapp.com/)) or our [forums](https://discourse.zendframework.com/).) + +Provide a narrative description of what you are trying to accomplish. + +### Code to reproduce the issue + + + +```php +``` + +### Expected results + + + +### Actual results + + diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..f00d90c06 --- /dev/null +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,25 @@ +Provide a narrative description of what you are trying to accomplish: + +- [ ] Are you fixing a bug? + - [ ] Detail how the bug is invoked currently. + - [ ] Detail the original, incorrect behavior. + - [ ] Detail the new, expected behavior. + - [ ] Base your feature on the `master` branch, and submit against that branch. + - [ ] Add a regression test that demonstrates the bug, and proves the fix. + - [ ] Add a `CHANGELOG.md` entry for the fix. + +- [ ] Are you creating a new feature? + - [ ] Why is the new feature needed? What purpose does it serve? + - [ ] How will users use the new feature? + - [ ] Base your feature on the `develop` branch, and submit against that branch. + - [ ] Add only one feature per pull request; split multiple features over multiple pull requests + - [ ] Add tests for the new feature. + - [ ] Add documentation for the new feature. + - [ ] Add a `CHANGELOG.md` entry for the new feature. + +- [ ] Is this related to quality assurance? + + +- [ ] Is this related to documentation? + + diff --git a/docs/SUPPORT.md b/docs/SUPPORT.md new file mode 100644 index 000000000..82a7461bc --- /dev/null +++ b/docs/SUPPORT.md @@ -0,0 +1,25 @@ +# Getting Support + +Zend Framework offers three support channels: + +- For real-time questions, use our + [Slack](https://zendframework-slack.herokuapp.com) +- For detailed questions (e.g., those requiring examples) use our + [forums](https://discourse.zendframework.com/c/questions/components) +- To report issues, use this repository's + [issue tracker](https://github.com/zendframework/zend-stdlib/issues/new) + +**DO NOT** use the issue tracker to ask questions; use Slack or the forums for +that. Questions posed to the issue tracker will be closed. + +When reporting an issue, please include the following details: + +- A narrative description of what you are trying to accomplish. +- The minimum code necessary to reproduce the issue. +- The expected results of exercising that code. +- The actual results received. + +We may ask for additional details: what version of the library you are using, +and what PHP version was used to reproduce the issue. + +You may also submit a failing test case as a pull request. diff --git a/docs/book/console-helper.md b/docs/book/console-helper.md new file mode 100644 index 000000000..0a275667e --- /dev/null +++ b/docs/book/console-helper.md @@ -0,0 +1,126 @@ +# Console Helper + +Writing one-off scripts or vendor binaries for a package is often problematic: + +- You need to parse arguments manually. +- You need to send output to the console in a meaningful fashion: + - Using `STDOUT` for meaningful, expected output + - Using `STDERR` for error messages + - Ensuring any line breaks are converted to `PHP_EOL` + - Optionally, using console colors to provide context, which means: + - Detecting whether or not the console supports colors in the first place + - Providing appropriate escape sequences to produce color + +`Zend\Stdlib\ConsoleHelper` helps to address the second major bullet point and +all beneath it in a minimal fashion. + +## Usage + +Typical usage is to instantiate a `ConsoleHelper`, and call one of its methods: + +```php +use Zend\Stdlib\ConsoleHelper; + +$helper = new ConsoleHelper(); +$helper->writeLine('This is output'); +``` + +You can optionally pass a PHP stream resource to the constructor, which will be +used to determine whether or not color support is available: + +```php +$helper = new ConsoleHelper($stream); +``` + +By default, it assumes `STDOUT`, and tests against that. + +## Available methods + +`ConsoleHelper` provides the following methods. + +### colorize + +- `colorize(string $string) : string` + +`colorize()` accepts a formatted string, and will then apply ANSI color +sequences to them, if color support is detected. + +The following sequences are currently supported: + +- `...` will apply a green color sequence around the provided text. +- `...` will apply a red color sequence around the provided text. + +You may mix multiple sequences within the same stream. + +### write + +- `write(string $string, bool $colorize = true, resource $stream = STDOUT) : void` + +Emits the provided `$string` to the provided `$stream` (which defaults to +`STDOUT` if not provided). Any EOL sequences are convered to `PHP_EOL`. If +`$colorize` is `true`, the string is first passed to `colorize()` as well. + +### writeline + +- `writeLine(string $string, bool $colorize = true, resource $stream = STDOUT) : void` + +Same as `write()`, except it also appends a `PHP_EOL` sequence to the `$string`. + +### writeErrorMessage + +- `writeErrorMessage(string $message)` + +Wraps `$message` in an `` sequence, and passes it to +`writeLine()`, using `STDERR` as the `$stream`. + +## Example + +Below is an example class that accepts an argument list, and determines how and +what to emit. + +```php +namespace Foo; + +use Zend\Stdlib\ConsoleHelper; + +class HelloWorld +{ + private $helper; + + public function __construct(ConsoleHelper $helper = null) + { + $this->helper = $helper ?: new ConsoleHelper(); + } + + public function __invoke(array $args) + { + if (! count($args)) { + $this->helper->writeErrorMessage('Missing arguments!'); + return; + } + + if (count($args) > 1) { + $this->helper->writeErrorMessage('Too many arguments!'); + return; + } + + $target = array_shift($args); + + $this->helper->writeLine(sprintf( + 'Hello %s', + $target + )); + } +} +``` + +## When to upgrade + +`ConsoleHelper` is deliberately simple, and assumes that your primary need for +console tooling is for output considerations. + +If you need to parse complex argument strings, we recommend using +[zend-console](https://docs.zendframework.com/zend-console/)/[zf-console](https://github.com/zfcampus/zf-console) +or [symfony/console](http://symfony.com/doc/current/components/console.html), +as these packages provide those capabilities, as well as far more colorization +and console feature detection facilities. diff --git a/doc/book/index.html b/docs/book/index.html similarity index 98% rename from doc/book/index.html rename to docs/book/index.html index f4b09ab44..680275458 100644 --- a/doc/book/index.html +++ b/docs/book/index.html @@ -1,7 +1,7 @@

zend-stdlib

- +

SPL extensions, array utilities, error handlers, and more.

$ composer require zendframework/zend-stdlib
diff --git a/doc/book/index.md b/docs/book/index.md similarity index 100% rename from doc/book/index.md rename to docs/book/index.md diff --git a/doc/book/migration.md b/docs/book/migration.md similarity index 100% rename from doc/book/migration.md rename to docs/book/migration.md diff --git a/doc/bookdown.json b/docs/bookdown.json similarity index 100% rename from doc/bookdown.json rename to docs/bookdown.json diff --git a/mkdocs.yml b/mkdocs.yml index bf87a22ad..09d9ba600 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,9 +1,11 @@ -docs_dir: doc/book -site_dir: doc/html +docs_dir: docs/book +site_dir: docs/html pages: - index.md + - Reference: + - "Console Helper": console-helper.md - Migration: migration.md site_name: zend-stdlib site_description: Zend\Stdlib repo_url: 'https://github.com/zendframework/zend-stdlib' -copyright: 'Copyright (c) 2016 Zend Technologies USA Inc.' +copyright: 'Copyright (c) 2005-2018 Zend Technologies USA Inc.' diff --git a/phpbench.json b/phpbench.json new file mode 100644 index 000000000..7d6181f3e --- /dev/null +++ b/phpbench.json @@ -0,0 +1,5 @@ +{ + "bootstrap": "vendor/autoload.php", + "path": "benchmark", + "retry_threshold": 5 +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 000000000..c48d19c5d --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,8 @@ + + + + + + src + test + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8205e0f18..00bc6dd6f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,34 +1,17 @@ - ./test/ + ./test - - - disable - - - - + ./src - - - - - - - - diff --git a/src/AbstractOptions.php b/src/AbstractOptions.php index 812e1ca13..172f5d363 100644 --- a/src/AbstractOptions.php +++ b/src/AbstractOptions.php @@ -13,6 +13,7 @@ abstract class AbstractOptions implements ParameterObjectInterface { + // @codingStandardsIgnoreStart /** * We use the __ prefix to avoid collisions with properties in * user-implementations. @@ -20,6 +21,7 @@ abstract class AbstractOptions implements ParameterObjectInterface * @var bool */ protected $__strictMode__ = true; + // @codingStandardsIgnoreEnd /** * Constructor @@ -46,7 +48,7 @@ public function setFromArray($options) $options = $options->toArray(); } - if (!is_array($options) && !$options instanceof Traversable) { + if (! is_array($options) && ! $options instanceof Traversable) { throw new Exception\InvalidArgumentException( sprintf( 'Parameter provided to %s must be an %s, %s or %s', diff --git a/src/ArrayObject.php b/src/ArrayObject.php index e890084d0..8c77c6209 100644 --- a/src/ArrayObject.php +++ b/src/ArrayObject.php @@ -180,14 +180,16 @@ public function count() */ public function exchangeArray($data) { - if (!is_array($data) && !is_object($data)) { - throw new Exception\InvalidArgumentException('Passed variable is not an array or object, using empty array instead'); + if (! is_array($data) && ! is_object($data)) { + throw new Exception\InvalidArgumentException( + 'Passed variable is not an array or object, using empty array instead' + ); } if (is_object($data) && ($data instanceof self || $data instanceof \ArrayObject)) { $data = $data->getArrayCopy(); } - if (!is_array($data)) { + if (! is_array($data)) { $data = (array) $data; } @@ -290,7 +292,7 @@ public function offsetExists($key) public function &offsetGet($key) { $ret = null; - if (!$this->offsetExists($key)) { + if (! $this->offsetExists($key)) { return $ret; } $ret =& $this->storage[$key]; @@ -423,7 +425,7 @@ public function unserialize($data) $this->setIteratorClass($v); break; case 'protectedProperties': - continue; + break; default: $this->__set($k, $v); } diff --git a/src/ArrayUtils.php b/src/ArrayUtils.php index 17e3ae3cd..4edcacf11 100644 --- a/src/ArrayUtils.php +++ b/src/ArrayUtils.php @@ -39,11 +39,11 @@ abstract class ArrayUtils */ public static function hasStringKeys($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -59,11 +59,11 @@ public static function hasStringKeys($value, $allowEmpty = false) */ public static function hasIntegerKeys($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -86,11 +86,11 @@ public static function hasIntegerKeys($value, $allowEmpty = false) */ public static function hasNumericKeys($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -119,11 +119,11 @@ public static function hasNumericKeys($value, $allowEmpty = false) */ public static function isList($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -161,11 +161,11 @@ public static function isList($value, $allowEmpty = false) */ public static function isHashTable($value, $allowEmpty = false) { - if (!is_array($value)) { + if (! is_array($value)) { return false; } - if (!$value) { + if (! $value) { return $allowEmpty; } @@ -187,7 +187,7 @@ public static function isHashTable($value, $allowEmpty = false) */ public static function inArray($needle, array $haystack, $strict = false) { - if (!$strict) { + if (! $strict) { if (is_int($needle) || is_float($needle)) { $needle = (string) $needle; } @@ -215,11 +215,11 @@ public static function inArray($needle, array $haystack, $strict = false) */ public static function iteratorToArray($iterator, $recursive = true) { - if (!is_array($iterator) && !$iterator instanceof Traversable) { + if (! is_array($iterator) && ! $iterator instanceof Traversable) { throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object'); } - if (!$recursive) { + if (! $recursive) { if (is_array($iterator)) { return $iterator; } @@ -274,7 +274,7 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false) } elseif (isset($a[$key]) || array_key_exists($key, $a)) { if ($value instanceof MergeRemoveKey) { unset($a[$key]); - } elseif (!$preserveNumericKeys && is_int($key)) { + } elseif (! $preserveNumericKeys && is_int($key)) { $a[] = $value; } elseif (is_array($value) && is_array($a[$key])) { $a[$key] = static::merge($a[$key], $value, $preserveNumericKeys); @@ -282,7 +282,7 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false) $a[$key] = $value; } } else { - if (!$value instanceof MergeRemoveKey) { + if (! $value instanceof MergeRemoveKey) { $a[$key] = $value; } } @@ -292,12 +292,13 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false) } /** - * Compatibility Method for array_filter on <5.6 systems + * @deprecated Since 3.2.0; use the native array_filter methods * * @param array $data * @param callable $callback * @param null|int $flag * @return array + * @throws Exception\InvalidArgumentException */ public static function filter(array $data, $callback, $flag = null) { @@ -308,28 +309,6 @@ public static function filter(array $data, $callback, $flag = null) )); } - if (version_compare(PHP_VERSION, '5.6.0') >= 0) { - return array_filter($data, $callback, $flag); - } - - $output = []; - foreach ($data as $key => $value) { - $params = [$value]; - - if ($flag === static::ARRAY_FILTER_USE_BOTH) { - $params[] = $key; - } - - if ($flag === static::ARRAY_FILTER_USE_KEY) { - $params = [$key]; - } - - $response = call_user_func_array($callback, $params); - if ($response) { - $output[$key] = $value; - } - } - - return $output; + return array_filter($data, $callback, $flag); } } diff --git a/src/ConsoleHelper.php b/src/ConsoleHelper.php new file mode 100644 index 000000000..79a65c803 --- /dev/null +++ b/src/ConsoleHelper.php @@ -0,0 +1,158 @@ +message`, + * `message`) + * - Write output to a specified stream, optionally with colorization. + * - Write a line of output to a specified stream, optionally with + * colorization, using the system EOL sequence.. + * - Write an error message to STDERR. + * + * Colorization will only occur when expected sequences are discovered, and + * then, only if the console terminal allows it. + * + * Essentially, provides the bare minimum to allow you to provide messages to + * the current console. + */ +class ConsoleHelper +{ + const COLOR_GREEN = "\033[32m"; + const COLOR_RED = "\033[31m"; + const COLOR_RESET = "\033[0m"; + + const HIGHLIGHT_INFO = 'info'; + const HIGHLIGHT_ERROR = 'error'; + + private $highlightMap = [ + self::HIGHLIGHT_INFO => self::COLOR_GREEN, + self::HIGHLIGHT_ERROR => self::COLOR_RED, + ]; + + /** + * @var string Exists only for testing. + */ + private $eol = PHP_EOL; + + /** + * @var resource Exists only for testing. + */ + private $stderr = STDERR; + + /** + * @var bool + */ + private $supportsColor; + + /** + * @param resource $resource + */ + public function __construct($resource = STDOUT) + { + $this->supportsColor = $this->detectColorCapabilities($resource); + } + + /** + * Colorize a string for use with the terminal. + * + * Takes strings formatted as `string` and formats them per the + * $highlightMap; if color support is disabled, simply removes the formatting + * tags. + * + * @param string $string + * @return string + */ + public function colorize($string) + { + $reset = $this->supportsColor ? self::COLOR_RESET : ''; + foreach ($this->highlightMap as $key => $color) { + $pattern = sprintf('#<%s>(.*?)#s', $key, $key); + $color = $this->supportsColor ? $color : ''; + $string = preg_replace($pattern, $color . '$1' . $reset, $string); + } + return $string; + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the string + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function write($string, $colorize = true, $resource = STDOUT) + { + if ($colorize) { + $string = $this->colorize($string); + } + + $string = $this->formatNewlines($string); + + fwrite($resource, $string); + } + + /** + * @param string $string + * @param bool $colorize Whether or not to colorize the line + * @param resource $resource Defaults to STDOUT + * @return void + */ + public function writeLine($string, $colorize = true, $resource = STDOUT) + { + $this->write($string . $this->eol, $colorize, $resource); + } + + /** + * Emit an error message. + * + * Wraps the message in ``, and passes it to `writeLine()`, + * using STDERR as the resource; emits an additional empty line when done, + * also to STDERR. + * + * @param string $message + * @return void + */ + public function writeErrorMessage($message) + { + $this->writeLine(sprintf('%s', $message), true, $this->stderr); + $this->writeLine('', false, $this->stderr); + } + + /** + * @param resource $resource + * @return bool + */ + private function detectColorCapabilities($resource = STDOUT) + { + if ('\\' === DIRECTORY_SEPARATOR) { + // Windows + return false !== getenv('ANSICON') + || 'ON' === getenv('ConEmuANSI') + || 'xterm' === getenv('TERM'); + } + + return function_exists('posix_isatty') && posix_isatty($resource); + } + + /** + * Ensure newlines are appropriate for the current terminal. + * + * @param string + * @return string + */ + private function formatNewlines($string) + { + $string = str_replace($this->eol, "\0PHP_EOL\0", $string); + $string = preg_replace("/(\r\n|\n|\r)/", $this->eol, $string); + return str_replace("\0PHP_EOL\0", $this->eol, $string); + } +} diff --git a/src/ErrorHandler.php b/src/ErrorHandler.php index a849620ab..405cdd799 100644 --- a/src/ErrorHandler.php +++ b/src/ErrorHandler.php @@ -51,7 +51,7 @@ public static function getNestedLevel() */ public static function start($errorLevel = \E_WARNING) { - if (!static::$stack) { + if (! static::$stack) { set_error_handler([get_called_class(), 'addError'], $errorLevel); } @@ -63,7 +63,7 @@ public static function start($errorLevel = \E_WARNING) * * @param bool $throw Throw the ErrorException if any * @return null|ErrorException - * @throws ErrorException If an error has been catched and $throw is true + * @throws ErrorException If an error has been caught and $throw is true */ public static function stop($throw = false) { @@ -72,7 +72,7 @@ public static function stop($throw = false) if (static::$stack) { $errorException = array_pop(static::$stack); - if (!static::$stack) { + if (! static::$stack) { restore_error_handler(); } diff --git a/src/FastPriorityQueue.php b/src/FastPriorityQueue.php index 16d2bcceb..883da06e4 100644 --- a/src/FastPriorityQueue.php +++ b/src/FastPriorityQueue.php @@ -57,9 +57,9 @@ class FastPriorityQueue implements Iterator, Countable, Serializable /** * Max priority * - * @var integer + * @var integer|null */ - protected $maxPriority = 0; + protected $maxPriority = null; /** * Total number of elements in the queue @@ -86,7 +86,7 @@ class FastPriorityQueue implements Iterator, Countable, Serializable * Insert an element in the queue with a specified priority * * @param mixed $value - * @param integer $priority a positive integer + * @param integer $priority */ public function insert($value, $priority) { @@ -96,7 +96,7 @@ public function insert($value, $priority) $this->values[$priority][] = $value; if (! isset($this->priorities[$priority])) { $this->priorities[$priority] = $priority; - $this->maxPriority = max($priority, $this->maxPriority); + $this->maxPriority = $this->maxPriority === null ? $priority : max($priority, $this->maxPriority); } ++$this->count; } @@ -132,11 +132,35 @@ public function extract() */ public function remove($datum) { + $currentIndex = $this->index; + $currentSubIndex = $this->subIndex; + $currentPriority = $this->maxPriority; + $this->rewind(); while ($this->valid()) { if (current($this->values[$this->maxPriority]) === $datum) { $index = key($this->values[$this->maxPriority]); unset($this->values[$this->maxPriority][$index]); + + // The `next()` method advances the internal array pointer, so we need to use the `reset()` function, + // otherwise we would lose all elements before the place the pointer points. + reset($this->values[$this->maxPriority]); + + $this->index = $currentIndex; + $this->subIndex = $currentSubIndex; + + // If the array is empty we need to destroy the unnecessary priority, + // otherwise we would end up with an incorrect value of `$this->count` + // {@see \Zend\Stdlib\FastPriorityQueue::nextAndRemove()}. + if (empty($this->values[$this->maxPriority])) { + unset($this->values[$this->maxPriority]); + unset($this->priorities[$this->maxPriority]); + if ($this->maxPriority === $currentPriority) { + $this->subIndex = 0; + } + } + + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); --$this->count; return true; } @@ -191,11 +215,15 @@ public function key() */ protected function nextAndRemove() { + $key = key($this->values[$this->maxPriority]); + if (false === next($this->values[$this->maxPriority])) { unset($this->priorities[$this->maxPriority]); unset($this->values[$this->maxPriority]); - $this->maxPriority = empty($this->priorities) ? 0 : max($this->priorities); + $this->maxPriority = empty($this->priorities) ? null : max($this->priorities); $this->subIndex = -1; + } else { + unset($this->values[$this->maxPriority][$key]); } ++$this->index; ++$this->subIndex; @@ -211,7 +239,7 @@ public function next() if (false === next($this->values[$this->maxPriority])) { unset($this->subPriorities[$this->maxPriority]); reset($this->values[$this->maxPriority]); - $this->maxPriority = empty($this->subPriorities) ? 0 : max($this->subPriorities); + $this->maxPriority = empty($this->subPriorities) ? null : max($this->subPriorities); $this->subIndex = -1; } ++$this->index; diff --git a/src/Glob.php b/src/Glob.php index dc37562ad..ded3fc533 100644 --- a/src/Glob.php +++ b/src/Glob.php @@ -38,7 +38,7 @@ abstract class Glob */ public static function glob($pattern, $flags = 0, $forceFallback = false) { - if (!defined('GLOB_BRACE') || $forceFallback) { + if (! defined('GLOB_BRACE') || $forceFallback) { return static::fallbackGlob($pattern, $flags); } @@ -96,7 +96,7 @@ protected static function systemGlob($pattern, $flags) */ protected static function fallbackGlob($pattern, $flags) { - if (!$flags & self::GLOB_BRACE) { + if (! $flags & self::GLOB_BRACE) { return static::systemGlob($pattern, $flags); } @@ -182,7 +182,7 @@ protected static function nextBraceSub($pattern, $begin, $flags) $current = $begin; while ($current < $length) { - if (!$flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') { + if (! $flags & self::GLOB_NOESCAPE && $pattern[$current] === '\\') { if (++$current === $length) { break; } diff --git a/src/Guard/ArrayOrTraversableGuardTrait.php b/src/Guard/ArrayOrTraversableGuardTrait.php index e6959a5ef..116101f1b 100644 --- a/src/Guard/ArrayOrTraversableGuardTrait.php +++ b/src/Guard/ArrayOrTraversableGuardTrait.php @@ -29,7 +29,7 @@ protected function guardForArrayOrTraversable( $dataName = 'Argument', $exceptionClass = 'Zend\Stdlib\Exception\InvalidArgumentException' ) { - if (!is_array($data) && !($data instanceof Traversable)) { + if (! is_array($data) && ! ($data instanceof Traversable)) { $message = sprintf( "%s must be an array or Traversable, [%s] given", $dataName, diff --git a/src/JsonSerializable.php b/src/JsonSerializable.php index 16cc24466..05b8836d7 100644 --- a/src/JsonSerializable.php +++ b/src/JsonSerializable.php @@ -9,6 +9,9 @@ namespace Zend\Stdlib; +/** + * @deprecated Since 3.1.0; use the native JsonSerializable interface + */ interface JsonSerializable extends \JsonSerializable { } diff --git a/src/Message.php b/src/Message.php index 12d5bb3d8..008e23f36 100644 --- a/src/Message.php +++ b/src/Message.php @@ -19,7 +19,7 @@ class Message implements MessageInterface protected $metadata = []; /** - * @var string + * @var mixed */ protected $content = ''; @@ -40,7 +40,7 @@ public function setMetadata($spec, $value = null) $this->metadata[$spec] = $value; return $this; } - if (!is_array($spec) && !$spec instanceof Traversable) { + if (! is_array($spec) && ! $spec instanceof Traversable) { throw new Exception\InvalidArgumentException(sprintf( 'Expected a string, array, or Traversable argument in first position; received "%s"', (is_object($spec) ? get_class($spec) : gettype($spec)) @@ -66,7 +66,7 @@ public function getMetadata($key = null, $default = null) return $this->metadata; } - if (!is_scalar($key)) { + if (! is_scalar($key)) { throw new Exception\InvalidArgumentException('Non-scalar argument provided for key'); } diff --git a/src/Parameters.php b/src/Parameters.php index ab5ada97a..e845fcdaf 100644 --- a/src/Parameters.php +++ b/src/Parameters.php @@ -70,7 +70,7 @@ public function toArray() */ public function toString() { - return http_build_query($this); + return http_build_query($this->toArray()); } /** diff --git a/src/PriorityList.php b/src/PriorityList.php index b318f264e..d5ca136bd 100644 --- a/src/PriorityList.php +++ b/src/PriorityList.php @@ -62,7 +62,7 @@ class PriorityList implements Iterator, Countable */ public function insert($name, $value, $priority = 0) { - if (!isset($this->items[$name])) { + if (! isset($this->items[$name])) { $this->count++; } @@ -85,7 +85,7 @@ public function insert($name, $value, $priority = 0) */ public function setPriority($name, $priority) { - if (!isset($this->items[$name])) { + if (! isset($this->items[$name])) { throw new \Exception("item $name not found"); } @@ -131,7 +131,7 @@ public function clear() */ public function get($name) { - if (!isset($this->items[$name])) { + if (! isset($this->items[$name])) { return; } @@ -145,7 +145,7 @@ public function get($name) */ protected function sort() { - if (!$this->sorted) { + if (! $this->sorted) { uasort($this->items, [$this, 'compare']); $this->sorted = true; } @@ -161,7 +161,7 @@ protected function sort() protected function compare(array $item1, array $item2) { return ($item1['priority'] === $item2['priority']) - ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO + ? ($item1['serial'] > $item2['serial'] ? -1 : 1) * $this->isLIFO : ($item1['priority'] > $item2['priority'] ? -1 : 1); } diff --git a/src/PriorityQueue.php b/src/PriorityQueue.php index eded6adfe..2a1628731 100644 --- a/src/PriorityQueue.php +++ b/src/PriorityQueue.php @@ -99,7 +99,7 @@ public function remove($datum) unset($this->items[$key]); $this->queue = null; - if (!$this->isEmpty()) { + if (! $this->isEmpty()) { $queue = $this->getQueue(); foreach ($this->items as $item) { $queue->insert($item['data'], $item['priority']); @@ -277,7 +277,7 @@ protected function getQueue() { if (null === $this->queue) { $this->queue = new $this->queueClass(); - if (!$this->queue instanceof \SplPriorityQueue) { + if (! $this->queue instanceof \SplPriorityQueue) { throw new Exception\DomainException(sprintf( 'PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"', get_class($this->queue) diff --git a/src/SplPriorityQueue.php b/src/SplPriorityQueue.php index 28b365d85..c5952dd31 100644 --- a/src/SplPriorityQueue.php +++ b/src/SplPriorityQueue.php @@ -36,7 +36,7 @@ class SplPriorityQueue extends \SplPriorityQueue implements Serializable */ public function insert($datum, $priority) { - if (!is_array($priority)) { + if (! is_array($priority)) { $priority = [$priority, $this->serial--]; } parent::insert($datum, $priority); @@ -84,7 +84,9 @@ public function serialize() */ public function unserialize($data) { + $this->serial = PHP_INT_MAX; foreach (unserialize($data) as $item) { + $this->serial--; $this->insert($item['data'], $item['priority']); } } diff --git a/src/StringUtils.php b/src/StringUtils.php index 575cf2aab..79a22a4c0 100644 --- a/src/StringUtils.php +++ b/src/StringUtils.php @@ -84,7 +84,7 @@ public static function getRegisteredWrappers() public static function registerWrapper($wrapper) { $wrapper = (string) $wrapper; - if (!in_array($wrapper, static::$wrapperRegistry, true)) { + if (! in_array($wrapper, static::$wrapperRegistry, true)) { static::$wrapperRegistry[] = $wrapper; } } diff --git a/src/StringWrapper/AbstractStringWrapper.php b/src/StringWrapper/AbstractStringWrapper.php index 3e395ccc5..cf2625079 100644 --- a/src/StringWrapper/AbstractStringWrapper.php +++ b/src/StringWrapper/AbstractStringWrapper.php @@ -38,11 +38,11 @@ public static function isSupported($encoding, $convertEncoding = null) { $supportedEncodings = static::getSupportedEncodings(); - if (!in_array(strtoupper($encoding), $supportedEncodings)) { + if (! in_array(strtoupper($encoding), $supportedEncodings)) { return false; } - if ($convertEncoding !== null && !in_array(strtoupper($convertEncoding), $supportedEncodings)) { + if ($convertEncoding !== null && ! in_array(strtoupper($convertEncoding), $supportedEncodings)) { return false; } @@ -61,7 +61,7 @@ public function setEncoding($encoding, $convertEncoding = null) $supportedEncodings = static::getSupportedEncodings(); $encodingUpper = strtoupper($encoding); - if (!in_array($encodingUpper, $supportedEncodings)) { + if (! in_array($encodingUpper, $supportedEncodings)) { throw new Exception\InvalidArgumentException( 'Wrapper doesn\'t support character encoding "' . $encoding . '"' ); @@ -69,7 +69,7 @@ public function setEncoding($encoding, $convertEncoding = null) if ($convertEncoding !== null) { $convertEncodingUpper = strtoupper($convertEncoding); - if (!in_array($convertEncodingUpper, $supportedEncodings)) { + if (! in_array($convertEncodingUpper, $supportedEncodings)) { throw new Exception\InvalidArgumentException( 'Wrapper doesn\'t support character encoding "' . $convertEncoding . '"' ); diff --git a/src/StringWrapper/Iconv.php b/src/StringWrapper/Iconv.php index 46413ab79..bc791b893 100644 --- a/src/StringWrapper/Iconv.php +++ b/src/StringWrapper/Iconv.php @@ -214,7 +214,7 @@ public static function getSupportedEncodings() */ public function __construct() { - if (!extension_loaded('iconv')) { + if (! extension_loaded('iconv')) { throw new Exception\ExtensionNotLoadedException( 'PHP extension "iconv" is required for this wrapper' ); diff --git a/src/StringWrapper/Intl.php b/src/StringWrapper/Intl.php index eaab28f88..4644db361 100644 --- a/src/StringWrapper/Intl.php +++ b/src/StringWrapper/Intl.php @@ -37,7 +37,7 @@ public static function getSupportedEncodings() */ public function __construct() { - if (!extension_loaded('intl')) { + if (! extension_loaded('intl')) { throw new Exception\ExtensionNotLoadedException( 'PHP extension "intl" is required for this wrapper' ); diff --git a/src/StringWrapper/MbString.php b/src/StringWrapper/MbString.php index d6db18566..a0f80f62a 100644 --- a/src/StringWrapper/MbString.php +++ b/src/StringWrapper/MbString.php @@ -48,7 +48,7 @@ public static function getSupportedEncodings() */ public function __construct() { - if (!extension_loaded('mbstring')) { + if (! extension_loaded('mbstring')) { throw new Exception\ExtensionNotLoadedException( 'PHP extension "mbstring" is required for this wrapper' ); diff --git a/src/StringWrapper/Native.php b/src/StringWrapper/Native.php index 38b3c10a4..b01bb86cf 100644 --- a/src/StringWrapper/Native.php +++ b/src/StringWrapper/Native.php @@ -16,7 +16,7 @@ class Native extends AbstractStringWrapper { /** * The character encoding working on - * (overwritten to change defaut encoding) + * (overwritten to change default encoding) * * @var string */ @@ -35,7 +35,7 @@ public static function isSupported($encoding, $convertEncoding = null) $encodingUpper = strtoupper($encoding); $supportedEncodings = static::getSupportedEncodings(); - if (!in_array($encodingUpper, $supportedEncodings)) { + if (! in_array($encodingUpper, $supportedEncodings)) { return false; } @@ -69,7 +69,7 @@ public function setEncoding($encoding, $convertEncoding = null) $supportedEncodings = static::getSupportedEncodings(); $encodingUpper = strtoupper($encoding); - if (!in_array($encodingUpper, $supportedEncodings)) { + if (! in_array($encodingUpper, $supportedEncodings)) { throw new Exception\InvalidArgumentException( 'Wrapper doesn\'t support character encoding "' . $encoding . '"' ); diff --git a/test/ArrayObjectTest.php b/test/ArrayObjectTest.php index b09cab7e9..d61c08eb0 100644 --- a/test/ArrayObjectTest.php +++ b/test/ArrayObjectTest.php @@ -9,7 +9,9 @@ namespace ZendTest\Stdlib; -use PHPUnit_Framework_TestCase as TestCase; +use InvalidArgumentException; +use PHPUnit\Framework\Error\Warning; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\ArrayObject; class ArrayObjectTest extends TestCase @@ -51,7 +53,7 @@ public function testStdPropList() public function testStdPropListCannotAccessObjectVars() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $ar = new ArrayObject(); $ar->flag; } @@ -101,10 +103,31 @@ public function testAsort() $this->assertSame($sorted, $ar->getArrayCopy()); } + /** + * PHPUnit 5.7 does not namespace error classes; retrieve appropriate one + * based on what is available. + * + * @return string + */ + protected function getExpectedWarningClass() + { + return class_exists(Warning::class) ? Warning::class : \PHPUnit_Framework_Error_Warning::class; + } + public function testCount() { + if (PHP_VERSION_ID >= 70200) { + $this->expectException($this->getExpectedWarningClass()); + $this->expectExceptionMessage('Parameter must be an array or an object that implements Countable'); + } $ar = new ArrayObject(new TestAsset\ArrayObjectObjectVars()); - $this->assertEquals(1, $ar->count()); + $this->assertCount(1, $ar); + } + + public function testCountable() + { + $ar = new ArrayObject(new TestAsset\ArrayObjectObjectCount()); + $this->assertCount(42, $ar); } public function testExchangeArray() @@ -156,7 +179,7 @@ public function testExchangeArrayArrayIterator() public function testExchangeArrayStringArgumentFail() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $ar = new ArrayObject(['foo' => 'bar']); $old = $ar->exchangeArray('Bacon'); } @@ -202,7 +225,7 @@ public function testIteratorClass() public function testInvalidIteratorClassThrowsInvalidArgumentException() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $ar = new ArrayObject([], ArrayObject::STD_PROP_LIST, 'InvalidArrayIterator'); } @@ -247,7 +270,7 @@ public function testOffsetExists() public function testOffsetExistsThrowsExceptionOnProtectedProperty() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $ar = new ArrayObject(); isset($ar->protectedProperties); } @@ -266,14 +289,14 @@ public function testOffsetGetOffsetSet() public function testOffsetGetThrowsExceptionOnProtectedProperty() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $ar = new ArrayObject(); $ar->protectedProperties; } public function testOffsetSetThrowsExceptionOnProtectedProperty() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $ar = new ArrayObject(); $ar->protectedProperties = null; } @@ -295,11 +318,13 @@ public function testOffsetUnsetMultidimensional() $ar = new ArrayObject(); $ar['foo'] = ['bar' => ['baz' => 'boo']]; unset($ar['foo']['bar']['baz']); + + $this->assertArrayNotHasKey('baz', $ar['foo']['bar']); } public function testOffsetUnsetThrowsExceptionOnProtectedProperty() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $ar = new ArrayObject(); unset($ar->protectedProperties); } diff --git a/test/ArrayUtilsTest.php b/test/ArrayUtilsTest.php index 8db7a8ba3..907503ac3 100644 --- a/test/ArrayUtilsTest.php +++ b/test/ArrayUtilsTest.php @@ -10,10 +10,11 @@ namespace ZendTest\Stdlib; use ArrayObject; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; use stdClass; use Zend\Stdlib\ArrayUtils; use Zend\Stdlib\ArrayUtils\MergeRemoveKey; +use Zend\Stdlib\Exception\InvalidArgumentException; use Zend\Stdlib\Parameters; class ArrayUtilsTest extends TestCase @@ -456,7 +457,7 @@ public function testValidIteratorsReturnArrayRepresentation($test, $expected) */ public function testInvalidIteratorsRaiseInvalidArgumentException($test) { - $this->setExpectedException('Zend\Stdlib\Exception\InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $this->assertFalse(ArrayUtils::iteratorToArray($test)); } @@ -512,11 +513,9 @@ public function testFiltersArray($data, $callback, $flag, $result) $this->assertEquals($result, ArrayUtils::filter($data, $callback, $flag)); } - /** - * @expectedException \Zend\Stdlib\Exception\InvalidArgumentException - */ public function testInvalidCallableRaiseInvalidArgumentException() { + $this->expectException(InvalidArgumentException::class); ArrayUtils::filter([], "INVALID"); } } diff --git a/test/ConsoleHelperTest.php b/test/ConsoleHelperTest.php new file mode 100644 index 000000000..276276ef6 --- /dev/null +++ b/test/ConsoleHelperTest.php @@ -0,0 +1,148 @@ +helper = new ConsoleHelper(); + } + + public function disableColorSupport() + { + $r = new ReflectionProperty($this->helper, 'supportsColor'); + $r->setAccessible(true); + $r->setValue($this->helper, false); + } + + public function enableColorSupport() + { + $r = new ReflectionProperty($this->helper, 'supportsColor'); + $r->setAccessible(true); + $r->setValue($this->helper, true); + } + + public function overrideEolSequence($newSequence) + { + $r = new ReflectionProperty($this->helper, 'eol'); + $r->setAccessible(true); + $r->setValue($this->helper, $newSequence); + } + + public function overrideStderrResource($stderr) + { + $r = new ReflectionProperty($this->helper, 'stderr'); + $r->setAccessible(true); + $r->setValue($this->helper, $stderr); + } + + public function retrieveStreamContents($stream) + { + rewind($stream); + $contents = ''; + while (! feof($stream)) { + $contents .= fread($stream, 4096); + } + return $contents; + } + + public function testCanColorizeInfoString() + { + $string = ' -h|--help This help message'; + $this->enableColorSupport(); + $colorized = $this->helper->colorize($string); + + $this->assertEquals(" \033[32m-h|--help\033[0m This help message", $colorized); + } + + public function testCanColorizeErrorString() + { + $string = 'NOT OK An error occurred'; + $this->enableColorSupport(); + $colorized = $this->helper->colorize($string); + + $this->assertEquals("\033[31mNOT OK\033[0m An error occurred", $colorized); + } + + public function testCanColorizeMixedStrings() + { + $this->enableColorSupport(); + $string = "NOT OK\n\nUsage: foo"; + $colorized = $this->helper->colorize($string); + + $this->assertContains("\033[31mNOT OK\033[0m", $colorized, 'Colorized error string not found'); + $this->assertContains("\033[32mUsage:\033[0m", $colorized, 'Colorized info string not found'); + } + + public function testColorizationWillReplaceTagsWithEmptyStringsWhenColorSupportIsNotDetected() + { + $this->disableColorSupport(); + $string = "NOT OK\n\nUsage: foo"; + $colorized = $this->helper->colorize($string); + + $this->assertNotContains("\033[31m", $colorized, 'Colorized error string discovered'); + $this->assertNotContains("\033[32m", $colorized, 'Colorized info string discovered'); + $this->assertNotContains("\033[0m", $colorized, 'Color reset sequence discovered'); + $this->assertNotRegexp("/<\/?error>/", $colorized, 'Error template string discovered'); + $this->assertNotRegexp("/<\/?info>/", $colorized, 'Info template string discovered'); + } + + public function testWriteFormatsLinesToPhpEolSequenceAndWritesToProvidedStream() + { + $this->overrideEolSequence("\r\n"); + $string = "foo bar\nbaz bat"; + $stream = fopen('php://temp', 'w+'); + + $this->helper->write($string, false, $stream); + + $contents = $this->retrieveStreamContents($stream); + $this->assertContains("\r\n", $contents); + } + + public function testWriteWillColorizeOutputIfRequested() + { + $this->enableColorSupport(); + $string = 'foo bar'; + $stream = fopen('php://temp', 'w+'); + + $this->helper->write($string, true, $stream); + + $contents = $this->retrieveStreamContents($stream); + $this->assertContains("\033[32mbar\033[0m", $contents); + } + + public function testWriteLineAppendsPhpEolSequenceToString() + { + $this->overrideEolSequence("\r\n"); + $string = 'foo bar'; + $stream = fopen('php://temp', 'w+'); + + $this->helper->writeLine($string, false, $stream); + + $contents = $this->retrieveStreamContents($stream); + $this->assertRegexp("/bar\r\n$/", $contents); + } + + public function testWriteErrorMessageWritesColorizedOutputToStderr() + { + $stderr = fopen('php://temp', 'w+'); + $this->overrideStderrResource($stderr); + $this->enableColorSupport(); + $this->overrideEolSequence("\r\n"); + + $this->helper->writeErrorMessage('an error occurred'); + + $contents = $this->retrieveStreamContents($stderr); + $this->assertEquals("\033[31man error occurred\033[0m\r\n\r\n", $contents); + } +} diff --git a/test/ErrorHandlerTest.php b/test/ErrorHandlerTest.php index 077cbd08e..2a00c64bb 100644 --- a/test/ErrorHandlerTest.php +++ b/test/ErrorHandlerTest.php @@ -9,7 +9,8 @@ namespace ZendTest\Stdlib; -use PHPUnit_Framework_TestCase as TestCase; +use ErrorException; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\ErrorHandler; class ErrorHandlerTest extends TestCase @@ -75,7 +76,7 @@ public function testThrowCatchedError() ErrorHandler::start(); strpos(); // Invalid argument list - $this->setExpectedException('ErrorException'); + $this->expectException(ErrorException::class); ErrorHandler::stop(true); } diff --git a/test/FastPriorityQueueTest.php b/test/FastPriorityQueueTest.php index a7743ceca..867519bfd 100644 --- a/test/FastPriorityQueueTest.php +++ b/test/FastPriorityQueueTest.php @@ -9,13 +9,25 @@ namespace ZendTest\Stdlib; +use PHPUnit\Framework\TestCase; +use Zend\Stdlib\Exception\InvalidArgumentException; use Zend\Stdlib\FastPriorityQueue; /** * @group Zend_Stdlib */ -class FastPriorityQueueTest extends \PHPUnit_Framework_TestCase +class FastPriorityQueueTest extends TestCase { + /** + * @var FastPriorityQueue + */ + protected $queue; + + /** + * @var string[] + */ + protected $expected; + public function setUp() { $this->queue = new FastPriorityQueue(); @@ -42,7 +54,7 @@ protected function getDataPriorityQueue() ]; } - protected function insertDataQueue($queue) + protected function insertDataQueue(FastPriorityQueue $queue) { foreach ($this->getDataPriorityQueue() as $value => $priority) { $queue->insert($value, $priority); @@ -96,7 +108,11 @@ public function testSerializationAndDeserializationShouldMaintainState() $s = serialize($this->queue); $unserialized = unserialize($s); $count = count($this->queue); - $this->assertSame($count, count($unserialized), 'Expected count ' . $count . '; received ' . count($unserialized)); + $this->assertSame( + $count, + count($unserialized), + 'Expected count ' . $count . '; received ' . count($unserialized) + ); $expected = []; foreach ($this->queue as $item) { @@ -106,7 +122,11 @@ public function testSerializationAndDeserializationShouldMaintainState() foreach ($unserialized as $item) { $test[] = $item; } - $this->assertSame($expected, $test, 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1)); + $this->assertSame( + $expected, + $test, + 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1) + ); } public function testCanRetrieveQueueAsArray() @@ -117,17 +137,7 @@ public function testCanRetrieveQueueAsArray() public function testIteratorFunctions() { - $this->queue->rewind(); - - $i = 0; - while ($this->queue->valid()) { - $key = $this->queue->key(); - $value = $this->queue->current(); - $this->assertEquals($this->expected[$i], $value); - $this->queue->next(); - ++$i; - } - $this->assertFalse($this->queue->valid()); + $this->assertEquals($this->expected, iterator_to_array($this->queue)); } public function testRewindOperation() @@ -154,11 +164,10 @@ public function testSetExtractFlag() $this->assertEquals($expected, $this->queue->extract()); } - /** - * @expectedException Zend\Stdlib\Exception\InvalidArgumentException - */ public function testSetInvalidExtractFlag() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('The extract flag specified is not valid'); $this->queue->setExtractFlags('foo'); } @@ -232,11 +241,7 @@ public function testRewindShouldNotRaiseErrorWhenQueueIsEmpty() $queue = new FastPriorityQueue(); $this->assertTrue($queue->isEmpty()); - set_error_handler(function ($errno, $errstr) { - $this->fail(sprintf('Error was raised by rewind() operation: %s', $errstr)); - }, E_WARNING); $queue->rewind(); - restore_error_handler(); } public function testRemoveShouldFindItemEvenIfMultipleItemsAreInQueue() @@ -285,4 +290,59 @@ public function testIterativelyRemovingItemsShouldRemoveAllItems() $this->assertFalse($queue->contains($listener), sprintf('Listener %s remained in queue', $i)); } } + + public function testRemoveShouldNotAffectExtract() + { + // Removing an element with low priority + $queue = new FastPriorityQueue(); + $queue->insert('a1', 1); + $queue->insert('a2', 1); + $queue->insert('b', 2); + $queue->remove('a1'); + $expected = ['b', 'a2']; + $test = []; + while ($value = $queue->extract()) { + $test[] = $value; + } + $this->assertEquals($expected, $test); + $this->assertTrue($queue->isEmpty()); + + // Removing an element in the middle of a set of elements with the same priority + $queue->insert('a1', 1); + $queue->insert('a2', 1); + $queue->insert('a3', 1); + $queue->remove('a2'); + $expected = ['a1', 'a3']; + $test = []; + while ($value = $queue->extract()) { + $test[] = $value; + } + $this->assertEquals($expected, $test); + $this->assertTrue($queue->isEmpty()); + + // Removing an element with high priority + $queue->insert('a', 1); + $queue->insert('b', 2); + $queue->remove('b'); + $expected = ['a']; + $test = []; + while ($value = $queue->extract()) { + $test[] = $value; + } + $this->assertEquals($expected, $test); + $this->assertTrue($queue->isEmpty()); + } + + public function testZeroPriority() + { + $queue = new FastPriorityQueue(); + $queue->insert('a', 0); + $queue->insert('b', 1); + $expected = ['b', 'a']; + $test = []; + foreach ($queue as $value) { + $test[] = $value; + } + $this->assertEquals($expected, $test); + } } diff --git a/test/GlobTest.php b/test/GlobTest.php index c03dd2695..4650ccce9 100644 --- a/test/GlobTest.php +++ b/test/GlobTest.php @@ -9,14 +9,15 @@ namespace ZendTest\Stdlib; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; +use Zend\Stdlib\Exception\RuntimeException; use Zend\Stdlib\Glob; class GlobTest extends TestCase { public function testFallback() { - if (!defined('GLOB_BRACE')) { + if (! defined('GLOB_BRACE')) { $this->markTestSkipped('GLOB_BRACE not available'); } @@ -34,9 +35,9 @@ public function testNonMatchingGlobReturnsArray() public function testThrowExceptionOnError() { - $this->setExpectedException('Zend\Stdlib\Exception\RuntimeException'); + $this->expectException(RuntimeException::class); - // run into a max path lengh error + // run into a max path length error $path = '/' . str_repeat('a', 10000); Glob::glob($path); } diff --git a/test/Guard/ArrayOrTraversableGuardTraitTest.php b/test/Guard/ArrayOrTraversableGuardTraitTest.php index 313d2f36c..db16ac75b 100644 --- a/test/Guard/ArrayOrTraversableGuardTraitTest.php +++ b/test/Guard/ArrayOrTraversableGuardTraitTest.php @@ -9,30 +9,21 @@ namespace ZendTest\Stdlib\Guard; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; +use Zend\Stdlib\Exception\InvalidArgumentException; use ZendTest\Stdlib\TestAsset\GuardedObject; use Zend\Stdlib\ArrayObject; /** - * @requires PHP 5.4 * @covers Zend\Stdlib\Guard\ArrayOrTraversableGuardTrait */ class ArrayOrTraversableGuardTraitTest extends TestCase { - public function setUp() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Only valid for php >= 5.4'); - } - } - public function testGuardForArrayOrTraversableThrowsException() { $object = new GuardedObject; - $this->setExpectedException( - 'Zend\Stdlib\Exception\InvalidArgumentException', - 'Argument must be an array or Traversable, [string] given' - ); + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Argument must be an array or Traversable, [string] given'); $object->setArrayOrTraversable(''); } diff --git a/test/Guard/EmptyGuardTraitTest.php b/test/Guard/EmptyGuardTraitTest.php index 01a844065..f0889a7c7 100644 --- a/test/Guard/EmptyGuardTraitTest.php +++ b/test/Guard/EmptyGuardTraitTest.php @@ -9,29 +9,20 @@ namespace ZendTest\Stdlib\Guard; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; +use Zend\Stdlib\Exception\InvalidArgumentException; use ZendTest\Stdlib\TestAsset\GuardedObject; /** - * @requires PHP 5.4 * @covers Zend\Stdlib\Guard\EmptyGuardTrait */ class EmptyGuardTraitTest extends TestCase { - public function setUp() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Only valid for php >= 5.4'); - } - } - public function testGuardAgainstEmptyThrowsException() { $object = new GuardedObject; - $this->setExpectedException( - 'Zend\Stdlib\Exception\InvalidArgumentException', - 'Argument cannot be empty' - ); + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Argument cannot be empty'); $object->setNotEmpty(''); } diff --git a/test/Guard/NullGuardTraitTest.php b/test/Guard/NullGuardTraitTest.php index 7c48ad3dd..2d6a774d3 100644 --- a/test/Guard/NullGuardTraitTest.php +++ b/test/Guard/NullGuardTraitTest.php @@ -9,29 +9,21 @@ namespace ZendTest\Stdlib\Guard; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; +use Zend\Stdlib\Exception\InvalidArgumentException; use ZendTest\Stdlib\TestAsset\GuardedObject; /** - * @requires PHP 5.4 * @covers Zend\Stdlib\Guard\NullGuardTrait */ class NullGuardTraitTest extends TestCase { - public function setUp() - { - if (version_compare(PHP_VERSION, '5.4.0', '<')) { - $this->markTestSkipped('Only valid for php >= 5.4'); - } - } - public function testGuardAgainstNullThrowsException() { $object = new GuardedObject; - $this->setExpectedException( - 'Zend\Stdlib\Exception\InvalidArgumentException', - 'Argument cannot be null' - ); + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Argument cannot be null'); + $object->setNotNull(null); } diff --git a/test/MessageTest.php b/test/MessageTest.php index 2ed2321b9..9148d1546 100644 --- a/test/MessageTest.php +++ b/test/MessageTest.php @@ -9,9 +9,11 @@ namespace ZendTest\Stdlib; +use PHPUnit\Framework\TestCase; +use Zend\Stdlib\Exception\InvalidArgumentException; use Zend\Stdlib\Message; -class MessageTest extends \PHPUnit_Framework_TestCase +class MessageTest extends TestCase { public function testMessageCanSetAndGetContent() { @@ -48,7 +50,7 @@ public function testMessageThrowsExceptionOnInvalidKeyForMetadataSet() { $message = new Message(); - $this->setExpectedException('Zend\Stdlib\Exception\InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $message->setMetadata(new \stdClass()); } @@ -56,7 +58,7 @@ public function testMessageThrowsExceptionOnInvalidKeyForMetadataGet() { $message = new Message(); - $this->setExpectedException('Zend\Stdlib\Exception\InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $message->getMetadata(new \stdClass()); } diff --git a/test/OptionsTest.php b/test/OptionsTest.php index c1fb77fef..82f0557fa 100644 --- a/test/OptionsTest.php +++ b/test/OptionsTest.php @@ -10,13 +10,16 @@ namespace ZendTest\Stdlib; use ArrayObject; +use BadMethodCallException; +use InvalidArgumentException; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\Exception; use ZendTest\Stdlib\TestAsset\TestOptions; use ZendTest\Stdlib\TestAsset\TestOptionsDerived; use ZendTest\Stdlib\TestAsset\TestOptionsNoStrict; use ZendTest\Stdlib\TestAsset\TestOptionsWithoutGetter; -class OptionsTest extends \PHPUnit_Framework_TestCase +class OptionsTest extends TestCase { public function testConstructionWithArray() { @@ -42,7 +45,7 @@ public function testConstructionWithOptions() public function testInvalidFieldThrowsException() { - $this->setExpectedException('BadMethodCallException'); + $this->expectException(BadMethodCallException::class); new TestOptions(['foo' => 'bar']); } @@ -73,7 +76,7 @@ public function testUnsetThrowsInvalidArgumentException() { $options = new TestOptions; - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); unset($options->foobarField); } @@ -82,7 +85,7 @@ public function testGetThrowsBadMethodCallException() { $options = new TestOptions(); - $this->setExpectedException('BadMethodCallException'); + $this->expectException(BadMethodCallException::class); $options->fieldFoobar; } @@ -98,7 +101,7 @@ public function testSetFromArrayAcceptsArray() public function testSetFromArrayThrowsInvalidArgumentException() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $options = new TestOptions; $options->setFromArray('asd'); } @@ -119,8 +122,8 @@ public function testParentProtectedProperty() public function testParentPrivateProperty() { - $this->setExpectedException( - 'Zend\Stdlib\Exception\BadMethodCallException', + $this->expectException(Exception\BadMethodCallException::class); + $this->expectExceptionMessage( 'The option "parent_private" does not have a callable "setParentPrivate" ("setparentprivate")' . ' setter method which must be defined' ); @@ -144,8 +147,8 @@ public function testDerivedProtectedProperty() public function testDerivedPrivateProperty() { - $this->setExpectedException( - 'Zend\Stdlib\Exception\BadMethodCallException', + $this->expectException(Exception\BadMethodCallException::class); + $this->expectExceptionMessage( 'The option "derived_private" does not have a callable "setDerivedPrivate" ("setderivedprivate")' .' setter method which must be defined' ); @@ -155,8 +158,8 @@ public function testDerivedPrivateProperty() public function testExceptionMessageContainsActualUsedSetter() { - $this->setExpectedException( - 'BadMethodCallException', + $this->expectException(BadMethodCallException::class); + $this->expectExceptionMessage( 'The option "foo bar" does not have a callable "setFooBar" ("setfoo bar")' . ' setter method which must be defined' ); @@ -184,11 +187,9 @@ public function testIssetDoesNotThrowExceptionWhenMatchingGetterDoesNotExist() { $options = new TestOptionsWithoutGetter(); - try { - isset($options->foo); - } catch (Exception\BadMethodCallException $exception) { - $this->fail("Unexpected BadMethodCallException raised"); - } + isset($options->foo); + + $this->addToAssertionCount(1); } /** diff --git a/test/ParametersTest.php b/test/ParametersTest.php index bb5ff0973..40b1d69ed 100644 --- a/test/ParametersTest.php +++ b/test/ParametersTest.php @@ -9,9 +9,10 @@ namespace ZendTest\Stdlib; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\Parameters; -class ParametersTest extends \PHPUnit_Framework_TestCase +class ParametersTest extends TestCase { public function testParametersConstructionAndClassStructure() { diff --git a/test/PriorityListTest.php b/test/PriorityListTest.php index 060059417..d60ace941 100644 --- a/test/PriorityListTest.php +++ b/test/PriorityListTest.php @@ -10,7 +10,7 @@ namespace ZendTest\Stdlib; use Zend\Stdlib\PriorityList; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; class PriorityListTest extends TestCase { @@ -68,6 +68,8 @@ public function testRemove() public function testRemovingNonExistentRouteDoesNotYieldError() { $this->list->remove('foo'); + + $this->assertEmpty($this->list); } public function testClear() @@ -95,17 +97,13 @@ public function testGet() public function testLIFOOnly() { - $this->list->insert('foo', new \stdClass()); - $this->list->insert('bar', new \stdClass()); - $this->list->insert('baz', new \stdClass()); + $this->list->insert('foo', new \stdClass()); + $this->list->insert('bar', new \stdClass()); + $this->list->insert('baz', new \stdClass()); $this->list->insert('foobar', new \stdClass()); $this->list->insert('barbaz', new \stdClass()); - $orders = []; - - foreach ($this->list as $key => $value) { - $orders[] = $key; - } + $orders = array_keys(iterator_to_array($this->list)); $this->assertEquals(['barbaz', 'foobar', 'baz', 'bar', 'foo'], $orders); } @@ -116,11 +114,7 @@ public function testPriorityOnly() $this->list->insert('bar', new \stdClass(), 0); $this->list->insert('baz', new \stdClass(), 2); - $order = []; - - foreach ($this->list as $key => $value) { - $orders[] = $key; - } + $orders = array_keys(iterator_to_array($this->list)); $this->assertEquals(['baz', 'foo', 'bar'], $orders); } @@ -131,11 +125,7 @@ public function testLIFOWithPriority() $this->list->insert('bar', new \stdClass(), 0); $this->list->insert('baz', new \stdClass(), 1); - $orders = []; - - foreach ($this->list as $key => $value) { - $orders[] = $key; - } + $orders = array_keys(iterator_to_array($this->list)); $this->assertEquals(['baz', 'bar', 'foo'], $orders); } @@ -147,11 +137,7 @@ public function testFIFOWithPriority() $this->list->insert('bar', new \stdClass(), 0); $this->list->insert('baz', new \stdClass(), 1); - $orders = []; - - foreach ($this->list as $key => $value) { - $orders[] = $key; - } + $orders = array_keys(iterator_to_array($this->list)); $this->assertEquals(['baz', 'foo', 'bar'], $orders); } @@ -159,17 +145,13 @@ public function testFIFOWithPriority() public function testFIFOOnly() { $this->list->isLIFO(false); - $this->list->insert('foo', new \stdClass()); - $this->list->insert('bar', new \stdClass()); - $this->list->insert('baz', new \stdClass()); + $this->list->insert('foo', new \stdClass()); + $this->list->insert('bar', new \stdClass()); + $this->list->insert('baz', new \stdClass()); $this->list->insert('foobar', new \stdClass()); $this->list->insert('barbaz', new \stdClass()); - $orders = []; - - foreach ($this->list as $key => $value) { - $orders[] = $key; - } + $orders = array_keys(iterator_to_array($this->list)); $this->assertEquals(['foo', 'bar', 'baz', 'foobar', 'barbaz'], $orders); } @@ -180,11 +162,7 @@ public function testPriorityWithNegativesAndNull() $this->list->insert('bar', new \stdClass(), 1); $this->list->insert('baz', new \stdClass(), -1); - $orders = []; - - foreach ($this->list as $key => $value) { - $orders[] = $key; - } + $orders = array_keys(iterator_to_array($this->list)); $this->assertEquals(['bar', 'foo', 'baz'], $orders); } @@ -226,8 +204,8 @@ public function testToArray() $this->assertEquals( [ - 'bar' => ['data' => 'bar_value', 'priority' => 1, 'serial' => 1], - 'foo' => ['data' => 'foo_value', 'priority' => 0, 'serial' => 0], + 'bar' => ['data' => 'bar_value', 'priority' => 1, 'serial' => 1], + 'foo' => ['data' => 'foo_value', 'priority' => 0, 'serial' => 0], 'baz' => ['data' => 'baz_value', 'priority' => -1, 'serial' => 2], ], $this->list->toArray(PriorityList::EXTR_BOTH) diff --git a/test/PriorityQueueTest.php b/test/PriorityQueueTest.php index 7f968cb6c..4a49eb75d 100644 --- a/test/PriorityQueueTest.php +++ b/test/PriorityQueueTest.php @@ -9,12 +9,13 @@ namespace ZendTest\Stdlib; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\PriorityQueue; /** * @group Zend_Stdlib */ -class PriorityQueueTest extends \PHPUnit_Framework_TestCase +class PriorityQueueTest extends TestCase { /** * @var PriorityQueue @@ -35,17 +36,19 @@ public function testSerializationAndDeserializationShouldMaintainState() $s = serialize($this->queue); $unserialized = unserialize($s); $count = count($this->queue); - $this->assertSame($count, count($unserialized), 'Expected count ' . $count . '; received ' . count($unserialized)); - - $expected = []; - foreach ($this->queue as $item) { - $expected[] = $item; - } - $test = []; - foreach ($unserialized as $item) { - $test[] = $item; - } - $this->assertSame($expected, $test, 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1)); + $this->assertSame( + $count, + count($unserialized), + 'Expected count ' . $count . '; received ' . count($unserialized) + ); + + $expected = iterator_to_array($this->queue); + $test = iterator_to_array($unserialized); + $this->assertSame( + $expected, + $test, + 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1) + ); } public function testRetrievingQueueAsArrayReturnsDataOnlyByDefault() @@ -101,10 +104,7 @@ public function testCanRemoveItemFromQueue() { $this->queue->remove('baz'); $expected = ['bar', 'foo', 'bat']; - $test = []; - foreach ($this->queue as $item) { - $test[] = $item; - } + $test = array_values(iterator_to_array($this->queue)); $this->assertEquals($expected, $test); } @@ -131,7 +131,7 @@ public function testCloningAlsoClonesQueue() $queueClone = clone $queue; - while (!$queue->isEmpty()) { + while (! $queue->isEmpty()) { $this->assertSame($foo, $queue->top()); $queue->remove($queue->top()); } @@ -140,7 +140,7 @@ public function testCloningAlsoClonesQueue() $this->assertFalse($queueClone->isEmpty()); $this->assertEquals(2, $queueClone->count()); - while (!$queueClone->isEmpty()) { + while (! $queueClone->isEmpty()) { $this->assertSame($foo, $queueClone->top()); $queueClone->remove($queueClone->top()); } diff --git a/test/SplPriorityQueueTest.php b/test/SplPriorityQueueTest.php index 95fe5f60f..eb3b83d2f 100644 --- a/test/SplPriorityQueueTest.php +++ b/test/SplPriorityQueueTest.php @@ -9,13 +9,19 @@ namespace ZendTest\Stdlib; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\SplPriorityQueue; /** * @group Zend_Stdlib */ -class SplPriorityQueueTest extends \PHPUnit_Framework_TestCase +class SplPriorityQueueTest extends TestCase { + /** + * @var SplPriorityQueue + */ + protected $queue; + public function setUp() { $this->queue = new SplPriorityQueue(); @@ -34,10 +40,7 @@ public function testMaintainsInsertOrderForDataOfEqualPriority() $queue->insert('bat', 1000); $expected = ['foo', 'bar', 'baz', 'bat']; - $test = []; - foreach ($queue as $datum) { - $test[] = $datum; - } + $test = array_values(iterator_to_array($queue)); $this->assertEquals($expected, $test); } @@ -45,18 +48,15 @@ public function testSerializationAndDeserializationShouldMaintainState() { $s = serialize($this->queue); $unserialized = unserialize($s); - $count = count($this->queue); - $this->assertSame($count, count($unserialized), 'Expected count ' . $count . '; received ' . count($unserialized)); - $expected = []; - foreach ($this->queue as $item) { - $expected[] = $item; - } - $test = []; - foreach ($unserialized as $item) { - $test[] = $item; - } - $this->assertSame($expected, $test, 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1)); + // assert same size + $this->assertSameSize($this->queue, $unserialized); + + // assert same values + $this->assertSame(iterator_to_array($this->queue), iterator_to_array($unserialized)); + + // assert equal + $this->assertEquals($this->queue, $unserialized); } public function testCanRetrieveQueueAsArray() diff --git a/test/SplQueueTest.php b/test/SplQueueTest.php index af2fd688d..b1022b39d 100644 --- a/test/SplQueueTest.php +++ b/test/SplQueueTest.php @@ -9,13 +9,19 @@ namespace ZendTest\Stdlib; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\SplQueue; /** * @group Zend_Stdlib */ -class SplQueueTest extends \PHPUnit_Framework_TestCase +class SplQueueTest extends TestCase { + /** + * @var SplQueue + */ + protected $queue; + public function setUp() { $this->queue = new SplQueue(); @@ -31,14 +37,8 @@ public function testSerializationAndDeserializationShouldMaintainState() $count = count($this->queue); $this->assertSame($count, count($unserialized)); - $expected = []; - foreach ($this->queue as $item) { - $expected[] = $item; - } - $test = []; - foreach ($unserialized as $item) { - $test[] = $item; - } + $expected = iterator_to_array($this->queue); + $test = iterator_to_array($unserialized); $this->assertSame($expected, $test); } diff --git a/test/SplStackTest.php b/test/SplStackTest.php index be36aa079..c99730969 100644 --- a/test/SplStackTest.php +++ b/test/SplStackTest.php @@ -9,13 +9,19 @@ namespace ZendTest\Stdlib; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\SplStack; /** * @group Zend_Stdlib */ -class SplStackTest extends \PHPUnit_Framework_TestCase +class SplStackTest extends TestCase { + /** + * @var SplStack + */ + protected $stack; + public function setUp() { $this->stack = new SplStack(); @@ -32,14 +38,8 @@ public function testSerializationAndDeserializationShouldMaintainState() $count = count($this->stack); $this->assertSame($count, count($unserialized)); - $expected = []; - foreach ($this->stack as $item) { - $expected[] = $item; - } - $test = []; - foreach ($unserialized as $item) { - $test[] = $item; - } + $expected = iterator_to_array($this->stack); + $test = iterator_to_array($unserialized); $this->assertSame($expected, $test); } diff --git a/test/StringUtilsTest.php b/test/StringUtilsTest.php index 07aeca0e5..c24d90a95 100644 --- a/test/StringUtilsTest.php +++ b/test/StringUtilsTest.php @@ -9,7 +9,8 @@ namespace ZendTest\Stdlib; -use PHPUnit_Framework_TestCase as TestCase; +use Exception; +use PHPUnit\Framework\TestCase; use Zend\Stdlib\ErrorHandler; use Zend\Stdlib\StringUtils; diff --git a/test/StringWrapper/CommonStringWrapperTest.php b/test/StringWrapper/CommonStringWrapperTest.php index 715423f1c..416752677 100644 --- a/test/StringWrapper/CommonStringWrapperTest.php +++ b/test/StringWrapper/CommonStringWrapperTest.php @@ -9,10 +9,15 @@ namespace ZendTest\Stdlib\StringWrapper; -use PHPUnit_Framework_TestCase as TestCase; +use PHPUnit\Framework\TestCase; +use Zend\Stdlib\Exception; +use Zend\Stdlib\StringWrapper\StringWrapperInterface; abstract class CommonStringWrapperTest extends TestCase { + /** + * @return StringWrapperInterface + */ abstract protected function getWrapper($encoding = null, $convertEncoding = null); public function strlenProvider() @@ -26,14 +31,15 @@ public function strlenProvider() /** * @dataProvider strlenProvider + * * @param string $encoding - * @param string $string + * @param string $str * @param mixed $expected */ public function testStrlen($encoding, $str, $expected) { $wrapper = $this->getWrapper($encoding); - if (!$wrapper) { + if (! $wrapper) { $this->markTestSkipped("Encoding {$encoding} not supported"); } @@ -52,6 +58,7 @@ public function substrProvider() /** * @dataProvider substrProvider + * * @param string $encoding * @param string $str * @param int $offset @@ -61,7 +68,7 @@ public function substrProvider() public function testSubstr($encoding, $str, $offset, $length, $expected) { $wrapper = $this->getWrapper($encoding); - if (!$wrapper) { + if (! $wrapper) { $this->markTestSkipped("Encoding {$encoding} not supported"); } @@ -80,6 +87,7 @@ public function strposProvider() /** * @dataProvider strposProvider + * * @param string $encoding * @param string $haystack * @param string $needle @@ -89,7 +97,7 @@ public function strposProvider() public function testStrpos($encoding, $haystack, $needle, $offset, $expected) { $wrapper = $this->getWrapper($encoding); - if (!$wrapper) { + if (! $wrapper) { $this->markTestSkipped("Encoding {$encoding} not supported"); } @@ -110,6 +118,7 @@ public function convertProvider() /** * @dataProvider convertProvider + * * @param string $str * @param string $encoding * @param string $convertEncoding @@ -118,7 +127,7 @@ public function convertProvider() public function testConvert($encoding, $convertEncoding, $str, $expected) { $wrapper = $this->getWrapper($encoding, $convertEncoding); - if (!$wrapper) { + if (! $wrapper) { $this->markTestSkipped("Encoding {$encoding} or {$convertEncoding} not supported"); } @@ -132,93 +141,64 @@ public function testConvert($encoding, $convertEncoding, $str, $expected) public function wordWrapProvider() { + // @codingStandardsIgnoreStart return [ // Standard cut tests - 'cut-single-line' => - ['utf-8', 'äbüöcß', 2, ' ', true, 'äb üö cß'], - 'cut-multi-line' => - ['utf-8', 'äbüöc ß äbüöcß', 2, ' ', true, 'äb üö c ß äb üö cß'], - 'cut-multi-line-short-words' => - ['utf-8', 'Ä very long wöööööööööööörd.', 8, "\n", true, - "Ä very\nlong\nwööööööö\nööööörd."], - 'cut-multi-line-with-previous-new-lines' => - ['utf-8', "Ä very\nlong wöööööööööööörd.", 8, "\n", false, - "Ä very\nlong\nwöööööööööööörd."], - 'long-break' => - ['utf-8', "Ä very
long wöö
öööööööö
öörd.", 8, '
', false, - "Ä very
long wöö
öööööööö
öörd."], + 'cut-single-line' => ['utf-8', 'äbüöcß', 2, ' ', true, 'äb üö cß'], + 'cut-multi-line' => ['utf-8', 'äbüöc ß äbüöcß', 2, ' ', true, 'äb üö c ß äb üö cß'], + 'cut-multi-line-short-words' => ['utf-8', 'Ä very long wöööööööööööörd.', 8, "\n", true, "Ä very\nlong\nwööööööö\nööööörd."], + 'cut-multi-line-with-previous-new-lines' => ['utf-8', "Ä very\nlong wöööööööööööörd.", 8, "\n", false, "Ä very\nlong\nwöööööööööööörd."], + 'long-break' => ['utf-8', "Ä very
long wöö
öööööööö
öörd.", 8, '
', false, "Ä very
long wöö
öööööööö
öörd."], // Alternative cut tests - 'cut-beginning-single-space' => - ['utf-8', ' äüöäöü', 3, ' ', true, ' äüö äöü'], - 'cut-ending-single-space' => - ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], - 'cut-ending-single-space-with-non-space-divider' => - ['utf-8', 'äöüäöü ', 3, '-', true, 'äöü-äöü-'], - 'cut-ending-two-spaces' => - ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], - 'no-cut-ending-single-space' => - ['utf-8', '12345 ', 5, '-', false, '12345-'], - 'no-cut-ending-two-spaces' => - ['utf-8', '12345 ', 5, '-', false, '12345- '], - 'cut-ending-three-spaces' => - ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], - 'cut-ending-two-breaks' => - ['utf-8', 'äüöäöü--', 3, '-', true, 'äüö-äöü--'], - 'cut-tab' => - ['utf-8', "äbü\töcß", 3, ' ', true, "äbü \töc ß"], - 'cut-new-line-with-space' => - ['utf-8', "äbü\nößt", 3, ' ', true, "äbü \nöß t"], - 'cut-new-line-with-new-line' => - ['utf-8', "äbü\nößte", 3, "\n", true, "äbü\nößt\ne"], + 'cut-beginning-single-space' => ['utf-8', ' äüöäöü', 3, ' ', true, ' äüö äöü'], + 'cut-ending-single-space' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], + 'cut-ending-single-space-with-non-space-divider' => ['utf-8', 'äöüäöü ', 3, '-', true, 'äöü-äöü-'], + 'cut-ending-two-spaces' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], + 'no-cut-ending-single-space' => ['utf-8', '12345 ', 5, '-', false, '12345-'], + 'no-cut-ending-two-spaces' => ['utf-8', '12345 ', 5, '-', false, '12345- '], + 'cut-ending-three-spaces' => ['utf-8', 'äüöäöü ', 3, ' ', true, 'äüö äöü '], + 'cut-ending-two-breaks' => ['utf-8', 'äüöäöü--', 3, '-', true, 'äüö-äöü--'], + 'cut-tab' => ['utf-8', "äbü\töcß", 3, ' ', true, "äbü \töc ß"], + 'cut-new-line-with-space' => ['utf-8', "äbü\nößt", 3, ' ', true, "äbü \nöß t"], + 'cut-new-line-with-new-line' => ['utf-8', "äbü\nößte", 3, "\n", true, "äbü\nößt\ne"], // Break cut tests - 'cut-break-before' => - ['ascii', 'foobar-foofoofoo', 8, '-', true, 'foobar-foofoofo-o'], - 'cut-break-with' => - ['ascii', 'foobar-foobar', 6, '-', true, 'foobar-foobar'], - 'cut-break-within' => - ['ascii', 'foobar-foobar', 7, '-', true, 'foobar-foobar'], - 'cut-break-within-end' => - ['ascii', 'foobar-', 7, '-', true, 'foobar-'], - 'cut-break-after' => - ['ascii', 'foobar-foobar', 5, '-', true, 'fooba-r-fooba-r'], + 'cut-break-before' => ['ascii', 'foobar-foofoofoo', 8, '-', true, 'foobar-foofoofo-o'], + 'cut-break-with' => ['ascii', 'foobar-foobar', 6, '-', true, 'foobar-foobar'], + 'cut-break-within' => ['ascii', 'foobar-foobar', 7, '-', true, 'foobar-foobar'], + 'cut-break-within-end' => ['ascii', 'foobar-', 7, '-', true, 'foobar-'], + 'cut-break-after' => ['ascii', 'foobar-foobar', 5, '-', true, 'fooba-r-fooba-r'], // Standard no-cut tests - 'no-cut-single-line' => - ['utf-8', 'äbüöcß', 2, ' ', false, 'äbüöcß'], - 'no-cut-multi-line' => - ['utf-8', 'äbüöc ß äbüöcß', 2, "\n", false, "äbüöc\nß\näbüöcß"], - 'no-cut-multi-word' => - ['utf-8', 'äöü äöü äöü', 5, "\n", false, "äöü\näöü\näöü"], + 'no-cut-single-line' => ['utf-8', 'äbüöcß', 2, ' ', false, 'äbüöcß'], + 'no-cut-multi-line' => ['utf-8', 'äbüöc ß äbüöcß', 2, "\n", false, "äbüöc\nß\näbüöcß"], + 'no-cut-multi-word' => ['utf-8', 'äöü äöü äöü', 5, "\n", false, "äöü\näöü\näöü"], // Break no-cut tests - 'no-cut-break-before' => - ['ascii', 'foobar-foofoofoo', 8, '-', false, 'foobar-foofoofoo'], - 'no-cut-break-with' => - ['ascii', 'foobar-foobar', 6, '-', false, 'foobar-foobar'], - 'no-cut-break-within' => - ['ascii', 'foobar-foobar', 7, '-', false, 'foobar-foobar'], - 'no-cut-break-within-end' => - ['ascii', 'foobar-', 7, '-', false, 'foobar-'], - 'no-cut-break-after' => - ['ascii', 'foobar-foobar', 5, '-', false, 'foobar-foobar'], + 'no-cut-break-before' => ['ascii', 'foobar-foofoofoo', 8, '-', false, 'foobar-foofoofoo'], + 'no-cut-break-with' => ['ascii', 'foobar-foobar', 6, '-', false, 'foobar-foobar'], + 'no-cut-break-within' => ['ascii', 'foobar-foobar', 7, '-', false, 'foobar-foobar'], + 'no-cut-break-within-end' => ['ascii', 'foobar-', 7, '-', false, 'foobar-'], + 'no-cut-break-after' => ['ascii', 'foobar-foobar', 5, '-', false, 'foobar-foobar'], ]; + // @codingStandardsIgnoreEnd } /** * @dataProvider wordWrapProvider - * @param string $encoding - * @param string $str - * @param integer $width - * @param string $break - * @param bool $cut - * @param mixed $expected + * + * @param string $encoding + * @param string $string + * @param int $width + * @param string $break + * @param bool $cut + * @param mixed $expected */ public function testWordWrap($encoding, $string, $width, $break, $cut, $expected) { $wrapper = $this->getWrapper($encoding); - if (!$wrapper) { + if (! $wrapper) { $this->markTestSkipped("Encoding {$encoding} not supported"); } @@ -229,12 +209,11 @@ public function testWordWrap($encoding, $string, $width, $break, $cut, $expected public function testWordWrapInvalidArgument() { $wrapper = $this->getWrapper(); - if (!$wrapper) { + if (! $wrapper) { $this->fail("Can't instantiate wrapper"); } - - $this->setExpectedException( - 'Zend\Stdlib\Exception\InvalidArgumentException', + $this->expectException(Exception\InvalidArgumentException::class); + $this->expectExceptionMessage( "Cannot force cut when width is zero" ); $wrapper->wordWrap('a', 0, "\n", true); @@ -244,46 +223,38 @@ public function strPadProvider() { return [ // single-byte - 'left-padding_single-byte' => - ['ascii', 'aaa', 5, 'o', STR_PAD_LEFT, 'ooaaa'], - 'center-padding_single-byte' => - ['ascii', 'aaa', 6, 'o', STR_PAD_BOTH, 'oaaaoo'], - 'right-padding_single-byte' => - ['ascii', 'aaa', 5, 'o', STR_PAD_RIGHT, 'aaaoo'], + 'left-padding_single-byte' => ['ascii', 'aaa', 5, 'o', STR_PAD_LEFT, 'ooaaa'], + 'center-padding_single-byte' => ['ascii', 'aaa', 6, 'o', STR_PAD_BOTH, 'oaaaoo'], + 'right-padding_single-byte' => ['ascii', 'aaa', 5, 'o', STR_PAD_RIGHT, 'aaaoo'], // multi-byte - 'left-padding_multi-byte' => - ['utf-8', 'äää', 5, 'ö', STR_PAD_LEFT, 'ööäää'], - 'center-padding_multi-byte' => - ['utf-8', 'äää', 6, 'ö', STR_PAD_BOTH, 'öäääöö'], - 'right-padding_multi-byte' => - ['utf-8', 'äää', 5, 'ö', STR_PAD_RIGHT, 'äääöö'], + 'left-padding_multi-byte' => ['utf-8', 'äää', 5, 'ö', STR_PAD_LEFT, 'ööäää'], + 'center-padding_multi-byte' => ['utf-8', 'äää', 6, 'ö', STR_PAD_BOTH, 'öäääöö'], + 'right-padding_multi-byte' => ['utf-8', 'äää', 5, 'ö', STR_PAD_RIGHT, 'äääöö'], // ZF-12186 - 'input-longer-than-pad-length' => - ['utf-8', 'äääöö', 2, 'ö', STR_PAD_RIGHT, 'äääöö'], - 'input-same-as-pad-length' => - ['utf-8', 'äääöö', 5, 'ö', STR_PAD_RIGHT, 'äääöö'], - 'negative-pad-length' => - ['utf-8', 'äääöö', -2, 'ö', STR_PAD_RIGHT, 'äääöö'], + 'input-longer-than-pad-length' => ['utf-8', 'äääöö', 2, 'ö', STR_PAD_RIGHT, 'äääöö'], + 'input-same-as-pad-length' => ['utf-8', 'äääöö', 5, 'ö', STR_PAD_RIGHT, 'äääöö'], + 'negative-pad-length' => ['utf-8', 'äääöö', -2, 'ö', STR_PAD_RIGHT, 'äääöö'], ]; } /** * @dataProvider strPadProvider - * @param string $encoding - * @param string $input - * @param integer $padLength - * @param string $padString - * @param integer $padType - * @param mixed $expected + * + * @param string $encoding + * @param string $input + * @param int $padLength + * @param string $padString + * @param int $padType + * @param mixed $expected * * @group ZF-12186 */ public function testStrPad($encoding, $input, $padLength, $padString, $padType, $expected) { $wrapper = $this->getWrapper($encoding); - if (!$wrapper) { + if (! $wrapper) { $this->markTestSkipped("Encoding {$encoding} not supported"); } diff --git a/test/StringWrapper/IconvTest.php b/test/StringWrapper/IconvTest.php index 043825b79..8138a02a0 100644 --- a/test/StringWrapper/IconvTest.php +++ b/test/StringWrapper/IconvTest.php @@ -16,7 +16,7 @@ class IconvTest extends CommonStringWrapperTest { public function setUp() { - if (!extension_loaded('iconv')) { + if (! extension_loaded('iconv')) { try { new Iconv('utf-8'); $this->fail('Missing expected Zend\Stdlib\Exception\ExtensionNotLoadedException'); @@ -35,7 +35,7 @@ protected function getWrapper($encoding = null, $convertEncoding = null) $encoding = array_shift($supportedEncodings); } - if (!Iconv::isSupported($encoding, $convertEncoding)) { + if (! Iconv::isSupported($encoding, $convertEncoding)) { return false; } diff --git a/test/StringWrapper/IntlTest.php b/test/StringWrapper/IntlTest.php index 95577bde2..6bd6b577e 100644 --- a/test/StringWrapper/IntlTest.php +++ b/test/StringWrapper/IntlTest.php @@ -16,7 +16,7 @@ class IntlTest extends CommonStringWrapperTest { public function setUp() { - if (!extension_loaded('intl')) { + if (! extension_loaded('intl')) { try { new Intl('utf-8'); $this->fail('Missing expected Zend\Stdlib\Exception\ExtensionNotLoadedException'); @@ -35,7 +35,7 @@ protected function getWrapper($encoding = null, $convertEncoding = null) $encoding = array_shift($supportedEncodings); } - if (!Intl::isSupported($encoding, $convertEncoding)) { + if (! Intl::isSupported($encoding, $convertEncoding)) { return false; } diff --git a/test/StringWrapper/MbStringTest.php b/test/StringWrapper/MbStringTest.php index 2d4efd14c..4b69b57ca 100644 --- a/test/StringWrapper/MbStringTest.php +++ b/test/StringWrapper/MbStringTest.php @@ -16,7 +16,7 @@ class MbStringTest extends CommonStringWrapperTest { public function setUp() { - if (!extension_loaded('mbstring')) { + if (! extension_loaded('mbstring')) { try { new MbString('utf-8'); $this->fail('Missing expected Zend\Stdlib\Exception\ExtensionNotLoadedException'); @@ -35,7 +35,7 @@ protected function getWrapper($encoding = null, $convertEncoding = null) $encoding = array_shift($supportedEncodings); } - if (!MbString::isSupported($encoding, $convertEncoding)) { + if (! MbString::isSupported($encoding, $convertEncoding)) { return false; } diff --git a/test/StringWrapper/NativeTest.php b/test/StringWrapper/NativeTest.php index 76f1d7a2f..d74090de3 100644 --- a/test/StringWrapper/NativeTest.php +++ b/test/StringWrapper/NativeTest.php @@ -20,7 +20,7 @@ protected function getWrapper($encoding = null, $convertEncoding = null) $encoding = array_shift($supportedEncodings); } - if (!Native::isSupported($encoding, $convertEncoding)) { + if (! Native::isSupported($encoding, $convertEncoding)) { return false; } diff --git a/test/TestAsset/ArrayObjectIterator.php b/test/TestAsset/ArrayObjectIterator.php index 1e9cce878..6c5bf8865 100644 --- a/test/TestAsset/ArrayObjectIterator.php +++ b/test/TestAsset/ArrayObjectIterator.php @@ -8,10 +8,11 @@ */ namespace ZendTest\Stdlib\TestAsset; + class ArrayObjectIterator implements \Iterator { - private $var = array(); + private $var = []; public function __construct($array) { @@ -43,7 +44,7 @@ public function next() public function valid() { $key = key($this->var); - $var = ($key !== NULL && $key !== FALSE); + $var = ($key !== null && $key !== false); return $var; } diff --git a/test/TestAsset/ArrayObjectObjectCount.php b/test/TestAsset/ArrayObjectObjectCount.php new file mode 100644 index 000000000..fef278f65 --- /dev/null +++ b/test/TestAsset/ArrayObjectObjectCount.php @@ -0,0 +1,18 @@ +data = array( + $this->data = [ "foo" => "bar", "bar" => "foo", "blubb" => "baz", "quo" => "blubb" - ); + ]; } /** diff --git a/test/TestAsset/TestOptionsNoStrict.php b/test/TestAsset/TestOptionsNoStrict.php index 5e0fa1e65..546fce80a 100644 --- a/test/TestAsset/TestOptionsNoStrict.php +++ b/test/TestAsset/TestOptionsNoStrict.php @@ -16,7 +16,9 @@ */ class TestOptionsNoStrict extends AbstractOptions { + // @codingStandardsIgnoreStart protected $__strictMode__ = false; + // @codingStandardsIgnoreEnd protected $testField; diff --git a/test/bootstrap.php b/test/bootstrap.php deleted file mode 100644 index 570bf9e43..000000000 --- a/test/bootstrap.php +++ /dev/null @@ -1,34 +0,0 @@ -