diff --git a/CHANGELOG.md b/CHANGELOG.md index 699dab9..86d9872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,9 +85,13 @@ - Average collection function added - Min collection function added - Max collection function added -- ToArrray collection function added +- ToString collection function added - **Breaking change: sum utility function removed** - **Breaking change: average utility function removed** - **Breaking change: min utility function removed** - **Breaking change: max utility function removed** - **Breaking change: concatenate utility function removed** + +##8.0.0 +- **Breaking change: sum function will return integer by default, float if there are float type elements** +- **Breaking change: average function will not force return float and will return integer if the sum/count result is integer** diff --git a/composer.json b/composer.json index 35d47c8..6cf2d6e 100644 --- a/composer.json +++ b/composer.json @@ -14,13 +14,13 @@ } ], "require-dev": { - "phpspec/phpspec": "~2.0", - "henrikbjorn/phpspec-code-coverage": "*", - "squizlabs/php_codesniffer": "~2.0", - "phpmd/phpmd" : "2.2.1", - "ciaranmcnulty/phpspec-typehintedmethods": "*", - "phpunit/phpunit": "4.5.*", - "symfony/console": "~2.7" + "phpspec/phpspec": "^2.0", + "henrikbjorn/phpspec-code-coverage": "^2.0", + "squizlabs/php_codesniffer": "^2.0", + "phpmd/phpmd" : "^2.0", + "ciaranmcnulty/phpspec-typehintedmethods": "^1.0", + "phpunit/phpunit": "^5.0", + "symfony/console": "^2.7" }, "require": { "php": ">=5.6.0" diff --git a/composer.lock b/composer.lock index 8392349..37346de 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "28aae3e006e4f3e72214bda2a1d7b1ad", - "content-hash": "747a53fdd22302e658047804052f44c5", + "hash": "5a472b69cfe241e239c8710434928ae8", + "content-hash": "c247f88d7997ca5b4321e30b4c926e8f", "packages": [], "packages-dev": [ { @@ -112,28 +112,28 @@ }, { "name": "henrikbjorn/phpspec-code-coverage", - "version": "2.0.2", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/henrikbjorn/PhpSpecCodeCoverageExtension.git", - "reference": "121720787a390be78e307916313e9f225a39d803" + "reference": "528a0c69a524f8acba5f66bc59ae8dc9bc409045" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/henrikbjorn/PhpSpecCodeCoverageExtension/zipball/121720787a390be78e307916313e9f225a39d803", - "reference": "121720787a390be78e307916313e9f225a39d803", + "url": "https://api.github.com/repos/henrikbjorn/PhpSpecCodeCoverageExtension/zipball/528a0c69a524f8acba5f66bc59ae8dc9bc409045", + "reference": "528a0c69a524f8acba5f66bc59ae8dc9bc409045", "shasum": "" }, "require": { - "php": "^5.6|^7.0|^5.5", + "php": "^5.3.3|^5.4|^5.5|^5.6|^7.0", "phpspec/phpspec": "^2.0", - "phpunit/php-code-coverage": "^3|2.2.4" + "phpunit/php-code-coverage": "^2.2.4|^3" }, "require-dev": { "bossa/phpspec2-expect": "^1.0" }, "suggest": { - "ext-xdebug": "To allow Coverage generation." + "ext-xdebug": "To allow coverage generation when not using a recent version of phpdbg" }, "type": "library", "extra": { @@ -151,38 +151,81 @@ "MIT" ], "description": "Integrates CodeCoverage with PhpSpec", - "time": "2016-02-02 08:26:28" + "time": "2016-05-05 18:25:12" + }, + { + "name": "myclabs/deep-copy", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "a8773992b362b58498eed24bf85005f363c34771" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a8773992b362b58498eed24bf85005f363c34771", + "reference": "a8773992b362b58498eed24bf85005f363c34771", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2015-11-20 12:04:31" }, { "name": "pdepend/pdepend", - "version": "2.0.6", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/pdepend/pdepend.git", - "reference": "a15ffcbfbcc4570d4a733ca7b76e9cac0a56c3f4" + "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pdepend/pdepend/zipball/a15ffcbfbcc4570d4a733ca7b76e9cac0a56c3f4", - "reference": "a15ffcbfbcc4570d4a733ca7b76e9cac0a56c3f4", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/b086687f3a01dc6bb92d633aef071d2c5dd0db06", + "reference": "b086687f3a01dc6bb92d633aef071d2c5dd0db06", "shasum": "" }, "require": { - "symfony/config": ">=2.4", - "symfony/dependency-injection": ">=2.4", - "symfony/filesystem": ">=2.4" + "php": ">=5.3.7", + "symfony/config": "^2.3.0|^3", + "symfony/dependency-injection": "^2.3.0|^3", + "symfony/filesystem": "^2.3.0|^3" }, "require-dev": { - "phpunit/phpunit": "4.*@stable", - "squizlabs/php_codesniffer": "@stable" + "phpunit/phpunit": "^4.4.0,<4.8", + "squizlabs/php_codesniffer": "^2.0.0" }, "bin": [ "src/bin/pdepend" ], "type": "library", "autoload": { - "psr-0": { - "PDepend\\": "src/main/php/" + "psr-4": { + "PDepend\\": "src/main/php/PDepend" } }, "notification-url": "https://packagist.org/downloads/", @@ -190,7 +233,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2015-03-02 08:06:43" + "time": "2016-03-10 15:15:04" }, { "name": "phpdocumentor/reflection-docblock", @@ -243,28 +286,25 @@ }, { "name": "phpmd/phpmd", - "version": "2.2.1", + "version": "2.4.3", "source": { "type": "git", "url": "https://github.com/phpmd/phpmd.git", - "reference": "58c4b00f924d301e8c5281f40cfa9a66f3df9eee" + "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmd/phpmd/zipball/58c4b00f924d301e8c5281f40cfa9a66f3df9eee", - "reference": "58c4b00f924d301e8c5281f40cfa9a66f3df9eee", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/2b9c2417a18696dfb578b38c116cd0ddc19b256e", + "reference": "2b9c2417a18696dfb578b38c116cd0ddc19b256e", "shasum": "" }, "require": { - "pdepend/pdepend": "2.0.*", - "php": ">=5.3.0", - "symfony/config": ">=2.4", - "symfony/dependency-injection": ">=2.4", - "symfony/filesystem": ">=2.4" + "pdepend/pdepend": "^2.0.4", + "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "*", - "squizlabs/php_codesniffer": "*" + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.0" }, "bin": [ "src/bin/phpmd" @@ -284,12 +324,18 @@ "name": "Manuel Pichler", "email": "github@manuel-pichler.de", "homepage": "https://github.com/manuelpichler", - "role": "Project founder" + "role": "Project Founder" }, { "name": "Other contributors", "homepage": "https://github.com/phpmd/phpmd/graphs/contributors", "role": "Contributors" + }, + { + "name": "Marc Würth", + "email": "ravage@bluewin.ch", + "homepage": "https://github.com/ravage84", + "role": "Project Maintainer" } ], "description": "PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.", @@ -301,7 +347,7 @@ "phpmd", "pmd" ], - "time": "2015-03-02 10:26:50" + "time": "2016-04-04 11:52:04" }, { "name": "phpspec/php-diff", @@ -479,39 +525,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "3.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "44cd8e3930e431658d1a5de7d282d5cb37837fd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/44cd8e3930e431658d1a5de7d282d5cb37837fd5", + "reference": "44cd8e3930e431658d1a5de7d282d5cb37837fd5", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": "^5.6 || ^7.0", "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", + "phpunit/php-token-stream": "^1.4.2", + "sebastian/code-unit-reverse-lookup": "~1.0", "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "sebastian/version": "~1.0|~2.0" }, "require-dev": { "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "phpunit/phpunit": "~5" }, "suggest": { "ext-dom": "*", - "ext-xdebug": ">=2.2.1", + "ext-xdebug": ">=2.4.0", "ext-xmlwriter": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "3.3.x-dev" } }, "autoload": { @@ -537,35 +584,37 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2016-05-27 16:24:29" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -582,7 +631,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2015-06-21 13:08:43" }, { "name": "phpunit/php-text-template", @@ -627,21 +676,24 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, "type": "library", "autoload": { "classmap": [ @@ -664,7 +716,7 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2016-05-12 18:03:57" }, { "name": "phpunit/php-token-stream", @@ -717,16 +769,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.5.1", + "version": "5.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4" + "reference": "00dd95ffb48805503817ced06399017df315fe5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4", - "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/00dd95ffb48805503817ced06399017df315fe5c", + "reference": "00dd95ffb48805503817ced06399017df315fe5c", "shasum": "" }, "require": { @@ -735,20 +787,23 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "~1.3,>=1.3.1", - "phpunit/php-code-coverage": "~2.0,>=2.0.11", - "phpunit/php-file-iterator": "~1.3.2", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "^3.3.0", + "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "~2.3", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.1", "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.2", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" + "sebastian/object-enumerator": "~1.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0|~2.0", + "symfony/yaml": "~2.1|~3.0" }, "suggest": { "phpunit/php-invoker": "~1.1" @@ -759,7 +814,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.5.x-dev" + "dev-master": "5.3.x-dev" } }, "autoload": { @@ -785,30 +840,30 @@ "testing", "xunit" ], - "time": "2015-03-29 09:24:05" + "time": "2016-05-11 13:28:45" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "314f8c44019b4dfece2571b98938574e6342be59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/314f8c44019b4dfece2571b98938574e6342be59", + "reference": "314f8c44019b4dfece2571b98938574e6342be59", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.4" }, "suggest": { "ext-soap": "*" @@ -816,7 +871,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "3.2.x-dev" } }, "autoload": { @@ -841,7 +896,52 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2016-06-03 05:01:30" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "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": "2016-02-13 06:45:14" }, { "name": "sebastian/comparator", @@ -961,16 +1061,16 @@ }, { "name": "sebastian/environment", - "version": "1.3.5", + "version": "1.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf" + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf", - "reference": "dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", "shasum": "" }, "require": { @@ -1007,7 +1107,7 @@ "environment", "hhvm" ], - "time": "2016-02-26 18:40:46" + "time": "2016-05-17 03:18:57" }, { "name": "sebastian/exporter", @@ -1126,6 +1226,52 @@ ], "time": "2015-10-12 03:26:01" }, + { + "name": "sebastian/object-enumerator", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "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": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2016-01-28 13:25:10" + }, { "name": "sebastian/recursion-context", "version": "1.0.2", @@ -1179,21 +1325,71 @@ "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "time": "2015-11-11 19:50:13" }, + { + "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-28 20:34:47" + }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", "shasum": "" }, + "require": { + "php": ">=5.6" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1212,20 +1408,20 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2016-02-04 12:56:52" }, { "name": "squizlabs/php_codesniffer", - "version": "2.6.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "1bcdf03b068a530ac1962ce671dead356eeba43b" + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1bcdf03b068a530ac1962ce671dead356eeba43b", - "reference": "1bcdf03b068a530ac1962ce671dead356eeba43b", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", "shasum": "" }, "require": { @@ -1290,20 +1486,20 @@ "phpcs", "standards" ], - "time": "2016-04-03 22:58:34" + "time": "2016-05-30 22:24:32" }, { "name": "symfony/config", - "version": "v3.0.4", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "980ee40c28f00acff8906c11b778aab5f0db74c2" + "reference": "048dc47e07f92333203c3b7045868bbc864fc40e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/980ee40c28f00acff8906c11b778aab5f0db74c2", - "reference": "980ee40c28f00acff8906c11b778aab5f0db74c2", + "url": "https://api.github.com/repos/symfony/config/zipball/048dc47e07f92333203c3b7045868bbc864fc40e", + "reference": "048dc47e07f92333203c3b7045868bbc864fc40e", "shasum": "" }, "require": { @@ -1316,7 +1512,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1343,20 +1539,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2016-03-04 07:55:57" + "time": "2016-05-20 11:48:17" }, { "name": "symfony/console", - "version": "v2.8.4", + "version": "v2.8.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154" + "reference": "48221d3de4dc22d2cd57c97e8b9361821da86609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9a5aef5fc0d4eff86853d44202b02be8d5a20154", - "reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154", + "url": "https://api.github.com/repos/symfony/console/zipball/48221d3de4dc22d2cd57c97e8b9361821da86609", + "reference": "48221d3de4dc22d2cd57c97e8b9361821da86609", "shasum": "" }, "require": { @@ -1403,20 +1599,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-03-17 09:19:04" + "time": "2016-04-26 12:00:47" }, { "name": "symfony/dependency-injection", - "version": "v3.0.4", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "6a9058101b591edced21ca3c83c80a3978f5c6b0" + "reference": "383110341e8f47ae972da3a29503b099831549e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6a9058101b591edced21ca3c83c80a3978f5c6b0", - "reference": "6a9058101b591edced21ca3c83c80a3978f5c6b0", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/383110341e8f47ae972da3a29503b099831549e1", + "reference": "383110341e8f47ae972da3a29503b099831549e1", "shasum": "" }, "require": { @@ -1429,13 +1625,14 @@ }, "suggest": { "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1462,20 +1659,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2016-03-30 10:41:14" + "time": "2016-05-24 10:06:56" }, { "name": "symfony/event-dispatcher", - "version": "v3.0.4", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "9002dcf018d884d294b1ef20a6f968efc1128f39" + "reference": "0343b2cedd0edb26cdc791212a8eb645c406018b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9002dcf018d884d294b1ef20a6f968efc1128f39", - "reference": "9002dcf018d884d294b1ef20a6f968efc1128f39", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0343b2cedd0edb26cdc791212a8eb645c406018b", + "reference": "0343b2cedd0edb26cdc791212a8eb645c406018b", "shasum": "" }, "require": { @@ -1495,7 +1692,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1522,20 +1719,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-03-10 10:34:12" + "time": "2016-04-12 18:27:47" }, { "name": "symfony/filesystem", - "version": "v3.0.4", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "f82499a459dcade2ea56df94cc58b19c8bde3d20" + "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/f82499a459dcade2ea56df94cc58b19c8bde3d20", - "reference": "f82499a459dcade2ea56df94cc58b19c8bde3d20", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/5751e80d6f94b7c018f338a4a7be0b700d6f3058", + "reference": "5751e80d6f94b7c018f338a4a7be0b700d6f3058", "shasum": "" }, "require": { @@ -1544,7 +1741,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1571,20 +1768,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-03-27 10:24:39" + "time": "2016-04-12 18:27:47" }, { "name": "symfony/finder", - "version": "v3.0.4", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "c54e407b35bc098916704e9fd090da21da4c4f52" + "reference": "40d17ed287bf51a2f884c4619ce8ff2a1c5cd219" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c54e407b35bc098916704e9fd090da21da4c4f52", - "reference": "c54e407b35bc098916704e9fd090da21da4c4f52", + "url": "https://api.github.com/repos/symfony/finder/zipball/40d17ed287bf51a2f884c4619ce8ff2a1c5cd219", + "reference": "40d17ed287bf51a2f884c4619ce8ff2a1c5cd219", "shasum": "" }, "require": { @@ -1593,7 +1790,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1620,20 +1817,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-03-10 11:13:05" + "time": "2016-05-13 18:06:41" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.1.1", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "1289d16209491b584839022f29257ad859b8532d" + "reference": "dff51f72b0706335131b00a7f49606168c582594" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d", - "reference": "1289d16209491b584839022f29257ad859b8532d", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", + "reference": "dff51f72b0706335131b00a7f49606168c582594", "shasum": "" }, "require": { @@ -1645,7 +1842,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -1679,20 +1876,20 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/process", - "version": "v3.0.4", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "e6f1f98bbd355d209a992bfff45e7edfbd4a0776" + "reference": "1574f3451b40fa9bbae518ef71d19a56f409cac0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/e6f1f98bbd355d209a992bfff45e7edfbd4a0776", - "reference": "e6f1f98bbd355d209a992bfff45e7edfbd4a0776", + "url": "https://api.github.com/repos/symfony/process/zipball/1574f3451b40fa9bbae518ef71d19a56f409cac0", + "reference": "1574f3451b40fa9bbae518ef71d19a56f409cac0", "shasum": "" }, "require": { @@ -1701,7 +1898,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1728,29 +1925,29 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-03-30 10:41:14" + "time": "2016-04-12 19:11:33" }, { "name": "symfony/yaml", - "version": "v2.8.4", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb" + "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/584e52cb8f788a887553ba82db6caacb1d6260bb", - "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb", + "url": "https://api.github.com/repos/symfony/yaml/zipball/eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", + "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1777,7 +1974,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-03-04 07:54:35" + "time": "2016-05-26 21:46:24" } ], "aliases": [], diff --git a/src/CollectionTrait.php b/src/CollectionTrait.php index 8c126b3..27a694e 100644 --- a/src/CollectionTrait.php +++ b/src/CollectionTrait.php @@ -809,7 +809,7 @@ public function sizeIsBetween($fromSize, $toSize) /** * Returns a sum of all values in this collection. * - * @return float + * @return int|float */ public function sum() { @@ -819,7 +819,7 @@ public function sum() /** * Returns average of values from this collection. * - * @return float + * @return int|float */ public function average() { diff --git a/src/collection_functions.php b/src/collection_functions.php index 33677de..05b5cc2 100644 --- a/src/collection_functions.php +++ b/src/collection_functions.php @@ -1521,11 +1521,11 @@ function sizeIsBetween($collection, $fromSize, $toSize) * Returns a sum of all values in the $collection. * * @param array|Traversable $collection - * @return float + * @return int|float */ function sum($collection) { - $result = 0.0; + $result = 0; foreach ($collection as $value) { $result += $value; @@ -1538,11 +1538,11 @@ function sum($collection) * Returns average of values from $collection. * * @param array|Traversable $collection - * @return float + * @return int|float */ function average($collection) { - $sum = 0.0; + $sum = 0; $count = 0; foreach ($collection as $value) { @@ -1550,7 +1550,7 @@ function average($collection) $count++; } - return $count ? (float) $sum/$count : 0.0; + return $count ? $sum/$count : 0; } /** diff --git a/tests/spec/CollectionSpec.php b/tests/spec/CollectionSpec.php index d138517..f974be8 100644 --- a/tests/spec/CollectionSpec.php +++ b/tests/spec/CollectionSpec.php @@ -1134,19 +1134,21 @@ function it_can_check_if_size_is_between_n_and_m() function it_can_sum_the_collection() { $this->beConstructedWith([1, 2, 3, 4]); - $this->sum()->shouldReturn(10.0); + $this->sum()->shouldReturn(10); + $this->append(1.5)->sum()->shouldReturn(11.5); } function it_can_get_average_of_the_collection() { $this->beConstructedWith([1, 2, 2, 3]); - $this->average()->shouldReturn(2.0); + $this->average()->shouldReturn(2); + $this->append(3)->average()->shouldReturn(2.2); } function it_will_return_zero_when_average_is_called_on_empty_collection() { $this->beConstructedWith([]); - $this->average()->shouldReturn(0.0); + $this->average()->shouldReturn(0); } function it_can_get_maximal_value_in_the_colleciton()