From 49a60434cf94165b985dd3f8165c869917da98a4 Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Sun, 21 Feb 2021 22:17:45 +0100 Subject: [PATCH 1/5] Library dependencies upgrade & cleanup --- .gitattributes | 11 + .github/PULL_REQUEST_TEMPLATE.md | 33 + .github/dependabot.yml | 6 + .github/workflows/static-analyze.yml | 77 + .github/workflows/tests.yml | 80 + .gitignore | 5 +- .phive/phars.xml | 6 + CHANGELOG.md | 271 +- CODE_OF_CONDUCT.md | 76 + CONTRIBUTING.md | 23 - LICENSE | 2 +- README.md | 4 +- composer.json | 29 +- composer.lock | 2640 +++++++++++++++++ phpstan.neon | 6 + phpunit.xml.dist | 34 +- psalm.xml | 16 + .../PHPHumanizer/Collection/FormatterSpec.php | 47 - .../PHPHumanizer/Collection/OxfordSpec.php | 45 - .../PHPHumanizer/DateTime/DifferenceSpec.php | 106 - .../PHPHumanizer/DateTime/FormatterSpec.php | 50 - .../DateTime/PreciseFormatterSpec.php | 80 - .../String/WordBreakpointSpec.php | 36 - .../Tests/Collection/FormatterTest.php | 49 + .../Tests/Collection/OxfordTest.php | 36 + .../Tests/DateTime/DifferenceTest.php | 120 + .../Tests/DateTime/FormatterTest.php | 37 + .../Tests/DateTime/PreciseFormatterTest.php | 37 + .../Tests/String/WordBreakpointTest.php | 51 + tests/bootstrap.php | 12 - 30 files changed, 3583 insertions(+), 442 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/static-analyze.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .phive/phars.xml create mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md create mode 100644 composer.lock create mode 100644 phpstan.neon create mode 100644 psalm.xml delete mode 100644 spec/Coduo/PHPHumanizer/Collection/FormatterSpec.php delete mode 100644 spec/Coduo/PHPHumanizer/Collection/OxfordSpec.php delete mode 100644 spec/Coduo/PHPHumanizer/DateTime/DifferenceSpec.php delete mode 100644 spec/Coduo/PHPHumanizer/DateTime/FormatterSpec.php delete mode 100644 spec/Coduo/PHPHumanizer/DateTime/PreciseFormatterSpec.php delete mode 100644 spec/Coduo/PHPHumanizer/String/WordBreakpointSpec.php create mode 100644 tests/Coduo/PHPHumanizer/Tests/Collection/FormatterTest.php create mode 100644 tests/Coduo/PHPHumanizer/Tests/Collection/OxfordTest.php create mode 100644 tests/Coduo/PHPHumanizer/Tests/DateTime/DifferenceTest.php create mode 100644 tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php create mode 100644 tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php create mode 100644 tests/Coduo/PHPHumanizer/Tests/String/WordBreakpointTest.php delete mode 100644 tests/bootstrap.php diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d5fe021 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +*.php text eol=lf +*.phpt text eol=lf +/composer.lock export-ignore +/.github/ export-ignore +/.phive/ export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php_cs export-ignore +/phpstan.neon export-ignore +/phpunit.xml export-ignore \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..07c5e96 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,33 @@ + +

Change Log

+
+

Added

+ +

Fixed

+ +

Changed

+ +

Removed

+ +

Deprecated

+ +

Security

+ +
+
+ +

Description

+ + \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..12f28b4 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/static-analyze.yml b/.github/workflows/static-analyze.yml new file mode 100644 index 0000000..c54217e --- /dev/null +++ b/.github/workflows/static-analyze.yml @@ -0,0 +1,77 @@ +name: "Static Analyze" + +on: + pull_request: + push: + branches: + - "6.x" + schedule: + - cron: '* 8 * * *' + +jobs: + compatibility: + name: "Static Analyze" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "locked" + php-version: + - "7.4" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "pcov" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + tools: phive, composer:v2 + + - name: "Cache Phive dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.phive + key: "${{ runner.os }}-phive-${{ hashFiles('**/phars.xml') }}" + restore-keys: | + ${{ runner.os }}-phive- + + - name: "Get Composer Cache Directory" + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache Composer dependencies" + uses: "actions/cache@v2" + with: + path: | + ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.lock') }}" + restore-keys: | + php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer- + + - name: "Install tools" + run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,8A03EA3B385DBAA1,C5095986493B4AA0 --force-accept-unsigned" + + - name: "Install lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" + + - name: "Install highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction --no-progress --no-suggest" + + - name: "Install locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Static Analyze" + run: "composer static:analyze" \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..7bb3c28 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,80 @@ +name: "Tests" + +on: + pull_request: + push: + branches: + - "6.x" + schedule: + - cron: '* 8 * * *' + +jobs: + compatibility: + name: "Tests" + + runs-on: ${{ matrix.operating-system }} + + strategy: + matrix: + dependencies: + - "locked" + - "lowest" + - "highest" + php-version: + - "7.4" + - "8.0" + operating-system: + - "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "pcov" + php-version: "${{ matrix.php-version }}" + ini-values: memory_limit=-1 + tools: phive, composer:v2 + + - name: "Cache Phive dependencies" + uses: "actions/cache@v2" + with: + path: | + ~/.phive + key: "${{ runner.os }}-phive-${{ hashFiles('**/phars.xml') }}" + restore-keys: | + ${{ runner.os }}-phive- + + - name: "Get Composer Cache Directory" + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache Composer dependencies" + uses: "actions/cache@v2" + with: + path: | + ${{ steps.composer-cache.outputs.dir }} + key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.lock') }}" + restore-keys: | + php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer- + + - name: "Install tools" + run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,8A03EA3B385DBAA1,C5095986493B4AA0 --force-accept-unsigned" + + - name: "Install lowest dependencies" + if: ${{ matrix.dependencies == 'lowest' }} + run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" + + - name: "Install highest dependencies" + if: ${{ matrix.dependencies == 'highest' }} + run: "composer update --no-interaction --no-progress --no-suggest" + + - name: "Install locked dependencies" + if: ${{ matrix.dependencies == 'locked' }} + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Tests" + run: "composer test" diff --git a/.gitignore b/.gitignore index e0a7c66..482dd47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ vendor/ bin/ -composer.lock -composer.phar -*.cache \ No newline at end of file +var/ +tools/ \ No newline at end of file diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 0000000..a00e5c5 --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 15c1f68..6125fde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,268 @@ -# 2.0 +## [Unreleased] - 2020-10-18 -* Added support for PHP7 -* Updated dependencies to support Symfony3 components -* Added support for Ordinal number strategies that require prefixes +### Added +- [#120](https://github.com/coduo/php-humanizer/pull/120) - **test for azerbaijani language** - [@4t87ux8](https://github.com/4t87ux8) +- [#119](https://github.com/coduo/php-humanizer/pull/119) - **support azerbaijani language** - [@4t87ux8](https://github.com/4t87ux8) + +### Changed +- [#118](https://github.com/coduo/php-humanizer/pull/118) - **create azerbaijani translation** - [@4t87ux8](https://github.com/4t87ux8) +- [fa52e6](https://github.com/coduo/php-humanizer/commit/fa52e6223eef2f19fbd0a290432b5a878317dca2) - **Fixxed issue with symfony translator dependency, upgraded php, phpunit and phpspec dependencies** - [@norberttech](https://github.com/norberttech) +- [f989a9](https://github.com/coduo/php-humanizer/commit/f989a91d2d90f5d4bf4922ab9fec1674e7fe024e) - **Create FUNDING.yml** - [@norberttech](https://github.com/norberttech) +- [142689](https://github.com/coduo/php-humanizer/commit/142689763a6aafdd9f1dfbb48db9807bbe027acc) - **Update README.md** - [@norberttech](https://github.com/norberttech) +- [6255e0](https://github.com/coduo/php-humanizer/commit/6255e022c0ff8767cae6cdb4552d13f5f0df0d65) - **Moved php-cs-fixer to dev dependency where it belongs to** - [@norberttech](https://github.com/norberttech) +- [4d62db](https://github.com/coduo/php-humanizer/commit/4d62dba187d89bc8276ff6e5364d2dd9a3f2ad5f) - **Migrated from travis-ci.org to travis-ci.com** - [@norberttech](https://github.com/norberttech) +- [dc528e](https://github.com/coduo/php-humanizer/commit/dc528ebcef31b793e1dd24dbe90f14039361fad1) - **Update README.md** - [@norberttech](https://github.com/norberttech) +- [1b2787](https://github.com/coduo/php-humanizer/commit/1b2787d28282247b3fe68cd5b9f6bf80f304fa63) - **dev-master branch aliast** - [@norberttech](https://github.com/norberttech) + +### Fixed +- [fc3a04](https://github.com/coduo/php-humanizer/commit/fc3a043f6e03bc29e86d0cd58ae3a6b7daf40d69) - **travis configuration** - [@norberttech](https://github.com/norberttech) +- [#115](https://github.com/coduo/php-humanizer/pull/115) - **composer autoloading deprecation notice; Support symfony 5** - [@brianwozeniak](https://github.com/brianwozeniak) + +### Removed +- [83a180](https://github.com/coduo/php-humanizer/commit/83a1805da9a28a98a0bb932a5236becd44ea79b6) - **php 8.0 from matrix** - [@norberttech](https://github.com/norberttech) + +## [3.0.2] - 2019-04-29 + +### Changed +- [9d83e5](https://github.com/coduo/php-humanizer/commit/9d83e509dacfd26250ee4c6b0f195affb08cb1e2) - **Moved php-cs-fixer to dev dependency where it belongs to** - [@norberttech](https://github.com/norberttech) + +## [3.0.1] - 2019-04-20 + +### Changed +- [380428](https://github.com/coduo/php-humanizer/commit/38042820e9ee7ccc76d66f9c480fe8b7f0e8aaf0) - **Update README.md** - [@norberttech](https://github.com/norberttech) + +## [3.0.0] - 2019-04-20 + +### Added +- [17a5ab](https://github.com/coduo/php-humanizer/commit/17a5ab5243ae1eec2e3d39388bf611088b8fd5e7) - **missing translations** - [@norberttech](https://github.com/norberttech) +- [#86](https://github.com/coduo/php-humanizer/pull/86) - **test case with 0 at the end of the number** - [@norberttech](https://github.com/norberttech) +- [#84](https://github.com/coduo/php-humanizer/pull/84) - **PFIGS ordinals** - [@martinbutt](https://github.com/martinbutt) + +### Changed +- [1b2787](https://github.com/coduo/php-humanizer/commit/1b2787d28282247b3fe68cd5b9f6bf80f304fa63) - **dev-master branch aliast** - [@norberttech](https://github.com/norberttech) +- [14ab74](https://github.com/coduo/php-humanizer/commit/14ab746762acd1856ddd386023128f23935ef119) - **CS Fixes** - [@norberttech](https://github.com/norberttech) +- [9edceb](https://github.com/coduo/php-humanizer/commit/9edceb2d21fa879e91072308b8bbe3503a346bd2) - **CS Fixes** - [@norberttech](https://github.com/norberttech) +- [#112](https://github.com/coduo/php-humanizer/pull/112) - **Upgraded thunderer/shortcode dependency to ^0.7** - [@thunderer](https://github.com/thunderer) +- [#111](https://github.com/coduo/php-humanizer/pull/111) - **Allow later versions of symfony packages** - [@brianwozeniak](https://github.com/brianwozeniak) +- [#91](https://github.com/coduo/php-humanizer/pull/91) - **Sanity check for NumberFormatter when intl is not installed** - [@thunderer](https://github.com/thunderer) +- [#40](https://github.com/coduo/php-humanizer/pull/40) - **Romanian translations** - [@a-ungurianu](https://github.com/a-ungurianu) +- [#106](https://github.com/coduo/php-humanizer/pull/106) - **[master] Add translation: zh_TW** - [@jfcherng](https://github.com/jfcherng) +- [#104](https://github.com/coduo/php-humanizer/pull/104) - **Feature/update** - [@norberttech](https://github.com/norberttech) +- [#89](https://github.com/coduo/php-humanizer/pull/89) - **remove unnecessary echo** - [@vinicius73](https://github.com/vinicius73) +- [#87](https://github.com/coduo/php-humanizer/pull/87) - **Force $binaryPrefixes array ordering on 32-bit systems, fixes #83** - [@Forst](https://github.com/Forst) +- [5cd850](https://github.com/coduo/php-humanizer/commit/5cd850b49b1ca30811f24c5c1a9b0d6e4cac9fba) - **Update composer.json** - [@norberttech](https://github.com/norberttech) +- [#85](https://github.com/coduo/php-humanizer/pull/85) - **Support Japanese language** - [@serima](https://github.com/serima) + +### Fixed +- [9b52c5](https://github.com/coduo/php-humanizer/commit/9b52c5dc42f10ff60f4827ff9a736b3a1a18f0e4) - **README.md** - [@norberttech](https://github.com/norberttech) +- [#80](https://github.com/coduo/php-humanizer/pull/80) - **russian translation** - [@dizzy7](https://github.com/dizzy7) + +## [2.0.1] - 2019-02-25 + +### Changed +- [#107](https://github.com/coduo/php-humanizer/pull/107) - **[2.0] Add translation: zh_TW** - [@jfcherng](https://github.com/jfcherng) + +### Fixed +- [#108](https://github.com/coduo/php-humanizer/pull/108) - **travis configuration for 2.0 branch** - [@norberttech](https://github.com/norberttech) + +## [2.0.0-beta] - 2016-02-21 + +### Added +- [#78](https://github.com/coduo/php-humanizer/pull/78) - **ext-inl to composer suggest** - [@norberttech](https://github.com/norberttech) +- [#68](https://github.com/coduo/php-humanizer/pull/68) - **composer cache folder and move to new infrastructure** - [@norberttech](https://github.com/norberttech) + +### Changed +- [e85d69](https://github.com/coduo/php-humanizer/commit/e85d6905a097f9ba6b2165d9998749eb113d0289) - **Merge pull request #78 from norzechowicz/suggest-intl** - [@norzechowicz](https://github.com/norzechowicz) +- [#75](https://github.com/coduo/php-humanizer/pull/75) - **Cleanup before stable release** - [@norberttech](https://github.com/norberttech) +- [f5831e](https://github.com/coduo/php-humanizer/commit/f5831e3be54ca85c9fc14ee5da00b2d6ba1143bb) - **Merge pull request #75 from norzechowicz/cleanup** - [@norzechowicz](https://github.com/norzechowicz) +- [#73](https://github.com/coduo/php-humanizer/pull/73) - **improve strategy to handle prefix-ordinal** - [@isnani](https://github.com/isnani) +- [6ec963](https://github.com/coduo/php-humanizer/commit/6ec963fb1c8ecee66feb0228ca5626f1c1ca09f8) - **Merge pull request #73 from isnani/improve-ordinal-strategy** - [@norzechowicz](https://github.com/norzechowicz) +- [#70](https://github.com/coduo/php-humanizer/pull/70) - **Cleanup** - [@norberttech](https://github.com/norberttech) +- [dac4b4](https://github.com/coduo/php-humanizer/commit/dac4b43390f320b82728f1e5e0ad45f7c68d591e) - **Merge pull request #70 from norzechowicz/cleanup** - [@norzechowicz](https://github.com/norzechowicz) +- [#69](https://github.com/coduo/php-humanizer/pull/69) - **Renamed all facades in order to support php7** - [@norberttech](https://github.com/norberttech) +- [b7214c](https://github.com/coduo/php-humanizer/commit/b7214ce3e0511d5172568aff4a4572a0d80762a1) - **Merge pull request #69 from norzechowicz/php7-support** - [@norzechowicz](https://github.com/norzechowicz) +- [3f252e](https://github.com/coduo/php-humanizer/commit/3f252ef1a717a841dac1316f835494ef82104cde) - **master branch alias** - [@norberttech](https://github.com/norberttech) +- [ae6020](https://github.com/coduo/php-humanizer/commit/ae602062f4500488dcbd119b3560a1bdd4fe2699) - **Merge pull request #68 from norzechowicz/travis-ci** - [@norzechowicz](https://github.com/norzechowicz) +- [7c7e79](https://github.com/coduo/php-humanizer/commit/7c7e79dabc0989dbaf485d46c00d9d836c929f8a) - **Merge pull request #67 from nwatth/thai-translation** - [@norzechowicz](https://github.com/norzechowicz) +- [#67](https://github.com/coduo/php-humanizer/pull/67) - **Thai translation** - [@nwatth](https://github.com/nwatth) + +## [1.0.9] - 2015-12-02 + +### Added +- [#54](https://github.com/coduo/php-humanizer/pull/54) - **Ukrainian to the list of languages** - [@Borales](https://github.com/Borales) +- [d2904a](https://github.com/coduo/php-humanizer/commit/d2904ae1e1ebd79c7b8224aa31bd5aec8d9575a4) - **composer.phar into .gitignore** - [@norberttech](https://github.com/norberttech) +- [#26](https://github.com/coduo/php-humanizer/pull/26) - **Spanish translation.** - [@orestes](https://github.com/orestes) +- [#53](https://github.com/coduo/php-humanizer/pull/53) - **Chinese Simplified (zh_CN)** - [@arrowrowe](https://github.com/arrowrowe) + +### Changed +- [#65](https://github.com/coduo/php-humanizer/pull/65) - **Oxford french translation** - [@percymamedy](https://github.com/percymamedy) +- [b36457](https://github.com/coduo/php-humanizer/commit/b364572a7a73bed0be62a7d2df382fb1ab35cd2a) - **Merge pull request #65 from percymamedy/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#66](https://github.com/coduo/php-humanizer/pull/66) - **Danish translation** - [@hyperpanic](https://github.com/hyperpanic) +- [7599dd](https://github.com/coduo/php-humanizer/commit/7599dd847f6b72c6c41f9458cfd92092200644e9) - **Merge pull request #66 from radiosignal/danish-translation** - [@norzechowicz](https://github.com/norzechowicz) +- [#61](https://github.com/coduo/php-humanizer/pull/61) - **Shortcode removal utilities** - [@thunderer](https://github.com/thunderer) +- [6bed68](https://github.com/coduo/php-humanizer/commit/6bed6804a97b0489af80ea229616d26a7224b33a) - **Merge pull request #61 from thunderer/string-shortcode-removal** - [@norzechowicz](https://github.com/norzechowicz) +- [a78a55](https://github.com/coduo/php-humanizer/commit/a78a552671dc51f4393b2806097250d0163eee2f) - **Merge pull request #64 from ddmler/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#64](https://github.com/coduo/php-humanizer/pull/64) - **German translation** - [@ddmler](https://github.com/ddmler) +- [3eb227](https://github.com/coduo/php-humanizer/commit/3eb227e710726d04b1905dfc2422370d716611d5) - **Merge pull request #46 from doenietzomoeilijk/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#46](https://github.com/coduo/php-humanizer/pull/46) - **Refactor Number into separate languages** - [@doenietzomoeilijk](https://github.com/doenietzomoeilijk) +- [a68dc7](https://github.com/coduo/php-humanizer/commit/a68dc7326b1991161e423812d454bf51f4c15d5e) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) +- [3bcb4b](https://github.com/coduo/php-humanizer/commit/3bcb4b6c204a1d042517bb93e39f45cef1fe8615) - **Merge pull request #54 from Borales/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#58](https://github.com/coduo/php-humanizer/pull/58) - **Remove composer.phar file** - [@vinkla](https://github.com/vinkla) +- [216c9b](https://github.com/coduo/php-humanizer/commit/216c9bbd1f173213a5137306faf5a8a04cab315e) - **Merge pull request #55 from hjason/master** - [@norzechowicz](https://github.com/norzechowicz) +- [5c9bb3](https://github.com/coduo/php-humanizer/commit/5c9bb3393a682126bb8d2d51fcdc77476eef2b83) - **Merge pull request #26 from orestes/es-translation** - [@norzechowicz](https://github.com/norzechowicz) +- [34ef53](https://github.com/coduo/php-humanizer/commit/34ef53fbd42ee7d33999ca4896ea17c2a1cc8a30) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) +- [51ea67](https://github.com/coduo/php-humanizer/commit/51ea6720069d822a9b9ef8797d708b7205123517) - **Merge pull request #53 from dyweb/master** - [@norzechowicz](https://github.com/norzechowicz) + +### Fixed +- [73e99d](https://github.com/coduo/php-humanizer/commit/73e99d096f9f1bc4f66fbb13fc0a3a6f620f4eea) - **StringTest** - [@hjason2042@gmail.com](#) + +## [1.0.8] - 2015-11-06 + +### Added +- [#52](https://github.com/coduo/php-humanizer/pull/52) - **Indonesian language** - [@naprirfan](https://github.com/naprirfan) +- [#41](https://github.com/coduo/php-humanizer/pull/41) - **russian. Add prefix at format difference.** - [@sam002](https://github.com/sam002) +- [#51](https://github.com/coduo/php-humanizer/pull/51) - **possibility to pass forbidden words into humanizer** - [@norberttech](https://github.com/norberttech) +- [#49](https://github.com/coduo/php-humanizer/pull/49) - **support for multiple character separators at string humanizer** - [@drgomesp](https://github.com/drgomesp) +- [#27](https://github.com/coduo/php-humanizer/pull/27) - **Bulgarian translation** - [@lpopov](https://github.com/lpopov) +- [f65309](https://github.com/coduo/php-humanizer/commit/f6530941c4fb5c109aa593229a3ea3da449b6781) - **the breakpoint in the constructor** - [@smeeckaert](https://github.com/smeeckaert) +- [798d77](https://github.com/coduo/php-humanizer/commit/798d77d6b864b2d46b4c2487f616ea044f08f92c) - **breakpoint tests** - [@smeeckaert](https://github.com/smeeckaert) +- [#38](https://github.com/coduo/php-humanizer/pull/38) - **Dutch Oxford translations.** - [@doenietzomoeilijk](https://github.com/doenietzomoeilijk) +- [#29](https://github.com/coduo/php-humanizer/pull/29) - **Norwegian translation** - [@dagaa](https://github.com/dagaa) +- [#16](https://github.com/coduo/php-humanizer/pull/16) - **Dutch translation.** - [@Ozmodiar](https://github.com/Ozmodiar) + +### Changed +- [d6e784](https://github.com/coduo/php-humanizer/commit/d6e784a86b6f2318394fd6b8af853e5180d3ab15) - **Merge pull request #52 from naprirfan/master** - [@norzechowicz](https://github.com/norzechowicz) +- [9d1732](https://github.com/coduo/php-humanizer/commit/9d17321e4259ff8376d5a779c0ad682b4394ae00) - **Merge pull request #47 from mostertb/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#47](https://github.com/coduo/php-humanizer/pull/47) - **Support for optional explicit BinarySuffix precision** - [@mostertb](https://github.com/mostertb) +- [a4d68a](https://github.com/coduo/php-humanizer/commit/a4d68a956478bfe84661ca1f8a6c8984aaba741c) - **Merge pull request #41 from sam002/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#30](https://github.com/coduo/php-humanizer/pull/30) - **TruncateHtml** - [@smeeckaert](https://github.com/smeeckaert) +- [0465bd](https://github.com/coduo/php-humanizer/commit/0465bd058e9b8c26bf9dc00f38fe14a8473f67b7) - **Merge branch 'master' of git://github.com/smeeckaert/php-humanizer into smeeckaert-master** - [@norberttech](https://github.com/norberttech) +- [4a6ed1](https://github.com/coduo/php-humanizer/commit/4a6ed1f15345562df1eede367112d06a9fc41ab3) - **Merge pull request #51 from norzechowicz/humanizer-forbidden-words** - [@norzechowicz](https://github.com/norzechowicz) +- [c0606e](https://github.com/coduo/php-humanizer/commit/c0606e6844a22bc5480a2527d2f043d6a52eb52a) - **Merge pull request #50 from norzechowicz/phpunit** - [@norzechowicz](https://github.com/norzechowicz) +- [#50](https://github.com/coduo/php-humanizer/pull/50) - **Moved integration tests from phpspec into phpunit** - [@norberttech](https://github.com/norberttech) +- [0a04e0](https://github.com/coduo/php-humanizer/commit/0a04e02fbf7ba37a2df8b4c3a5f0b93d0ce9f002) - **Merge pull request #49 from drgomesp/support-multiple-character-separator** - [@norzechowicz](https://github.com/norzechowicz) +- [fe8f03](https://github.com/coduo/php-humanizer/commit/fe8f03731d1349fb24df7eb3d16eeda0b5d6f633) - **Merge pull request #27 from lpopov/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#44](https://github.com/coduo/php-humanizer/pull/44) - **[ADD] Support PSR-4 Composer** - [@Th3Mouk](https://github.com/Th3Mouk) +- [75825a](https://github.com/coduo/php-humanizer/commit/75825a8ca318a3d7c523d3d489dd0547ab6a6b23) - **Merge pull request #44 from Th3Mouk/patch-1** - [@norzechowicz](https://github.com/norzechowicz) +- [#42](https://github.com/coduo/php-humanizer/pull/42) - **Fixes a typo in French** - [@Gnomino](https://github.com/Gnomino) +- [5bbff0](https://github.com/coduo/php-humanizer/commit/5bbff03cebefdf95eaa4cf9c53905c703a471ae4) - **style** - [@smeeckaert](https://github.com/smeeckaert) +- [cc7a56](https://github.com/coduo/php-humanizer/commit/cc7a56a09f31a50bf32a329dea7b65c446e53631) - **refacto truncate** - [@smeeckaert](https://github.com/smeeckaert) +- [a7cb87](https://github.com/coduo/php-humanizer/commit/a7cb8781189fb13d078530a03111bef47af8d04e) - **rename breakpoint len** - [@smeeckaert](https://github.com/smeeckaert) +- [91d107](https://github.com/coduo/php-humanizer/commit/91d1079d1f6eb88ec784d66e71c88da459ae6e37) - **code style** - [@smeeckaert](https://github.com/smeeckaert) +- [dac446](https://github.com/coduo/php-humanizer/commit/dac446bb4bb0a959fb39466b3729bc97060f4449) - **refacto visibility and breakpoint** - [@smeeckaert](https://github.com/smeeckaert) +- [#34](https://github.com/coduo/php-humanizer/pull/34) - **string functions into multibyte string functions** - [@norberttech](https://github.com/norberttech) +- [#35](https://github.com/coduo/php-humanizer/pull/35) - **Oxford italian translations** - [@omissis](https://github.com/omissis) +- [#22](https://github.com/coduo/php-humanizer/pull/22) - **Oxford collection + phpcs fixer cleanup.** - [@defrag](https://github.com/defrag) +- [#33](https://github.com/coduo/php-humanizer/pull/33) - **Truncate check length of append** - [@smeeckaert](https://github.com/smeeckaert) +- [#31](https://github.com/coduo/php-humanizer/pull/31) - **Addition of Portuguese (pt) language translation (with spec tests)** - [@lightglitch](https://github.com/lightglitch) +- [8cdeae](https://github.com/coduo/php-humanizer/commit/8cdeaef54f759d7e9a93c85cbf9e6e7b63dd6e76) - **truncate html** - [@smeeckaert](https://github.com/smeeckaert) +- [#28](https://github.com/coduo/php-humanizer/pull/28) - **Addition of Afrikaans (af) language translation (with spec tests)** - [@sarelvdwalt](https://github.com/sarelvdwalt) +- [#21](https://github.com/coduo/php-humanizer/pull/21) - **More correct wording for Dutch version of "... from now".** - [@Ozmodiar](https://github.com/Ozmodiar) +- [1f9243](https://github.com/coduo/php-humanizer/commit/1f924384c5f7b8bfbced89debac2b67b78511f7a) - **Merge pull request #21 from Ozmodiar/nl-translation** - [@norzechowicz](https://github.com/norzechowicz) +- [f5dafa](https://github.com/coduo/php-humanizer/commit/f5dafa6e721f93306496d3207e646a60c5bb4283) - **Merge pull request #18 from mattallty/patch-1** - [@norzechowicz](https://github.com/norzechowicz) +- [120f11](https://github.com/coduo/php-humanizer/commit/120f118c7051bdde9e9ea1d442cce6a70dfea8d9) - **Merge pull request #19 from NoUseFreak/composer_install** - [@norzechowicz](https://github.com/norzechowicz) +- [#19](https://github.com/coduo/php-humanizer/pull/19) - **Update composer installation instructions.** - [@NoUseFreak](https://github.com/NoUseFreak) +- [158714](https://github.com/coduo/php-humanizer/commit/1587145004b2f97b0562d359ef7c6d46e96295de) - **Merge pull request #16 from Ozmodiar/nl-translation** - [@norzechowicz](https://github.com/norzechowicz) +- [e49510](https://github.com/coduo/php-humanizer/commit/e49510dfd6e381489cfc5976b5683dba5d5e73da) - **Merge pull request #17 from Ozmodiar/readme-parenthesis** - [@norzechowicz](https://github.com/norzechowicz) + +### Fixed +- [3c3b83](https://github.com/coduo/php-humanizer/commit/3c3b830fad0f6e436a08b3f1adf20334a6a77604) - **doc** - [@smeeckaert](https://github.com/smeeckaert) +- [#18](https://github.com/coduo/php-humanizer/pull/18) - **typo in french translation** - [@mattallty](https://github.com/mattallty) +- [#17](https://github.com/coduo/php-humanizer/pull/17) - **parenthesis.** - [@Ozmodiar](https://github.com/Ozmodiar) + +## [1.0.7] - 2015-10-26 + +### Added +- [#15](https://github.com/coduo/php-humanizer/pull/15) - **spec for Italian translations** - [@norberttech](https://github.com/norberttech) +- [#14](https://github.com/coduo/php-humanizer/pull/14) - **italian translations.** - [@omissis](https://github.com/omissis) + +### Changed +- [a23b8e](https://github.com/coduo/php-humanizer/commit/a23b8e5b32a1b41e8e0d653a2de77ca090f47f8d) - **Merge pull request #15 from norzechowicz/italian-translations-spec** - [@norzechowicz](https://github.com/norzechowicz) +- [0db6f5](https://github.com/coduo/php-humanizer/commit/0db6f5d73b46bf8864b3dfc4823b29aeb97dd326) - **Merge pull request #14 from omissis/italian-translations** - [@norzechowicz](https://github.com/norzechowicz) +- [d05a54](https://github.com/coduo/php-humanizer/commit/d05a5494266fe5bc13e64aaa3c85cb58919fc63f) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) + +## [1.0.6] - 2015-10-26 + +### Changed +- [8d7fff](https://github.com/coduo/php-humanizer/commit/8d7fff6382f60b278ddb069d9088d9d35ce26540) - **Rename difference.pt_br.yml to difference.pt_BR.yml** - [@norzechowicz](https://github.com/norzechowicz) + +## [1.0.4] - 2015-10-26 + +### Added +- [#10](https://github.com/coduo/php-humanizer/pull/10) - **translation for Portuguese - Brazil** - [@IgorDePaula](https://github.com/IgorDePaula) +- [c6a594](https://github.com/coduo/php-humanizer/commit/c6a594a57ea3687cb199183b56a232761a81f736) - **specs for FR translations** - [@norberttech](https://github.com/norberttech) + +### Changed +- [6051e8](https://github.com/coduo/php-humanizer/commit/6051e89f3bacd816dced8b3d1cb3a07c1b9b0336) - **Merge pull request #12 from marcamon2013/master** - [@norzechowicz](https://github.com/norzechowicz) +- [#12](https://github.com/coduo/php-humanizer/pull/12) - **Translation file added** - [@jebog](https://github.com/jebog) +- [#13](https://github.com/coduo/php-humanizer/pull/13) - **create turkish translation** - [@cnkt](https://github.com/cnkt) +- [e007db](https://github.com/coduo/php-humanizer/commit/e007dbcccdf56ae2021f13b300f78e2fca628d5b) - **Merge pull request #13 from cnkt/master** - [@norzechowicz](https://github.com/norzechowicz) + +### Fixed +- [8754ad](https://github.com/coduo/php-humanizer/commit/8754ad1f0e680d547c4197cc48d13d7f0b6ab766) - **Translator Builder regexp, added spec and updated readme for pt_BR translation** - [@norberttech](https://github.com/norberttech) +- [38bc22](https://github.com/coduo/php-humanizer/commit/38bc22377a66d24d3ebda915afa09e83cf3d8581) - **typo in TR translations and added spec** - [@norberttech](https://github.com/norberttech) + +## [1.0.3] - 2015-10-24 + +### Added +- [9c6a59](https://github.com/coduo/php-humanizer/commit/9c6a59981ca6902644c7c35c8deea1cbc994d7c7) - **German locale specs** - [@norberttech](https://github.com/norberttech) + +### Changed +- [a91217](https://github.com/coduo/php-humanizer/commit/a91217819c7c1d3a0f6a41182784b98681cb6f83) - **Update README.md** - [@norzechowicz](https://github.com/norzechowicz) +- [c227c3](https://github.com/coduo/php-humanizer/commit/c227c3bfe343ce8322daee67bfb8116add20af1e) - **Rename difference-de.yml to difference.de.yml** - [@norzechowicz](https://github.com/norzechowicz) + +## [1.0.2] - 2015-10-24 + +### Added +- [#11](https://github.com/coduo/php-humanizer/pull/11) - **german translation** - [@tbreuss](https://github.com/tbreuss) + +### Changed +- [9cb14a](https://github.com/coduo/php-humanizer/commit/9cb14aa8c77d6dc6aaff87770680251c993c0b79) - **Merge pull request #11 from tbreuss/master** - [@norzechowicz](https://github.com/norzechowicz) + +## [1.0.1] - 2015-07-14 + +### Changed +- [#9](https://github.com/coduo/php-humanizer/pull/9) - **Test lowest version of dependencies** - [@norberttech](https://github.com/norberttech) +- [97fee0](https://github.com/coduo/php-humanizer/commit/97fee0dbe7999c4305a3de686f9fdc6b3502796e) - **Merge pull request #9 from norzechowicz/test-lowest-dependencies** - [@norzechowicz](https://github.com/norzechowicz) +- [d97917](https://github.com/coduo/php-humanizer/commit/d979178d45d631d9acd98394b90be3ff345c8c02) - **Update README.md** - [@defrag](https://github.com/defrag) +- [80500c](https://github.com/coduo/php-humanizer/commit/80500c5c50e45f0346af394e3031307923d59b5f) - **Update README.md** - [@defrag](https://github.com/defrag) +- [59a604](https://github.com/coduo/php-humanizer/commit/59a6045a716ec63bfb335ea326ce4ee82cf5a4f7) - **Update README.md** - [@defrag](https://github.com/defrag) + +## [1.0.0] - 2014-06-12 + +### Added +- [#8](https://github.com/coduo/php-humanizer/pull/8) - **missing require for symfony/yaml in composer.json** - [@dedik](https://github.com/dedik) +- [#4](https://github.com/coduo/php-humanizer/pull/4) - **truncate operation** - [@norberttech](https://github.com/norberttech) +- [#3](https://github.com/coduo/php-humanizer/pull/3) - **roman converters** - [@defrag](https://github.com/defrag) +- [#1](https://github.com/coduo/php-humanizer/pull/1) - **number and oridinalize** - [@defrag](https://github.com/defrag) +- [192a29](https://github.com/coduo/php-humanizer/commit/192a29e78fb2fe8595da1a43580a0a2f7914399c) - **travis configuration** - [@norberttech](https://github.com/norberttech) + +### Changed +- [b5a504](https://github.com/coduo/php-humanizer/commit/b5a504fec092d6d41391a1de6db09eb756e51895) - **Merge pull request #8 from dedik/master** - [@norberttech](https://github.com/norberttech) +- [673cc6](https://github.com/coduo/php-humanizer/commit/673cc617a158c83056ae7d1647467ef771a4fdbf) - **Update README.md** - [@defrag](https://github.com/defrag) +- [e5906b](https://github.com/coduo/php-humanizer/commit/e5906b5ea334a52960fab67f465246079fe971e3) - **Update README.md** - [@defrag](https://github.com/defrag) +- [43ba95](https://github.com/coduo/php-humanizer/commit/43ba95d307ae00d480393cce368491f62deee4f7) - **Merge pull request #7 from defrag/precise-date-fix** - [@norberttech](https://github.com/norberttech) +- [#6](https://github.com/coduo/php-humanizer/pull/6) - **Precise diffs** - [@defrag](https://github.com/defrag) +- [08b9d1](https://github.com/coduo/php-humanizer/commit/08b9d1b4f35d3f5846fb187248548d2148a261e5) - **Merge pull request #6 from defrag/precise-diff** - [@norberttech](https://github.com/norberttech) +- [7438be](https://github.com/coduo/php-humanizer/commit/7438be84cdc9831215bf99f83601ce3c4abfeb1e) - **Merge pull request #5 from norzechowicz/time** - [@defrag](https://github.com/defrag) +- [#5](https://github.com/coduo/php-humanizer/pull/5) - **[WIP] Introduce time difference humanizer** - [@norberttech](https://github.com/norberttech) +- [618179](https://github.com/coduo/php-humanizer/commit/618179735f5583ca8d425a8ccf375ce0afd22e55) - **Merge pull request #4 from norzechowicz/truncate** - [@defrag](https://github.com/defrag) +- [711775](https://github.com/coduo/php-humanizer/commit/71177557d8d4bc7b95e10170c34cd176a8287e38) - **Moved library to Coduo organization** - [@norberttech](https://github.com/norberttech) +- [6815c6](https://github.com/coduo/php-humanizer/commit/6815c651a7570802ccc5beaf3e6408e6abab1caa) - **Merge pull request #3 from defrag/roman** - [@norberttech](https://github.com/norberttech) +- [cee3c3](https://github.com/coduo/php-humanizer/commit/cee3c34860042bb93ce73d39ea32fd6b9acef3d1) - **Update readme** - [@norberttech](https://github.com/norberttech) +- [fda9db](https://github.com/coduo/php-humanizer/commit/fda9db3ef94591e80d627517390c42d688021d7a) - **Merge remote-tracking branch 'origin/master'** - [@norberttech](https://github.com/norberttech) +- [fd51e9](https://github.com/coduo/php-humanizer/commit/fd51e914d98d28943a34a3fea9237f4a8c6c7e90) - **Metric suffix** - [@norberttech](https://github.com/norberttech) +- [7b7d4e](https://github.com/coduo/php-humanizer/commit/7b7d4e4453211e1975f3004a74670e6ebdbecb1c) - **Merge pull request #2 from pborreli/typos** - [@norberttech](https://github.com/norberttech) +- [720bec](https://github.com/coduo/php-humanizer/commit/720becd16f48140d94a983e5eaa6c4e1b9879442) - **Update README.md** - [@norberttech](https://github.com/norberttech) +- [e62090](https://github.com/coduo/php-humanizer/commit/e62090a6ba103a63718fd17a5d6a0001f007ecac) - **Update README.md** - [@norberttech](https://github.com/norberttech) +- [d7fd45](https://github.com/coduo/php-humanizer/commit/d7fd45f39377298e35922843cfe004497898cf18) - **Binary suffix converter** - [@norberttech](https://github.com/norberttech) +- [65564e](https://github.com/coduo/php-humanizer/commit/65564e1202be4e67822e40c366dd36836bdec70a) - **Refactoring** - [@norberttech](https://github.com/norberttech) +- [58f3d5](https://github.com/coduo/php-humanizer/commit/58f3d560caba8ec66ca57ef66cc3e598ee5eb230) - **Merge pull request #1 from defrag/number** - [@norberttech](https://github.com/norberttech) +- [35d7e6](https://github.com/coduo/php-humanizer/commit/35d7e69c62e653f2f180b96597002bf143f79ec0) - **String humanize introduction** - [@norberttech](https://github.com/norberttech) +- [e2bfc6](https://github.com/coduo/php-humanizer/commit/e2bfc680b3f339f6bf2f6e39ce9a17f02eeaebbe) - **Initial commit** - [@norberttech](https://github.com/norberttech) + +### Fixed +- [#7](https://github.com/coduo/php-humanizer/pull/7) - **precise date calculations** - [@defrag](https://github.com/defrag) +- [#2](https://github.com/coduo/php-humanizer/pull/2) - **typos** - [@pborreli](https://github.com/pborreli) + +Generated by [Automation](https://github.com/aeon-php/automation) \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..6681a3f --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at norbert+coduo@orzechowicz.pl. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index ee409ba..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,23 +0,0 @@ -#A quick guide to contribute to the project: - -##Installing the dev environment - -1. Fork the repo -2. Clone the repo to local -3. Install dependencies: `composer install` (this assumes you have 'composer' aliased to whereever your composer.phar lives) -4. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: - `./bin/phpspec run --format=pretty` - -##The actual contribution - -1. Make the changes/additions to the code, committing often and making clear what you've done -2. Make sure you write tests for your code, located in the folder structure `spec/Coduo/PHPHumanizer/...` -3. Run your tests (often and while coding): `./bin/phpspec run --format=pretty` - -##Coding Standards - -Try use similar coding standards to what you see in the project to keep things clear to the contributors. If you're unsure, it's always a safe bet to fall-back to the PSR standards. - -[PSR-1: Basic Coding Standard](http://www.php-fig.org/psr/psr-1/) - -[PSR-2: Coding Style Guide](http://www.php-fig.org/psr/psr-2/) diff --git a/LICENSE b/LICENSE index 6773c8c..aac62ee 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014 Michal Dabrowski, Norbert Orzechowicz +Copyright (c) 2014-2021 Michal Dabrowski, Norbert Orzechowicz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/README.md b/README.md index 345a7ca..1f7e85d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PHP Humanizer -[![Build Status](https://travis-ci.com/coduo/php-humanizer.svg?branch=4.x)](https://travis-ci.com/coduo/php-humanizer) +![Tests](https://github.com/coduo/php-humanizer/workflows/Tests/badge.svg?branch=4.x) [![Latest Stable Version](https://poser.pugx.org/coduo/php-humanizer/v/stable)](https://packagist.org/packages/coduo/php-humanizer) [![Total Downloads](https://poser.pugx.org/coduo/php-humanizer/downloads)](https://packagist.org/packages/coduo/php-humanizer) [![Latest Unstable Version](https://poser.pugx.org/coduo/php-humanizer/v/unstable)](https://packagist.org/packages/coduo/php-humanizer) @@ -8,10 +8,8 @@ ### Tests * [![Build Status](https://travis-ci.com/coduo/php-humanizer.svg?branch=4.x)](https://travis-ci.com/coduo/php-humanizer) - 4.x -* [![Build Status](https://travis-ci.com/coduo/php-humanizer.svg?branch=3.0)](https://travis-ci.com/coduo/php-humanizer) - 3.0 [Readme for 4.x version](https://github.com/coduo/php-humanizer/tree/4.x/README.md) -[Readme for 3.0 version](https://github.com/coduo/php-humanizer/tree/3.0/README.md) diff --git a/composer.json b/composer.json index 098b493..58f5108 100644 --- a/composer.json +++ b/composer.json @@ -15,16 +15,13 @@ } ], "require": { - "php": ">=7.3", - "symfony/config": "^4.4|^5.0", + "php": "^7.4 | ^8.0", "symfony/translation": "^4.4|^5.0", "symfony/yaml": "^4.4|^5.0" }, "require-dev": { "thunderer/shortcode": "^0.7", - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.4", - "friendsofphp/php-cs-fixer": "^2.16" + "phpunit/phpunit": "^9.4" }, "config": { "bin-dir": "bin" @@ -39,22 +36,24 @@ "": "tests/" } }, - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, "suggest": { "ext-intl": "Required if you are going to use humanizer with locales different than en_EN" }, "scripts": { "cs:php:fix": [ - "php-cs-fixer fix --using-cache=no" + "tools/php-cs-fixer fix --using-cache=no" + ], + "test" : [ + "phpunit" + ], + "test:mutation": [ + "Composer\\Config::disableProcessTimeout", + "tools/infection" ], - "test": [ - "phpspec run --format=pretty", - "phpunit", - "php-cs-fixer fix -v --dry-run" + "static:analyze": [ + "tools/psalm --shepherd --stats", + "tools/phpstan analyze -c phpstan.neon", + "tools/php-cs-fixer fix --dry-run" ] } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..d0fe9ed --- /dev/null +++ b/composer.lock @@ -0,0 +1,2640 @@ +{ + "_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": "2266b8e08228e1596ce0366b445cd246", + "packages": [ + { + "name": "symfony/deprecation-contracts", + "version": "v2.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.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": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/master" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-09-07T11:33:47+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.22.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-07T16:49:33+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.22.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", + "reference": "5232de97ee3b75b0360528dae24e73db49566ab1", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "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" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-22T09:19:47+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.22.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", + "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.22-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-07T16:49:33+00:00" + }, + { + "name": "symfony/translation", + "version": "v5.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "c021864d4354ee55160ddcfd31dc477a1bc77949" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/c021864d4354ee55160ddcfd31dc477a1bc77949", + "reference": "c021864d4354ee55160ddcfd31dc477a1bc77949", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.15", + "symfony/translation-contracts": "^2.3" + }, + "conflict": { + "symfony/config": "<4.4", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" + }, + "provide": { + "symfony/translation-implementation": "2.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/http-kernel": "^5.0", + "symfony/intl": "^4.4|^5.0", + "symfony/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^4.4|^5.0" + }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "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": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v5.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-27T10:15:41+00:00" + }, + { + "name": "symfony/translation-contracts", + "version": "v2.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e2eaa60b558f26a4b0354e1bbb25636efaaad105", + "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "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": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-09-28T13:05:58+00:00" + }, + { + "name": "symfony/yaml", + "version": "v5.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "338cddc6d74929f6adf19ca5682ac4b8e109cdb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/338cddc6d74929f6adf19ca5682ac4b8e109cdb0", + "reference": "338cddc6d74929f6adf19ca5682ac4b8e109cdb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<4.4" + }, + "require-dev": { + "symfony/console": "^4.4|^5.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "bin": [ + "Resources/bin/yaml-lint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Loads and dumps YAML files", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v5.2.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-03T04:42:09+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "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": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-11-10T18:47:58+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.10.2", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.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" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-11-13T09:40:50+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.10.4", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + }, + "time": "2020-12-20T10:01:03+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "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": "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)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, + "time": "2020-06-27T14:33:11+00:00" + }, + { + "name": "phar-io/version", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", + "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.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", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.0.4" + }, + "time": "2020-12-13T23:18:30+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.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" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.2.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + }, + "time": "2020-09-03T19:13:55+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.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": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + }, + "time": "2020-09-17T18:55:26+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.12.2", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "245710e971a030f42e08f4912863805570f23d39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", + "reference": "245710e971a030f42e08f4912863805570f23d39", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "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" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.12.2" + }, + "time": "2020-12-19T10:15:11+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", + "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.10.2", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:44:49+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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", + "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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:57:25+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.5.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", + "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3", + "sebastian/version": "^3.0.2" + }, + "require-dev": { + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" + ] + }, + "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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" + }, + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-02-02T14:45:58+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:24:23+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", + "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:55:19+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-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/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.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": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "2.3.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-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": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:18:59+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "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", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.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", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/master" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2020-07-12T23:59:07+00:00" + }, + { + "name": "thunderer/shortcode", + "version": "v0.7.4", + "source": { + "type": "git", + "url": "https://github.com/thunderer/Shortcode.git", + "reference": "79a219febd774ba1ee66a2992fee1145b4367561" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thunderer/Shortcode/zipball/79a219febd774ba1ee66a2992fee1145b4367561", + "reference": "79a219febd774ba1ee66a2992fee1145b4367561", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": ">=4.1", + "symfony/yaml": ">=2.0" + }, + "suggest": { + "ext-dom": "if you want to use XML serializer", + "ext-json": "if you want to use JSON serializer", + "symfony/yaml": "if you want to use YAML serializer" + }, + "type": "library", + "autoload": { + "psr-4": { + "Thunder\\Shortcode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tomasz Kowalczyk", + "email": "tomasz@kowalczyk.cc" + } + ], + "description": "Advanced shortcode (BBCode) parser and engine for PHP", + "keywords": [ + "bbcode", + "engine", + "library", + "parser", + "shortcode" + ], + "support": { + "issues": "https://github.com/thunderer/Shortcode/issues", + "source": "https://github.com/thunderer/Shortcode/tree/v0.7.4" + }, + "time": "2020-03-08T11:25:13+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "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" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.9.1" + }, + "time": "2020-07-08T17:02:28+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.4 | ^8.0" + }, + "platform-dev": [], + "plugin-api-version": "2.0.0" +} diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..d05e1a4 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,6 @@ +parameters: + level: max + paths: + - src + + tmpDir: var/phpstan/cache diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 546b974..e4936a9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,23 +1,23 @@ - + - + ./tests/ - - - ./src/Coduo/PHPHumanizer/ - - + + + + ./src/ + + + + + + \ No newline at end of file diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..33f2f7e --- /dev/null +++ b/psalm.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/spec/Coduo/PHPHumanizer/Collection/FormatterSpec.php b/spec/Coduo/PHPHumanizer/Collection/FormatterSpec.php deleted file mode 100644 index e7bc4a8..0000000 --- a/spec/Coduo/PHPHumanizer/Collection/FormatterSpec.php +++ /dev/null @@ -1,47 +0,0 @@ -beConstructedWith($translator); - $translator->trans( - 'only_two', - array('%first%' => 'Michal', '%second%' => 'Norbert'), - 'oxford' - )->willReturn('Michal and Norbert'); - - $translator->trans( - 'comma_separated_with_limit', - array('%count%' => 1, "%list%" => 'Michal, Norbert'), - 'oxford' - )->willReturn('Michal, Norbert and 1 more'); - - $translator->trans( - 'comma_separated', - array("%list%" => 'Michal, Norbert', '%last%' => "Lukasz"), - 'oxford' - )->willReturn('Michal, Norbert and Lukasz'); - } - - function it_formats_two_elements() - { - $this->format(array("Michal", "Norbert"), null)->shouldReturn("Michal and Norbert"); - } - - function it_formats_elements_with_limit() - { - $this->format(array("Michal", "Norbert", "Lukasz"), 2)->shouldReturn("Michal, Norbert and 1 more"); - } - - function it_formats_elements_without_limit() - { - $this->format(array("Michal", "Norbert", "Lukasz"), null)->shouldReturn("Michal, Norbert and Lukasz"); - } -} diff --git a/spec/Coduo/PHPHumanizer/Collection/OxfordSpec.php b/spec/Coduo/PHPHumanizer/Collection/OxfordSpec.php deleted file mode 100644 index 536e4d3..0000000 --- a/spec/Coduo/PHPHumanizer/Collection/OxfordSpec.php +++ /dev/null @@ -1,45 +0,0 @@ -formatter = new Formatter( - $translator->getWrappedObject() - ); - $this->beConstructedWith($this->formatter); - } - function it_returns_empty_string_when_collection_is_empty() - { - $this->format(array())->shouldReturn(''); - } - - function it_returns_collection_item_string_when_collection_has_one_element() - { - $this->format(array(new CollectionItem("Michal")))->shouldReturn('Michal'); - } -} - -class CollectionItem -{ - private $name; - - public function __construct($name) - { - $this->name = $name; - } - - public function __toString() - { - return $this->name; - } -} diff --git a/spec/Coduo/PHPHumanizer/DateTime/DifferenceSpec.php b/spec/Coduo/PHPHumanizer/DateTime/DifferenceSpec.php deleted file mode 100644 index dc41b9e..0000000 --- a/spec/Coduo/PHPHumanizer/DateTime/DifferenceSpec.php +++ /dev/null @@ -1,106 +0,0 @@ -beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 12:45:00")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Minute'); - $this->getQuantity()->shouldReturn(15); - $this->isPast()->shouldReturn(true); - } - - function it_calculate_diff_between_present_and_future_date_in_minutes() - { - $this->beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 13:15:00")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Minute'); - $this->getQuantity()->shouldReturn(15); - $this->isPast()->shouldReturn(false); - } - - function it_calculate_diff_between_present_and_past_date_in_hours() - { - $this->beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 11:00:00")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Hour'); - $this->getQuantity()->shouldReturn(2); - $this->isPast()->shouldReturn(true); - } - - function it_calculate_diff_between_present_and_future_date_in_hours() - { - $this->beConstructedWith(new \DateTime("2014-04-26 13:00:00"), new \DateTime("2014-04-26 16:00:00")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Hour'); - $this->getQuantity()->shouldReturn(3); - $this->isPast()->shouldReturn(false); - } - - function it_calculate_diff_between_present_and_past_date_in_days() - { - $this->beConstructedWith(new \DateTime("2014-04-10"), new \DateTime("2014-04-09")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Day'); - $this->getQuantity()->shouldReturn(1); - $this->isPast()->shouldReturn(true); - } - - function it_calculate_diff_between_present_and_future_date_in_days() - { - $this->beConstructedWith(new \DateTime("2014-04-10"), new \DateTime("2014-04-11")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Day'); - $this->getQuantity()->shouldReturn(1); - $this->isPast()->shouldReturn(false); - } - - function it_calculate_diff_between_present_and_past_date_in_weeks() - { - $this->beConstructedWith(new \DateTime("2014-04-15"), new \DateTime("2014-04-01")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Week'); - $this->getQuantity()->shouldReturn(2); - $this->isPast()->shouldReturn(true); - } - - function it_calculate_diff_between_present_and_future_date_in_weeks() - { - $this->beConstructedWith(new \DateTime("2014-04-01"), new \DateTime("2014-04-15")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Week'); - $this->getQuantity()->shouldReturn(2); - $this->isPast()->shouldReturn(false); - } - - function it_calculate_diff_between_present_and_past_date_in_months() - { - $this->beConstructedWith(new \DateTime("2014-04-01"), new \DateTime("2014-03-01")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Month'); - $this->getQuantity()->shouldReturn(1); - $this->isPast()->shouldReturn(true); - } - - function it_calculate_diff_between_present_and_future_date_in_months() - { - $this->beConstructedWith(new \DateTime("2014-04-01"), new \DateTime("2014-05-01")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Month'); - $this->getQuantity()->shouldReturn(1); - $this->isPast()->shouldReturn(false); - } - - function it_calculate_diff_between_present_and_past_date_in_years() - { - $this->beConstructedWith(new \DateTime("2014-01-01"), new \DateTime("2012-01-01")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Year'); - $this->getQuantity()->shouldReturn(2); - $this->isPast()->shouldReturn(true); - } - - function it_calculate_diff_between_present_and_future_date_in_years() - { - $this->beConstructedWith(new \DateTime("2014-01-01"), new \DateTime("2015-01-01")); - $this->getUnit()->shouldReturnAnInstanceOf('Coduo\PHPHumanizer\DateTime\Unit\Year'); - $this->getQuantity()->shouldReturn(1); - $this->isPast()->shouldReturn(false); - } -} diff --git a/spec/Coduo/PHPHumanizer/DateTime/FormatterSpec.php b/spec/Coduo/PHPHumanizer/DateTime/FormatterSpec.php deleted file mode 100644 index 1372ad3..0000000 --- a/spec/Coduo/PHPHumanizer/DateTime/FormatterSpec.php +++ /dev/null @@ -1,50 +0,0 @@ -beConstructedWith($translator); - $translator->trans( - 'minute.past', - array('%count%' => 10), - 'difference', - 'en' - )->willReturn('10 minutes ago'); - - $translator->trans( - 'minute.past', - array('%count%' => 10), - 'difference', - 'pl' - )->willReturn('10 minut temu'); - } - - function it_format_datetime_diff() - { - $diff = new Difference( - new \DateTime("2015-01-01 00:10:00"), - new \DateTime("2015-01-01 00:00:00") - ); - - $this->formatDifference($diff)->shouldReturn('10 minutes ago'); - } - - function it_format_datetime_diff_for_specific_locale() - { - $diff = new Difference( - new \DateTime("2015-01-01 00:10:00"), - new \DateTime("2015-01-01 00:00:00") - ); - - $this->formatDifference($diff, 'pl')->shouldReturn('10 minut temu'); - } -} diff --git a/spec/Coduo/PHPHumanizer/DateTime/PreciseFormatterSpec.php b/spec/Coduo/PHPHumanizer/DateTime/PreciseFormatterSpec.php deleted file mode 100644 index 5228235..0000000 --- a/spec/Coduo/PHPHumanizer/DateTime/PreciseFormatterSpec.php +++ /dev/null @@ -1,80 +0,0 @@ -beConstructedWith($translator); - $translator->trans( - 'compound.day', - array('%count%' => 10), - 'difference', - 'en' - )->willReturn('10 days'); - - $translator->trans( - 'compound.hour', - array('%count%' => 5), - 'difference', - 'en' - )->willReturn('5 hours'); - - $translator->trans( - 'compound.future', - array('%value%' => '10 days, 5 hours'), - 'difference', - 'en' - )->willReturn('10 days, 5 hours from now'); - - $translator->trans( - 'compound.day', - array('%count%' => 10), - 'difference', - 'ru' - )->willReturn('10 дней'); - - $translator->trans( - 'compound.hour', - array('%count%' => 5), - 'difference', - 'ru' - )->willReturn('5 часов'); - - $translator->trans( - 'compound.future', - array('%value%' => '10 дней, 5 часов'), - 'difference', - 'ru' - )->willReturn('через 10 дней, 5 часов'); - } - - function it_format_compound_datetime_diff() - { - $diff = new PreciseDifference( - new \DateTime("2015-01-01 00:00:00"), - new \DateTime("2015-01-11 05:00:00") - ); - - $this->formatDifference($diff)->shouldReturn('10 days, 5 hours from now'); - } - - function it_format_compound_datetime_diff_for_specific_locale() - { - $diff = new PreciseDifference( - new \DateTime("2015-01-01 00:00:00"), - new \DateTime("2015-01-11 05:00:00") - ); - - $this->formatDifference($diff, 'ru')->shouldReturn('через 10 дней, 5 часов'); - } -} diff --git a/spec/Coduo/PHPHumanizer/String/WordBreakpointSpec.php b/spec/Coduo/PHPHumanizer/String/WordBreakpointSpec.php deleted file mode 100644 index f608032..0000000 --- a/spec/Coduo/PHPHumanizer/String/WordBreakpointSpec.php +++ /dev/null @@ -1,36 +0,0 @@ -calculatePosition('Lorem ipsum dolorem', 2)->shouldReturn(5); - $this->calculatePosition('Lorem ipsum dolorem', 4)->shouldReturn(5); - $this->calculatePosition('Lorem ipsum dolorem', 5)->shouldReturn(5); - $this->calculatePosition('Lorem ipsum dolorem', 10)->shouldReturn(11); - $this->calculatePosition('Lorem ipsum dolorem', -2)->shouldReturn(19); - $this->calculatePosition('Lorem ipsum dolorem', 0)->shouldReturn(5); - } - - function it_calculate_breakpoint_position_when_sentence_is_shorter_than_characters_count() - { - $this->calculatePosition('Lorem ipsum dolorem', 20)->shouldReturn(19); - } - - function it_calculate_breakpoint_position_when_characters_count_ends_in_last_word() - { - $this->calculatePosition('Lorem ipsum', 7)->shouldReturn(11); - } - - function it_calculate_breakpoint_position_when_characters_count_ends_in_last_space() - { - $this->calculatePosition('Lorem ipsum', 5)->shouldReturn(5); - } -} diff --git a/tests/Coduo/PHPHumanizer/Tests/Collection/FormatterTest.php b/tests/Coduo/PHPHumanizer/Tests/Collection/FormatterTest.php new file mode 100644 index 0000000..316dd4c --- /dev/null +++ b/tests/Coduo/PHPHumanizer/Tests/Collection/FormatterTest.php @@ -0,0 +1,49 @@ +assertSame( + 'Michal and Norbert', + $formatter->format(['Michal', 'Norbert'], null) + ); + } + + public function test_formats_elements_with_limit() + { + $formatter = new Formatter(Builder::build('en')); + + $this->assertSame( + 'Michal, Norbert, and 1 other', + $formatter->format(['Michal', 'Norbert', 'Lukasz'], 2) + ); + } + + public function test_formats_elements_without_limit() + { + $formatter = new Formatter(Builder::build('en')); + + $this->assertSame( + 'Michal, Norbert, and Lukasz', + $formatter->format(['Michal', 'Norbert', 'Lukasz'], null) + ); + } +} diff --git a/tests/Coduo/PHPHumanizer/Tests/Collection/OxfordTest.php b/tests/Coduo/PHPHumanizer/Tests/Collection/OxfordTest.php new file mode 100644 index 0000000..5a56fcc --- /dev/null +++ b/tests/Coduo/PHPHumanizer/Tests/Collection/OxfordTest.php @@ -0,0 +1,36 @@ +assertSame( + '', + (new Oxford(new Formatter(Builder::build('en'))))->format([]) + ); + } + + public function test_returns_collection_item_string_when_collection_has_one_element() : void + { + $this->assertSame( + 'Michal', + (new Oxford(new Formatter(Builder::build('en'))))->format(['Michal']) + ); + } +} diff --git a/tests/Coduo/PHPHumanizer/Tests/DateTime/DifferenceTest.php b/tests/Coduo/PHPHumanizer/Tests/DateTime/DifferenceTest.php new file mode 100644 index 0000000..43c9ec5 --- /dev/null +++ b/tests/Coduo/PHPHumanizer/Tests/DateTime/DifferenceTest.php @@ -0,0 +1,120 @@ +assertInstanceOf(Minute::class, $diff->getUnit()); + $this->assertSame(15, $diff->getQuantity()); + $this->assertTrue($diff->isPast()); + } + + public function test_calculate_diff_between_present_and_future_date_in_minutes() + { + $diff = new Difference(new \DateTime('2014-04-26 13:00:00'), new \DateTime('2014-04-26 13:15:00')); + $this->assertInstanceOf(Minute::class, $diff->getUnit()); + $this->assertSame(15, $diff->getQuantity()); + $this->assertFalse($diff->isPast()); + } + + public function test_calculate_diff_between_present_and_past_date_in_hours() + { + $diff = new Difference(new \DateTime('2014-04-26 13:00:00'), new \DateTime('2014-04-26 11:00:00')); + $this->assertInstanceOf(Hour::class, $diff->getUnit()); + $this->assertSame(2, $diff->getQuantity()); + $this->assertSame(true, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_future_date_in_hours() + { + $diff = new Difference(new \DateTime('2014-04-26 13:00:00'), new \DateTime('2014-04-26 16:00:00')); + $this->assertInstanceOf(Hour::class, $diff->getUnit()); + $this->assertSame(3, $diff->getQuantity()); + $this->assertSame(false, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_past_date_in_days() + { + $diff = new Difference(new \DateTime('2014-04-10'), new \DateTime('2014-04-09')); + $this->assertInstanceOf(Day::class, $diff->getUnit()); + $this->assertSame(1, $diff->getQuantity()); + $this->assertSame(true, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_future_date_in_days() + { + $diff = new Difference(new \DateTime('2014-04-10'), new \DateTime('2014-04-11')); + $this->assertInstanceOf(Day::class, $diff->getUnit()); + $this->assertSame(1, $diff->getQuantity()); + $this->assertSame(false, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_past_date_in_weeks() + { + $diff = new Difference(new \DateTime('2014-04-15'), new \DateTime('2014-04-01')); + $this->assertInstanceOf(Week::class, $diff->getUnit()); + $this->assertSame(2, $diff->getQuantity()); + $this->assertSame(true, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_future_date_in_weeks() + { + $diff = new Difference(new \DateTime('2014-04-01'), new \DateTime('2014-04-15')); + $this->assertInstanceOf(Week::class, $diff->getUnit()); + $this->assertSame(2, $diff->getQuantity()); + $this->assertSame(false, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_past_date_in_months() + { + $diff = new Difference(new \DateTime('2014-04-01'), new \DateTime('2014-03-01')); + $this->assertInstanceOf(Month::class, $diff->getUnit()); + $this->assertSame(1, $diff->getQuantity()); + $this->assertSame(true, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_future_date_in_months() + { + $diff = new Difference(new \DateTime('2014-04-01'), new \DateTime('2014-05-01')); + $this->assertInstanceOf(Month::class, $diff->getUnit()); + $this->assertSame(1, $diff->getQuantity()); + $this->assertSame(false, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_past_date_in_years() + { + $diff = new Difference(new \DateTime('2014-01-01'), new \DateTime('2012-01-01')); + $this->assertInstanceOf(Year::class, $diff->getUnit()); + $this->assertSame(2, $diff->getQuantity()); + $this->assertSame(true, $diff->isPast()); + } + + public function test_calculate_diff_between_present_and_future_date_in_years() + { + $diff = new Difference(new \DateTime('2014-01-01'), new \DateTime('2015-01-01')); + $this->assertInstanceOf(Year::class, $diff->getUnit()); + $this->assertSame(1, $diff->getQuantity()); + $this->assertSame(false, $diff->isPast()); + } +} diff --git a/tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php b/tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php new file mode 100644 index 0000000..91719ed --- /dev/null +++ b/tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php @@ -0,0 +1,37 @@ +assertSame('10 minutes ago', $formatter->formatDifference($diff)); + } + + public function test_format_datetime_diff_for_specific_locale() : void + { + $diff = new Difference( + new \DateTime("2015-01-01 00:10:00"), + new \DateTime("2015-01-01 00:00:00") + ); + + $formatter = new Formatter(Builder::build('en')); + + $this->assertSame('10 minut temu', $formatter->formatDifference($diff, 'pl')); + } +} \ No newline at end of file diff --git a/tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php b/tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php new file mode 100644 index 0000000..8de07c9 --- /dev/null +++ b/tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php @@ -0,0 +1,37 @@ +assertSame('10 days, 5 hours from now', $formatter->formatDifference($diff)); + } + + public function test_format_compound_datetime_diff_for_specific_locale() + { + $diff = new PreciseDifference( + new \DateTime("2015-01-01 00:00:00"), + new \DateTime("2015-01-11 05:00:00") + ); + + $formatter = new PreciseFormatter(Builder::build('en')); + + $this->assertSame('через 10 дней, 5 часов', $formatter->formatDifference($diff, 'ru')); + } +} \ No newline at end of file diff --git a/tests/Coduo/PHPHumanizer/Tests/String/WordBreakpointTest.php b/tests/Coduo/PHPHumanizer/Tests/String/WordBreakpointTest.php new file mode 100644 index 0000000..1dd46da --- /dev/null +++ b/tests/Coduo/PHPHumanizer/Tests/String/WordBreakpointTest.php @@ -0,0 +1,51 @@ +assertSame(5, $wordBreakpoint->calculatePosition('Lorem ipsum dolorem', 2)); + $this->assertSame(5, $wordBreakpoint->calculatePosition('Lorem ipsum dolorem', 4)); + $this->assertSame(5, $wordBreakpoint->calculatePosition('Lorem ipsum dolorem', 5)); + $this->assertSame(11, $wordBreakpoint->calculatePosition('Lorem ipsum dolorem', 10)); + $this->assertSame(19, $wordBreakpoint->calculatePosition('Lorem ipsum dolorem', -2)); + $this->assertSame(5, $wordBreakpoint->calculatePosition('Lorem ipsum dolorem', 0)); + } + + public function test_calculate_breakpoint_position_when_sentence_is_shorter_than_characters_count() + { + $wordBreakpoint = new WordBreakpoint(); + + $this->assertSame(19, $wordBreakpoint->calculatePosition('Lorem ipsum dolorem', 20)); + } + + public function test_calculate_breakpoint_position_when_characters_count_ends_in_last_word() + { + $wordBreakpoint = new WordBreakpoint(); + + $this->assertSame(11, $wordBreakpoint->calculatePosition('Lorem ipsum', 7)); + } + + public function test_calculate_breakpoint_position_when_characters_count_ends_in_last_space() + { + $wordBreakpoint = new WordBreakpoint(); + + $this->assertSame(5, $wordBreakpoint->calculatePosition('Lorem ipsum', 5)); + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index 008bbfe..0000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,12 +0,0 @@ - Date: Sun, 21 Feb 2021 22:53:40 +0100 Subject: [PATCH 2/5] Fixed static analyze errors --- baseline.xml | 26 ++++++++++ psalm.xml | 1 + .../PHPHumanizer/Collection/Formatter.php | 49 ++++++------------- src/Coduo/PHPHumanizer/Collection/Oxford.php | 17 ++----- .../PHPHumanizer/CollectionHumanizer.php | 7 +-- .../PHPHumanizer/DateTime/Difference.php | 35 ++++--------- .../DateTime/Difference/CompoundResult.php | 29 +++-------- src/Coduo/PHPHumanizer/DateTime/Formatter.php | 18 ++----- .../DateTime/PreciseDifference.php | 28 +++++------ .../DateTime/PreciseFormatter.php | 18 ++----- src/Coduo/PHPHumanizer/DateTime/Unit.php | 13 ++--- src/Coduo/PHPHumanizer/DateTime/Unit/Day.php | 9 ++-- src/Coduo/PHPHumanizer/DateTime/Unit/Hour.php | 9 ++-- .../PHPHumanizer/DateTime/Unit/JustNow.php | 9 ++-- .../PHPHumanizer/DateTime/Unit/Minute.php | 9 ++-- .../PHPHumanizer/DateTime/Unit/Month.php | 9 ++-- .../PHPHumanizer/DateTime/Unit/Second.php | 9 ++-- src/Coduo/PHPHumanizer/DateTime/Unit/Week.php | 9 ++-- src/Coduo/PHPHumanizer/DateTime/Unit/Year.php | 9 ++-- src/Coduo/PHPHumanizer/DateTimeHumanizer.php | 16 +----- src/Coduo/PHPHumanizer/Number/Ordinal.php | 11 ++--- .../PHPHumanizer/Number/Ordinal/Builder.php | 29 ++++++----- .../Number/Ordinal/StrategyInterface.php | 8 +-- .../PHPHumanizer/Number/RomanNumeral.php | 28 ++++++++--- src/Coduo/PHPHumanizer/NumberHumanizer.php | 40 ++++++--------- .../Resources/Ordinal/DeStrategy.php | 8 +-- .../Resources/Ordinal/EnStrategy.php | 10 +--- .../Resources/Ordinal/EsStrategy.php | 8 +-- .../Resources/Ordinal/FrStrategy.php | 8 +-- .../Resources/Ordinal/IdStrategy.php | 11 ++--- .../Resources/Ordinal/ItStrategy.php | 8 +-- .../Resources/Ordinal/NlStrategy.php | 10 +--- .../Resources/Ordinal/PtStrategy.php | 8 +-- .../PHPHumanizer/String/BinarySuffix.php | 49 +++++++------------ src/Coduo/PHPHumanizer/String/Breakpoint.php | 8 +-- .../PHPHumanizer/String/HtmlTruncate.php | 40 ++++----------- src/Coduo/PHPHumanizer/String/Humanize.php | 30 ++++-------- .../PHPHumanizer/String/MetricSuffix.php | 34 ++++++------- .../String/ShortcodeProcessor.php | 34 ++++--------- .../PHPHumanizer/String/TextTruncate.php | 28 +++-------- .../PHPHumanizer/String/TruncateInterface.php | 8 +-- .../PHPHumanizer/String/WordBreakpoint.php | 15 ++---- src/Coduo/PHPHumanizer/StringHumanizer.php | 44 +++-------------- src/Coduo/PHPHumanizer/Translator/Builder.php | 6 +-- .../Tests/DateTime/FormatterTest.php | 17 +++++-- .../Tests/DateTime/PreciseFormatterTest.php | 17 +++++-- .../Tests/NumberHumanizerTest.php | 7 --- 47 files changed, 291 insertions(+), 562 deletions(-) create mode 100644 baseline.xml diff --git a/baseline.xml b/baseline.xml new file mode 100644 index 0000000..96ef6bc --- /dev/null +++ b/baseline.xml @@ -0,0 +1,26 @@ + + + + + $diff->{$unit->getDateIntervalSymbol()} + + + + + new $strategy() + + + + + $resourceName + + + $file + $resourceName + + + getBasename + getPathname + + + diff --git a/psalm.xml b/psalm.xml index 33f2f7e..7d8635e 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,6 +6,7 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" cacheDirectory="var/psalm/cache" + errorBaseline="baseline.xml" > diff --git a/src/Coduo/PHPHumanizer/Collection/Formatter.php b/src/Coduo/PHPHumanizer/Collection/Formatter.php index aa0798a..2f49887 100644 --- a/src/Coduo/PHPHumanizer/Collection/Formatter.php +++ b/src/Coduo/PHPHumanizer/Collection/Formatter.php @@ -15,26 +15,20 @@ final class Formatter { - /** - * @var TranslatorInterface - */ - private $translator; + private TranslatorInterface $translator; - /** - * @var string - */ - private $catalogue; + private string $catalogue; - /** - * @param TranslatorInterface $translator - */ - public function __construct(TranslatorInterface $translator, $catalogue = 'oxford') + public function __construct(TranslatorInterface $translator, string $catalogue = 'oxford') { $this->translator = $translator; $this->catalogue = $catalogue; } - public function format($collection, $limit = null) + /** + * @param array $collection + */ + public function format(array $collection, int $limit = null): string { $count = \count($collection); @@ -58,17 +52,11 @@ public function format($collection, $limit = null) } /** - * @param $collection - * @param $limit - * @param $count - * - * @return string + * @param array $collection */ - private function formatCommaSeparatedWithLimit($collection, $limit, $count) + private function formatCommaSeparatedWithLimit(array $collection, ?int $limit, int $count): string { - $display = \array_map(function ($element) { - return (string) $element; - }, \array_slice($collection, 0, $limit)); + $display = \array_map(fn ($element) => (string) $element, \array_slice($collection, 0, $limit)); $moreCount = $count - \count($display); @@ -79,16 +67,11 @@ private function formatCommaSeparatedWithLimit($collection, $limit, $count) } /** - * @param $collection - * @param $count - * - * @return string + * @param array $collection */ - private function formatCommaSeparated($collection, $count) + private function formatCommaSeparated(array $collection, int $count): string { - $display = \array_map(function ($element) { - return (string) $element; - }, \array_slice($collection, 0, $count - 1)); + $display = \array_map(fn ($element) => (string) $element, \array_slice($collection, 0, $count - 1)); return $this->translator->trans('comma_separated', [ '%list%' => \implode(', ', $display), @@ -97,11 +80,9 @@ private function formatCommaSeparated($collection, $count) } /** - * @param $collection - * - * @return string + * @param array $collection */ - private function formatOnlyTwo($collection) + private function formatOnlyTwo(array $collection): string { return $this->translator->trans('only_two', [ '%first%' => (string) $collection[0], diff --git a/src/Coduo/PHPHumanizer/Collection/Oxford.php b/src/Coduo/PHPHumanizer/Collection/Oxford.php index a27cf80..2f84c21 100644 --- a/src/Coduo/PHPHumanizer/Collection/Oxford.php +++ b/src/Coduo/PHPHumanizer/Collection/Oxford.php @@ -13,28 +13,17 @@ final class Oxford { - /** - * @var Formatter - */ - private $formatter; + private Formatter $formatter; - /** - * Oxford constructor. - * - * @param Formatter $formatter - */ public function __construct(Formatter $formatter) { $this->formatter = $formatter; } /** - * @param $collection - * @param null $limit - * - * @return string + * @param array $collection */ - public function format($collection, $limit = null) + public function format(array $collection, int $limit = null): string { return $this->formatter->format($collection, $limit); } diff --git a/src/Coduo/PHPHumanizer/CollectionHumanizer.php b/src/Coduo/PHPHumanizer/CollectionHumanizer.php index 548cdc4..e7c2bce 100644 --- a/src/Coduo/PHPHumanizer/CollectionHumanizer.php +++ b/src/Coduo/PHPHumanizer/CollectionHumanizer.php @@ -18,12 +18,9 @@ final class CollectionHumanizer { /** - * @param $collection - * @param null $limit - * @param string $locale - * @return string + * @param array $collection */ - public static function oxford($collection, $limit = null, $locale = 'en') + public static function oxford(array $collection, int $limit = null, string $locale = 'en'): string { $oxford = new Oxford( new Formatter(Builder::build($locale)) diff --git a/src/Coduo/PHPHumanizer/DateTime/Difference.php b/src/Coduo/PHPHumanizer/DateTime/Difference.php index 60fce9a..2ca8258 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Difference.php +++ b/src/Coduo/PHPHumanizer/DateTime/Difference.php @@ -22,25 +22,16 @@ final class Difference { - /** - * @var \DateTime - */ - private $fromDate; + private \DateTime $fromDate; - /** - * @var \DateTime - */ - private $toDate; + private \DateTime $toDate; /** - * @var \Coduo\PHPHumanizer\DateTime\Unit + * @psalm-suppress PropertyNotSetInConstructor */ - private $unit; + private Unit $unit; - /** - * @var int - */ - private $quantity; + private ?int $quantity = null; public function __construct(\DateTime $fromDate, \DateTime $toDate) { @@ -49,25 +40,19 @@ public function __construct(\DateTime $fromDate, \DateTime $toDate) $this->calculate(); } - /** - * @return Unit - */ - public function getUnit() + public function getUnit(): Unit { return $this->unit; } - /** - * @return int - */ - public function getQuantity() + public function getQuantity(): ?int { return $this->quantity; } - private function calculate() + private function calculate(): void { - /* @var $units \Coduo\PHPHumanizer\DateTime\Unit[] */ + /* @var $units Unit[] */ $units = [ new Year(), new Month(), @@ -92,7 +77,7 @@ private function calculate() : (int) \round($absoluteMilliSecondsDiff / $this->unit->getMilliseconds()); } - public function isPast() + public function isPast(): bool { $diff = $this->toDate->getTimestamp() - $this->fromDate->getTimestamp(); diff --git a/src/Coduo/PHPHumanizer/DateTime/Difference/CompoundResult.php b/src/Coduo/PHPHumanizer/DateTime/Difference/CompoundResult.php index 7178ea1..512fd1b 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Difference/CompoundResult.php +++ b/src/Coduo/PHPHumanizer/DateTime/Difference/CompoundResult.php @@ -15,46 +15,31 @@ final class CompoundResult { - /** - * @var \Coduo\PHPHumanizer\DateTime\Unit - */ - private $unit; - private $quantity; + private Unit $unit; + private int $quantity; - public function __construct(Unit $unit, $quantity) + public function __construct(Unit $unit, int $quantity) { $this->unit = $unit; $this->quantity = $quantity; } - /** - * @param mixed $quantity - */ - public function setQuantity($quantity) + public function setQuantity(int $quantity): void { $this->quantity = $quantity; } - /** - * @return mixed - */ - public function getQuantity() + public function getQuantity() : int { return $this->quantity; } - /** - * @param \Coduo\PHPHumanizer\DateTime\Unit $unit - */ - public function setUnit($unit) + public function setUnit(Unit $unit): void { $this->unit = $unit; } - /** - * @return \Coduo\PHPHumanizer\DateTime\Unit - */ - public function getUnit() + public function getUnit(): Unit { return $this->unit; } diff --git a/src/Coduo/PHPHumanizer/DateTime/Formatter.php b/src/Coduo/PHPHumanizer/DateTime/Formatter.php index a5d7c2f..28fc8ce 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Formatter.php +++ b/src/Coduo/PHPHumanizer/DateTime/Formatter.php @@ -15,26 +15,14 @@ final class Formatter { - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @param TranslatorInterface $translator - */ + private TranslatorInterface $translator; + public function __construct(TranslatorInterface $translator) { $this->translator = $translator; } - /** - * @param Difference $difference - * @param string $locale - * - * @return string - */ - public function formatDifference(Difference $difference, $locale = 'en') + public function formatDifference(Difference $difference, string $locale = 'en'): string { $translationKey = \sprintf('%s.%s', $difference->getUnit()->getName(), $difference->isPast() ? 'past' : 'future'); diff --git a/src/Coduo/PHPHumanizer/DateTime/PreciseDifference.php b/src/Coduo/PHPHumanizer/DateTime/PreciseDifference.php index 75c1cfb..0a75a80 100644 --- a/src/Coduo/PHPHumanizer/DateTime/PreciseDifference.php +++ b/src/Coduo/PHPHumanizer/DateTime/PreciseDifference.php @@ -21,25 +21,19 @@ final class PreciseDifference { - /** - * @var \DateTime - */ - private $fromDate; + private \DateTime $fromDate; - /** - * @var \DateTime - */ - private $toDate; + private \DateTime $toDate; /** - * @var \Coduo\PHPHumanizer\DateTime\Unit[] + * @var array */ - private $units; + private array $units = []; /** - * @var \Coduo\PHPHumanizer\DateTime\Difference\CompoundResult[] + * @var array */ - private $compoundResults; + private array $compoundResults = []; public function __construct(\DateTime $fromDate, \DateTime $toDate) { @@ -49,16 +43,16 @@ public function __construct(\DateTime $fromDate, \DateTime $toDate) } /** - * @return \Coduo\PHPHumanizer\DateTime\Difference\CompoundResult[] + * @return array */ - public function getCompoundResults() + public function getCompoundResults(): array { return $this->compoundResults; } - private function calculate() + private function calculate(): void { - /* @var $units \Coduo\PHPHumanizer\DateTime\Unit[] */ + /* @var $units Unit[] */ $units = [ new Year(), new Month(), @@ -78,7 +72,7 @@ private function calculate() } } - public function isPast() + public function isPast(): bool { $diff = $this->toDate->getTimestamp() - $this->fromDate->getTimestamp(); diff --git a/src/Coduo/PHPHumanizer/DateTime/PreciseFormatter.php b/src/Coduo/PHPHumanizer/DateTime/PreciseFormatter.php index a47fe67..2036fb9 100644 --- a/src/Coduo/PHPHumanizer/DateTime/PreciseFormatter.php +++ b/src/Coduo/PHPHumanizer/DateTime/PreciseFormatter.php @@ -15,26 +15,14 @@ final class PreciseFormatter { - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * @param TranslatorInterface $translator - */ + private TranslatorInterface $translator; + public function __construct(TranslatorInterface $translator) { $this->translator = $translator; } - /** - * @param PreciseDifference $difference - * @param string $locale - * - * @return string - */ - public function formatDifference(PreciseDifference $difference, $locale = 'en') + public function formatDifference(PreciseDifference $difference, string $locale = 'en'): string { $diff = []; diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit.php b/src/Coduo/PHPHumanizer/DateTime/Unit.php index 2a3525f..c5445cb 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit.php @@ -13,22 +13,15 @@ interface Unit { - /** - * @return string - */ - public function getName(); + public function getName(): string; /** * Return millisecond that represents unit. - * - * @return int */ - public function getMilliseconds(); + public function getMilliseconds(): int; /** * Returns symbol of \DateInterval equivalent. - * - * @return string */ - public function getDateIntervalSymbol(); + public function getDateIntervalSymbol(): string; } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/Day.php b/src/Coduo/PHPHumanizer/DateTime/Unit/Day.php index 4e4f72d..f734a35 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/Day.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/Day.php @@ -15,22 +15,19 @@ final class Day implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'day'; } - public function getMilliseconds() + public function getMilliseconds(): int { $hour = new Hour(); return $hour->getMilliseconds() * 24; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { return 'd'; } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/Hour.php b/src/Coduo/PHPHumanizer/DateTime/Unit/Hour.php index 8a21186..1864d41 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/Hour.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/Hour.php @@ -15,22 +15,19 @@ final class Hour implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'hour'; } - public function getMilliseconds() + public function getMilliseconds(): int { $minute = new Minute(); return $minute->getMilliseconds() * 60; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { return 'h'; } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/JustNow.php b/src/Coduo/PHPHumanizer/DateTime/Unit/JustNow.php index ea1120a..3cb5aed 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/JustNow.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/JustNow.php @@ -15,20 +15,17 @@ final class JustNow implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'just_now'; } - public function getMilliseconds() + public function getMilliseconds(): int { return 0; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { throw new \RuntimeException("JustNow doesn't have date interval symbol equivalent"); } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/Minute.php b/src/Coduo/PHPHumanizer/DateTime/Unit/Minute.php index 1c2c3c2..6bbc479 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/Minute.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/Minute.php @@ -15,22 +15,19 @@ final class Minute implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'minute'; } - public function getMilliseconds() + public function getMilliseconds(): int { $second = new Second(); return $second->getMilliseconds() * 60; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { return 'i'; } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/Month.php b/src/Coduo/PHPHumanizer/DateTime/Unit/Month.php index ae26e8f..33a0e5c 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/Month.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/Month.php @@ -15,22 +15,19 @@ final class Month implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'month'; } - public function getMilliseconds() + public function getMilliseconds(): int { $day = new Day(); return $day->getMilliseconds() * 30; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { return 'm'; } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/Second.php b/src/Coduo/PHPHumanizer/DateTime/Unit/Second.php index 12f3e54..465a5ff 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/Second.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/Second.php @@ -15,20 +15,17 @@ final class Second implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'second'; } - public function getMilliseconds() + public function getMilliseconds(): int { return 1000; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { return 's'; } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/Week.php b/src/Coduo/PHPHumanizer/DateTime/Unit/Week.php index cd0ff1a..353d5a3 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/Week.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/Week.php @@ -15,22 +15,19 @@ final class Week implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'week'; } - public function getMilliseconds() + public function getMilliseconds(): int { $day = new Day(); return $day->getMilliseconds() * 7; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { throw new \RuntimeException("Week doesn't have date interval symbol equivalent"); } diff --git a/src/Coduo/PHPHumanizer/DateTime/Unit/Year.php b/src/Coduo/PHPHumanizer/DateTime/Unit/Year.php index 4dda1c9..22a539d 100644 --- a/src/Coduo/PHPHumanizer/DateTime/Unit/Year.php +++ b/src/Coduo/PHPHumanizer/DateTime/Unit/Year.php @@ -15,22 +15,19 @@ final class Year implements Unit { - /** - * @return string - */ - public function getName() + public function getName(): string { return 'year'; } - public function getMilliseconds() + public function getMilliseconds(): int { $day = new Day(); return $day->getMilliseconds() * 356; } - public function getDateIntervalSymbol() + public function getDateIntervalSymbol(): string { return 'y'; } diff --git a/src/Coduo/PHPHumanizer/DateTimeHumanizer.php b/src/Coduo/PHPHumanizer/DateTimeHumanizer.php index 44f7472..2c51cf5 100644 --- a/src/Coduo/PHPHumanizer/DateTimeHumanizer.php +++ b/src/Coduo/PHPHumanizer/DateTimeHumanizer.php @@ -19,26 +19,14 @@ final class DateTimeHumanizer { - /** - * @param \DateTime $fromDate - * @param \DateTime $toDate - * @param string $locale - * @return string - */ - public static function difference(\DateTime $fromDate, \DateTime $toDate, $locale = 'en') + public static function difference(\DateTime $fromDate, \DateTime $toDate, string $locale = 'en'): string { $formatter = new Formatter(Builder::build($locale)); return $formatter->formatDifference(new Difference($fromDate, $toDate), $locale); } - /** - * @param \DateTime $fromDate - * @param \DateTime $toDate - * @param string $locale - * @return string - */ - public static function preciseDifference(\DateTime $fromDate, \DateTime $toDate, $locale = 'en') + public static function preciseDifference(\DateTime $fromDate, \DateTime $toDate, string $locale = 'en'): string { $formatter = new PreciseFormatter(Builder::build($locale)); diff --git a/src/Coduo/PHPHumanizer/Number/Ordinal.php b/src/Coduo/PHPHumanizer/Number/Ordinal.php index 73e92a5..4d48872 100644 --- a/src/Coduo/PHPHumanizer/Number/Ordinal.php +++ b/src/Coduo/PHPHumanizer/Number/Ordinal.php @@ -21,27 +21,24 @@ final class Ordinal */ private $number; - /** - * @var StrategyInterface - */ - private $strategy; + private StrategyInterface $strategy; /** * @param int|float $number * @param string $locale */ - public function __construct($number, $locale) + public function __construct($number, string $locale) { $this->number = $number; $this->strategy = Builder::build($locale); } - public function isPrefix() + public function isPrefix(): bool { return $this->strategy->isPrefix(); } - public function __toString() + public function __toString(): string { return $this ->strategy diff --git a/src/Coduo/PHPHumanizer/Number/Ordinal/Builder.php b/src/Coduo/PHPHumanizer/Number/Ordinal/Builder.php index 582055b..2246cc9 100644 --- a/src/Coduo/PHPHumanizer/Number/Ordinal/Builder.php +++ b/src/Coduo/PHPHumanizer/Number/Ordinal/Builder.php @@ -11,38 +11,37 @@ namespace Coduo\PHPHumanizer\Number\Ordinal; -/** - * Tries to find a proper strategy for ordinal numbers. - */ final class Builder { /** - * @param string $locale - * - * @return StrategyInterface - * - * @throws \RuntimeException + * Find a proper strategy for ordinal numbers. */ - public static function build($locale) + public static function build(string $locale): StrategyInterface { // $locale should be xx or xx_YY - if (!\preg_match('/^([a-z]{2})(_([A-Z]{2}))?$/', $locale, $m)) { - throw new \RuntimeException("Invalid locale specified: '$locale'."); + if (!\preg_match('#^([a-z]{2})(_([A-Z]{2}))?$#', $locale, $m)) { + throw new \RuntimeException(\sprintf("Invalid locale specified: '%s'.", $locale)); } $strategy = \ucfirst($m[1]); if (!empty($m[3])) { - $strategy .= "_$m[3]"; + $strategy .= \sprintf('_%s', $m[3]); } - $strategy = "\\Coduo\\PHPHumanizer\\Resources\\Ordinal\\{$strategy}Strategy"; + $strategy = \sprintf('\Coduo\PHPHumanizer\Resources\Ordinal\%sStrategy', $strategy); if (\class_exists($strategy)) { - return new $strategy(); + $strategyInstance = new $strategy(); + + if (!$strategyInstance instanceof StrategyInterface) { + throw new \RuntimeException(\sprintf('Strategy for locale %s does not implement Strategy Interface.', $locale)); + } + + return $strategyInstance; } // Debatable: should we fallback to English? // return self::build('en'); - throw new \RuntimeException("Strategy for locale $locale not found."); + throw new \RuntimeException(\sprintf('Strategy for locale %s not found.', $locale)); } } diff --git a/src/Coduo/PHPHumanizer/Number/Ordinal/StrategyInterface.php b/src/Coduo/PHPHumanizer/Number/Ordinal/StrategyInterface.php index aa23162..eb60dcc 100644 --- a/src/Coduo/PHPHumanizer/Number/Ordinal/StrategyInterface.php +++ b/src/Coduo/PHPHumanizer/Number/Ordinal/StrategyInterface.php @@ -13,15 +13,11 @@ interface StrategyInterface { - /** - * @return boolean - */ - public function isPrefix(); + public function isPrefix(): bool; /** * @param int|float $number - * * @return string */ - public function ordinalIndicator($number); + public function ordinalIndicator($number): string; } diff --git a/src/Coduo/PHPHumanizer/Number/RomanNumeral.php b/src/Coduo/PHPHumanizer/Number/RomanNumeral.php index 4e184a9..6d1db95 100644 --- a/src/Coduo/PHPHumanizer/Number/RomanNumeral.php +++ b/src/Coduo/PHPHumanizer/Number/RomanNumeral.php @@ -13,11 +13,25 @@ final class RomanNumeral { + /** + * @var int + */ const MIN_VALUE = 1; + + /** + * @var int + */ const MAX_VALUE = 3999; + + /** + * @var string + */ const ROMAN_STRING_MATCHER = '/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/'; - private $map = [ + /** + * @var array + */ + private array $map = [ 'M' => 1000, 'CM' => 900, 'D' => 500, @@ -34,13 +48,13 @@ final class RomanNumeral ]; /** - * @param $number + * @param numeric $number * - * @return string * + * @return string * @throws \InvalidArgumentException */ - public function toRoman($number) + public function toRoman($number): string { if (($number < self::MIN_VALUE) || ($number > self::MAX_VALUE)) { throw new \InvalidArgumentException(); @@ -62,13 +76,11 @@ public function toRoman($number) } /** - * @param $string - * - * @return int + * @return float|int * * @throws \InvalidArgumentException */ - public function fromRoman($string) + public function fromRoman(string $string) { if (\mb_strlen((string) $string) === 0 || 0 === \preg_match(self::ROMAN_STRING_MATCHER, (string) $string)) { throw new \InvalidArgumentException(); diff --git a/src/Coduo/PHPHumanizer/NumberHumanizer.php b/src/Coduo/PHPHumanizer/NumberHumanizer.php index 7d26299..74271f6 100644 --- a/src/Coduo/PHPHumanizer/NumberHumanizer.php +++ b/src/Coduo/PHPHumanizer/NumberHumanizer.php @@ -20,36 +20,34 @@ final class NumberHumanizer { /** * @param int|float $number - * @param string $locale - * + * @param string $locale * @return string */ - public static function ordinalize($number, $locale = 'en') + public static function ordinalize($number, string $locale = 'en'): string { $ordinal = new Ordinal($number, $locale); - + return (string) ($ordinal->isPrefix()) ? $ordinal.$number : $number.$ordinal; } - + /** * @param int|float $number - * @param string $locale - * + * @param string $locale * @return string */ - public static function ordinal($number, $locale = 'en') + public static function ordinal($number, string $locale = 'en'): string { $ordinal = new Ordinal($number, $locale); - + return (string) $ordinal; } /** - * @param $number + * @param int $number * @param string $locale * @return bool|int|string */ - public static function binarySuffix($number, $locale = 'en') + public static function binarySuffix(int $number, string $locale = 'en') { $binarySuffix = new BinarySuffix($number, $locale); @@ -57,12 +55,9 @@ public static function binarySuffix($number, $locale = 'en') } /** - * @param $number - * @param $precision - * @param string $locale * @return bool|int|string */ - public static function preciseBinarySuffix($number, $precision, $locale = 'en') + public static function preciseBinarySuffix(int $number, ?int $precision, string $locale = 'en') { $binarySuffix = new BinarySuffix($number, $locale, $precision); @@ -70,11 +65,9 @@ public static function preciseBinarySuffix($number, $precision, $locale = 'en') } /** - * @param $number - * @param string $locale - * @return bool|string + * @param numeric $number */ - public static function metricSuffix($number, $locale = 'en') + public static function metricSuffix($number, string $locale = 'en'): string { $binarySuffix = new MetricSuffix($number, $locale); @@ -82,10 +75,10 @@ public static function metricSuffix($number, $locale = 'en') } /** - * @param $number + * @param numeric $number * @return string */ - public static function toRoman($number) + public static function toRoman($number): string { $romanNumeral = new RomanNumeral(); @@ -93,10 +86,9 @@ public static function toRoman($number) } /** - * @param $number - * @return int + * @return float|int */ - public static function fromRoman($number) + public static function fromRoman(string $number) { $romanNumeral = new RomanNumeral(); diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/DeStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/DeStrategy.php index 6a96127..bacc827 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/DeStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/DeStrategy.php @@ -15,16 +15,12 @@ final class DeStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return false; } - /** {@inheritdoc} */ - public function ordinalIndicator($number) + public function ordinalIndicator($number): string { return '.'; } diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/EnStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/EnStrategy.php index 35e6f5a..373932f 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/EnStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/EnStrategy.php @@ -15,18 +15,12 @@ final class EnStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return false; } - /** - * {@inheritdoc} - */ - public function ordinalIndicator($number) + public function ordinalIndicator($number): string { $absNumber = \abs((integer) $number); diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/EsStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/EsStrategy.php index 30ba76e..1793120 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/EsStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/EsStrategy.php @@ -15,16 +15,12 @@ final class EsStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return false; } - /** {@inheritdoc} */ - public function ordinalIndicator($number) + public function ordinalIndicator($number): string { return 'o'; } diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/FrStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/FrStrategy.php index 788789b..45a034c 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/FrStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/FrStrategy.php @@ -15,16 +15,12 @@ final class FrStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return false; } - /** {@inheritdoc} */ - public function ordinalIndicator($number) + public function ordinalIndicator($number): string { $absNumber = \abs((integer) $number); diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/IdStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/IdStrategy.php index e678f99..937eddc 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/IdStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/IdStrategy.php @@ -15,18 +15,13 @@ final class IdStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return true; } - /** - * {@inheritdoc} - */ - public function ordinalIndicator($number) + + public function ordinalIndicator($number): string { return 'ke-'; } diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/ItStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/ItStrategy.php index 318bbf8..ec69b84 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/ItStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/ItStrategy.php @@ -15,16 +15,12 @@ final class ItStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return false; } - /** {@inheritdoc} */ - public function ordinalIndicator($number) + public function ordinalIndicator($number): string { return 'o'; } diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/NlStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/NlStrategy.php index 7350eb5..63cc61a 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/NlStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/NlStrategy.php @@ -15,18 +15,12 @@ final class NlStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return false; } - /** - * {@inheritdoc} - */ - public function ordinalIndicator($number) + public function ordinalIndicator($number): string { return 'e'; } diff --git a/src/Coduo/PHPHumanizer/Resources/Ordinal/PtStrategy.php b/src/Coduo/PHPHumanizer/Resources/Ordinal/PtStrategy.php index 2f625a8..94f0e75 100644 --- a/src/Coduo/PHPHumanizer/Resources/Ordinal/PtStrategy.php +++ b/src/Coduo/PHPHumanizer/Resources/Ordinal/PtStrategy.php @@ -15,16 +15,12 @@ final class PtStrategy implements StrategyInterface { - /** - * {@inheritdoc} - */ - public function isPrefix() + public function isPrefix(): bool { return false; } - /** {@inheritdoc} */ - public function ordinalIndicator($number) + public function ordinalIndicator($number): string { return 'o'; } diff --git a/src/Coduo/PHPHumanizer/String/BinarySuffix.php b/src/Coduo/PHPHumanizer/String/BinarySuffix.php index b71e798..a5e0967 100644 --- a/src/Coduo/PHPHumanizer/String/BinarySuffix.php +++ b/src/Coduo/PHPHumanizer/String/BinarySuffix.php @@ -13,47 +13,33 @@ final class BinarySuffix { - const CONVERT_THRESHOLD = 1024; - /** * @var int */ - private $number; + const CONVERT_THRESHOLD = 1024; - /** - * @var string - */ - private $locale; + private int $number; + + private string $locale; /** - * @var array + * @var array */ - private $binaryPrefixes = [ - 1125899906842624 => '#.## PB', - 1099511627776 => '#.## TB', - 1073741824 => '#.## GB', - 1048576 => '#.## MB', + private array $binaryPrefixes = [ + 1_125_899_906_842_624 => '#.## PB', + 1_099_511_627_776 => '#.## TB', + 1_073_741_824 => '#.## GB', + 1_048_576 => '#.## MB', 1024 => '#.# kB', 0 => '# bytes', ]; - /** - * @param int $number - * @param string $locale - * @param int $precision - * - * @throws \InvalidArgumentException - */ - public function __construct($number, $locale = 'en', $precision = null) + public function __construct(int $number, string $locale = 'en', int $precision = null) { - if (!\class_exists('NumberFormatter')) { + if (!\class_exists(\NumberFormatter::class)) { throw new \RuntimeException('Binary suffix converter requires intl extension!'); } - if (!\is_numeric($number)) { - throw new \InvalidArgumentException('Binary suffix converter accept only numeric values.'); - } - if (!\is_null($precision)) { $this->setSpecificPrecisionFormat($precision); } @@ -68,6 +54,9 @@ public function __construct($number, $locale = 'en', $precision = null) \krsort($this->binaryPrefixes); } + /** + * @return int|string + */ public function convert() { $formatter = new \NumberFormatter($this->locale, \NumberFormatter::PATTERN_DECIMAL); @@ -90,12 +79,8 @@ public function convert() /** * Replaces the default ICU 56.1 decimal formats defined in $binaryPrefixes with ones that provide the same symbols * but the provided number of decimal places. - * - * @param int $precision - * - * @throws \InvalidArgumentException */ - protected function setSpecificPrecisionFormat($precision) + protected function setSpecificPrecisionFormat(int $precision): void { if ($precision < 0) { throw new \InvalidArgumentException('Precision must be positive'); @@ -112,7 +97,7 @@ protected function setSpecificPrecisionFormat($precision) foreach ($this->binaryPrefixes as $size => $unitPattern) { if ($size >= 1024) { - $symbol = \substr($unitPattern, \strpos($unitPattern, ' ')); + $symbol = \substr($unitPattern, (int) \strpos($unitPattern, ' ')); $this->binaryPrefixes[$size] = $icuFormat.$symbol; } } diff --git a/src/Coduo/PHPHumanizer/String/Breakpoint.php b/src/Coduo/PHPHumanizer/String/Breakpoint.php index e823511..c29c2a5 100644 --- a/src/Coduo/PHPHumanizer/String/Breakpoint.php +++ b/src/Coduo/PHPHumanizer/String/Breakpoint.php @@ -15,12 +15,6 @@ interface Breakpoint { /** * Return the length of the truncated $text depending on the $characterCount. - * - * @param string $text - * @param int $charactersCount - * @param int $charactersCount - * - * @return int */ - public function calculatePosition($text, $charactersCount); + public function calculatePosition(string $text, int $charactersCount): int; } diff --git a/src/Coduo/PHPHumanizer/String/HtmlTruncate.php b/src/Coduo/PHPHumanizer/String/HtmlTruncate.php index f85097a..0e4c8c7 100644 --- a/src/Coduo/PHPHumanizer/String/HtmlTruncate.php +++ b/src/Coduo/PHPHumanizer/String/HtmlTruncate.php @@ -13,37 +13,20 @@ final class HtmlTruncate implements TruncateInterface { - /** - * @var string - */ - private $append; + private string $append; - /** - * @var string - */ - private $allowedTags; + private string $allowedTags; - /** - * @var Breakpoint - */ - private $breakpoint; + private Breakpoint $breakpoint; - /** - * @param Breakpoint $breakpoint - * @param string $allowedTags - * @param string $append - */ - public function __construct(Breakpoint $breakpoint, $allowedTags = '', $append = '') + public function __construct(Breakpoint $breakpoint, string $allowedTags = '', string $append = '') { $this->breakpoint = $breakpoint; $this->append = $append; $this->allowedTags = $allowedTags; } - /** - * @return string - */ - public function truncate($text, $charactersCount) + public function truncate(string $text, int $charactersCount): string { $strippedText = \strip_tags($text, $this->allowedTags); @@ -55,20 +38,15 @@ public function truncate($text, $charactersCount) * HTML tags if $is_html is set to true. * * Adapted from FuelPHP Str::truncate (https://github.com/fuelphp/common/blob/master/src/Str.php) - * - * @param string $string - * @param int $charactersCount - * - * @return string the truncated string */ - private function truncateHtml($string, $charactersCount) + private function truncateHtml(string $string, int $charactersCount): string { $limit = $charactersCount; $offset = 0; $tags = []; // Handle special characters. - \preg_match_all('/&[a-z]+;/i', \strip_tags($string), $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); + \preg_match_all('#&[a-z]+;#i', \strip_tags($string), $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); foreach ($matches as $match) { if ($match[0][1] >= $limit) { break; @@ -77,13 +55,13 @@ private function truncateHtml($string, $charactersCount) } // Handle all the html tags. - \preg_match_all('/<[^>]+>([^<]*)/', $string, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); + \preg_match_all('#<[^>]+>([^<]*)#', $string, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); foreach ($matches as $match) { if ($match[0][1] - $offset >= $limit) { break; } - $tag = \mb_substr(\strtok($match[0][0], " \t\n\r\0\x0B>"), 1); + $tag = \mb_substr((string) \strtok($match[0][0], " \t\n\r\0\x0B>"), 1); if ($tag[0] != '/') { $tags[] = $tag; } elseif (\end($tags) == \mb_substr($tag, 1)) { diff --git a/src/Coduo/PHPHumanizer/String/Humanize.php b/src/Coduo/PHPHumanizer/String/Humanize.php index a4ef053..e7c79d8 100644 --- a/src/Coduo/PHPHumanizer/String/Humanize.php +++ b/src/Coduo/PHPHumanizer/String/Humanize.php @@ -13,28 +13,21 @@ final class Humanize { - /** - * @var string - */ - private $text; + private string $text; - /** - * @var bool - */ - private $capitalize; + private bool $capitalize; + + private string $separator; /** - * @var string + * @var array */ - private $separator; + private array $forbiddenWords; /** - * @param $text - * @param bool $capitalize - * @param string $separator - * @param array $forbiddenWords + * @param array $forbiddenWords */ - public function __construct($text, $capitalize = true, $separator = '_', array $forbiddenWords = ['id']) + public function __construct(string $text, bool $capitalize = true, string $separator = '_', array $forbiddenWords = ['id']) { $this->text = $text; $this->capitalize = $capitalize; @@ -42,12 +35,9 @@ public function __construct($text, $capitalize = true, $separator = '_', array $ $this->forbiddenWords = $forbiddenWords; } - /** - * @return string - */ - public function __toString() + public function __toString(): string { - $humanized = \trim(\strtolower(\preg_replace(['/([A-Z])/', "/[{$this->separator}\\s]+/"], ['_$1', ' '], $this->text))); + $humanized = \trim(\strtolower((string) \preg_replace(['/([A-Z])/', \sprintf('/[%s\s]+/', $this->separator)], ['_$1', ' '], $this->text))); $humanized = \trim(\str_replace($this->forbiddenWords, '', $humanized)); return $this->capitalize ? \ucfirst($humanized) : $humanized; diff --git a/src/Coduo/PHPHumanizer/String/MetricSuffix.php b/src/Coduo/PHPHumanizer/String/MetricSuffix.php index 3a76eb3..141987d 100644 --- a/src/Coduo/PHPHumanizer/String/MetricSuffix.php +++ b/src/Coduo/PHPHumanizer/String/MetricSuffix.php @@ -13,42 +13,42 @@ final class MetricSuffix { - const CONVERT_THRESHOLD = 1000; - /** * @var int */ - private $number; + const CONVERT_THRESHOLD = 1000; - /** - * @var string - */ - private $locale; + private int $number; + + private string $locale; /** - * @var array + * @var array */ - private $binaryPrefixes = [ - 1000000000000000 => '#.##P', - 1000000000000 => '#.##T', - 1000000000 => '#.##G', - 1000000 => '#.##M', + private array $binaryPrefixes = [ + 1_000_000_000_000_000 => '#.##P', + 1_000_000_000_000 => '#.##T', + 1_000_000_000 => '#.##G', + 1_000_000 => '#.##M', 1000 => '#.#k', 0 => '#.#', ]; /** - * @param $number + * @param numeric $number * @param string $locale * * @throws \InvalidArgumentException */ - public function __construct($number, $locale = 'en') + public function __construct($number, string $locale = 'en') { - if (!\class_exists('NumberFormatter')) { + if (!\class_exists(\NumberFormatter::class)) { throw new \RuntimeException('Metric suffix converter requires intl extension!'); } + /** + * @psalm-suppress DocblockTypeContradiction + */ if (!\is_numeric($number)) { throw new \InvalidArgumentException('Metric suffix converter accept only numeric values.'); } @@ -63,7 +63,7 @@ public function __construct($number, $locale = 'en') \krsort($this->binaryPrefixes); } - public function convert() + public function convert(): string { $formatter = new \NumberFormatter($this->locale, \NumberFormatter::PATTERN_DECIMAL); diff --git a/src/Coduo/PHPHumanizer/String/ShortcodeProcessor.php b/src/Coduo/PHPHumanizer/String/ShortcodeProcessor.php index 405a056..c1f85c0 100644 --- a/src/Coduo/PHPHumanizer/String/ShortcodeProcessor.php +++ b/src/Coduo/PHPHumanizer/String/ShortcodeProcessor.php @@ -20,41 +20,25 @@ final class ShortcodeProcessor { /** * Removes all shortcodes from given text. - * - * @param string $text - * - * @return string */ - public function removeShortcodes($text) + public function removeShortcodes(string $text): string { - $nullHandler = function () { - return; - }; - - return $this->createShortcodeProcessor($nullHandler)->process($text); + return $this->createShortcodeProcessor( + function (): void { + return; + } + )->process($text); } /** * Removes only shortcode tags from given text (leaves their content as it is). - * - * @param string $text - * - * @return string */ - public function removeShortcodeTags($text) + public function removeShortcodeTags(string $text): string { - $contentHandler = function (ShortcodeInterface $s) { - return $s->getContent(); - }; - - return $this->createShortcodeProcessor($contentHandler)->process($text); + return $this->createShortcodeProcessor(fn (ShortcodeInterface $s) : ?string => $s->getContent())->process($text); } - /** - * @param $defaultHandler - * @return Processor - */ - private function createShortcodeProcessor($defaultHandler) + private function createShortcodeProcessor(callable $defaultHandler): Processor { $handlers = new HandlerContainer(); $handlers->setDefault($defaultHandler); diff --git a/src/Coduo/PHPHumanizer/String/TextTruncate.php b/src/Coduo/PHPHumanizer/String/TextTruncate.php index e48c044..a487951 100644 --- a/src/Coduo/PHPHumanizer/String/TextTruncate.php +++ b/src/Coduo/PHPHumanizer/String/TextTruncate.php @@ -13,33 +13,17 @@ final class TextTruncate implements TruncateInterface { - /** - * @var string - */ - private $append; - - /** - * @var Breakpoint - */ - private $breakpoint; - - /** - * @param Breakpoint $breakpoint - * @param string $append - */ - public function __construct(Breakpoint $breakpoint, $append = '') + private string $append; + + private Breakpoint $breakpoint; + + public function __construct(Breakpoint $breakpoint, string $append = '') { $this->breakpoint = $breakpoint; $this->append = $append; } - /** - * @param string $text - * @param int $charactersCount - * - * @return string - */ - public function truncate($text, $charactersCount) + public function truncate(string $text, int $charactersCount): string { if ($charactersCount < 0 || \mb_strlen($text) <= $charactersCount) { return $text; diff --git a/src/Coduo/PHPHumanizer/String/TruncateInterface.php b/src/Coduo/PHPHumanizer/String/TruncateInterface.php index 1749047..5f671b5 100644 --- a/src/Coduo/PHPHumanizer/String/TruncateInterface.php +++ b/src/Coduo/PHPHumanizer/String/TruncateInterface.php @@ -13,11 +13,5 @@ interface TruncateInterface { - /** - * @param string $text - * @param int $charactersCount - * - * @return string mixed - */ - public function truncate($text, $charactersCount); + public function truncate(string $text, int $charactersCount): string; } diff --git a/src/Coduo/PHPHumanizer/String/WordBreakpoint.php b/src/Coduo/PHPHumanizer/String/WordBreakpoint.php index 1a73722..0dd6f7d 100644 --- a/src/Coduo/PHPHumanizer/String/WordBreakpoint.php +++ b/src/Coduo/PHPHumanizer/String/WordBreakpoint.php @@ -13,27 +13,22 @@ final class WordBreakpoint implements Breakpoint { - /** - * @param string $text - * @param int $charactersCount - * @return bool|int - */ - public function calculatePosition($text, $charactersCount) + public function calculatePosition(string $text, int $charactersCount): int { if ($charactersCount < 0) { - return \mb_strlen($text); + return (int) \mb_strlen($text); } if ($charactersCount > \mb_strlen($text)) { - return \mb_strlen($text); + return (int) \mb_strlen($text); } $breakpoint = \mb_strpos($text, ' ', $charactersCount); if (false === $breakpoint) { - return \mb_strlen($text); + return (int) \mb_strlen($text); } - return $breakpoint; + return (int) $breakpoint; } } diff --git a/src/Coduo/PHPHumanizer/StringHumanizer.php b/src/Coduo/PHPHumanizer/StringHumanizer.php index 8da6660..ceb9df9 100644 --- a/src/Coduo/PHPHumanizer/StringHumanizer.php +++ b/src/Coduo/PHPHumanizer/StringHumanizer.php @@ -20,54 +20,30 @@ final class StringHumanizer { /** - * @param $text - * @param bool|true $capitalize - * @param string $separator - * @param array $forbiddenWords - * - * @return string + * @param array $forbiddenWords */ - public static function humanize($text, $capitalize = true, $separator = '_', array $forbiddenWords = []) + public static function humanize(string $text, bool $capitalize = true, string $separator = '_', array $forbiddenWords = []): string { return (string) new Humanize($text, $capitalize, $separator, $forbiddenWords); } - /** - * @param $text - * @param $charactersCount - * @param string $append - * - * @return string - */ - public static function truncate($text, $charactersCount, $append = '') + public static function truncate(string $text, int $charactersCount, string $append = ''): string { $truncate = new TextTruncate(new WordBreakpoint(), $append); return $truncate->truncate($text, $charactersCount); } - /** - * @param $text - * @param $charactersCount - * @param string $allowedTags - * @param string $append - * - * @return string - */ - public static function truncateHtml($text, $charactersCount, $allowedTags = '', $append = '') + public static function truncateHtml(string $text, int $charactersCount, string $allowedTags = '', string $append = ''): string { $truncate = new HtmlTruncate(new WordBreakpoint(), $allowedTags, $append); return $truncate->truncate($text, $charactersCount); } - /** - * @param $text - * @return string - */ - public static function removeShortcodes($text) + public static function removeShortcodes(string $text): string { - if (!\class_exists('Thunder\Shortcode\Processor\Processor')) { + if (!\class_exists('\Thunder\Shortcode\Processor\Processor')) { throw new \RuntimeException('Please add "thunderer/shortcode": ^0.7 to composer.json first'); } @@ -76,13 +52,9 @@ public static function removeShortcodes($text) return $processor->removeShortcodes($text); } - /** - * @param $text - * @return string - */ - public static function removeShortcodeTags($text) + public static function removeShortcodeTags(string $text): string { - if (!\class_exists('Thunder\Shortcode\Processor\Processor')) { + if (!\class_exists('\Thunder\Shortcode\Processor\Processor')) { throw new \RuntimeException('Please add "thunderer/shortcode": ^0.7 to composer.json first'); } diff --git a/src/Coduo/PHPHumanizer/Translator/Builder.php b/src/Coduo/PHPHumanizer/Translator/Builder.php index b1500ff..1a3bd56 100644 --- a/src/Coduo/PHPHumanizer/Translator/Builder.php +++ b/src/Coduo/PHPHumanizer/Translator/Builder.php @@ -16,11 +16,7 @@ final class Builder { - /** - * @param $locale - * @return Translator - */ - public static function build($locale) + public static function build(string $locale): Translator { $translator = new Translator($locale); $translator->addLoader('yml', new YamlFileLoader()); diff --git a/tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php b/tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php index 91719ed..72d6011 100644 --- a/tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php +++ b/tests/Coduo/PHPHumanizer/Tests/DateTime/FormatterTest.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of the PHP Humanizer Library. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Coduo\PHPHumanizer\Tests\DateTime; use Coduo\PHPHumanizer\DateTime\Difference; @@ -14,8 +21,8 @@ final class FormatterTest extends TestCase public function test_format_datetime_diff() : void { $diff = new Difference( - new \DateTime("2015-01-01 00:10:00"), - new \DateTime("2015-01-01 00:00:00") + new \DateTime('2015-01-01 00:10:00'), + new \DateTime('2015-01-01 00:00:00') ); $formatter = new Formatter(Builder::build('en')); @@ -26,12 +33,12 @@ public function test_format_datetime_diff() : void public function test_format_datetime_diff_for_specific_locale() : void { $diff = new Difference( - new \DateTime("2015-01-01 00:10:00"), - new \DateTime("2015-01-01 00:00:00") + new \DateTime('2015-01-01 00:10:00'), + new \DateTime('2015-01-01 00:00:00') ); $formatter = new Formatter(Builder::build('en')); $this->assertSame('10 minut temu', $formatter->formatDifference($diff, 'pl')); } -} \ No newline at end of file +} diff --git a/tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php b/tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php index 8de07c9..a14cb81 100644 --- a/tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php +++ b/tests/Coduo/PHPHumanizer/Tests/DateTime/PreciseFormatterTest.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * This file is part of the PHP Humanizer Library. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Coduo\PHPHumanizer\Tests\DateTime; use Coduo\PHPHumanizer\DateTime\PreciseDifference; @@ -14,8 +21,8 @@ final class PreciseFormatterTest extends TestCase public function test_format_compound_datetime_diff() { $diff = new PreciseDifference( - new \DateTime("2015-01-01 00:00:00"), - new \DateTime("2015-01-11 05:00:00") + new \DateTime('2015-01-01 00:00:00'), + new \DateTime('2015-01-11 05:00:00') ); $formatter = new PreciseFormatter(Builder::build('en')); @@ -26,12 +33,12 @@ public function test_format_compound_datetime_diff() public function test_format_compound_datetime_diff_for_specific_locale() { $diff = new PreciseDifference( - new \DateTime("2015-01-01 00:00:00"), - new \DateTime("2015-01-11 05:00:00") + new \DateTime('2015-01-01 00:00:00'), + new \DateTime('2015-01-11 05:00:00') ); $formatter = new PreciseFormatter(Builder::build('en')); $this->assertSame('через 10 дней, 5 часов', $formatter->formatDifference($diff, 'ru')); } -} \ No newline at end of file +} diff --git a/tests/Coduo/PHPHumanizer/Tests/NumberHumanizerTest.php b/tests/Coduo/PHPHumanizer/Tests/NumberHumanizerTest.php index a0a9847..1199877 100644 --- a/tests/Coduo/PHPHumanizer/Tests/NumberHumanizerTest.php +++ b/tests/Coduo/PHPHumanizer/Tests/NumberHumanizerTest.php @@ -185,12 +185,6 @@ public function test_convert_number_to_string_with_binary_suffix($expected, $num $this->assertEquals($expected, NumberHumanizer::binarySuffix($number, $locale)); } - public function test_statically_throw_exception_when_converting_to_string_with_binary_suffix_non_numeric_values() - { - $this->expectException(\InvalidArgumentException::class); - NumberHumanizer::binarySuffix('as12'); - } - /** * @dataProvider preciseBinarySuffixDataProvider * @@ -569,7 +563,6 @@ public function romanExceptionProvider() public function arabicExceptionProvider() { return [ - [1234], [''], ['foobar'], ]; From 472d146fafb72cb3dc22ab76ccbca4ead9eadbfa Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Sun, 21 Feb 2021 22:54:14 +0100 Subject: [PATCH 3/5] Aeon php integration --- .github/workflows/changelog-release.yml | 31 +++++++++++++++ .github/workflows/changelog-update.yml | 38 +++++++++++++++++++ .../pull-request-description-check.yml | 20 ++++++++++ .../workflows/release-description-update.yml | 25 ++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 .github/workflows/changelog-release.yml create mode 100644 .github/workflows/changelog-update.yml create mode 100644 .github/workflows/pull-request-description-check.yml create mode 100644 .github/workflows/release-description-update.yml diff --git a/.github/workflows/changelog-release.yml b/.github/workflows/changelog-release.yml new file mode 100644 index 0000000..bb9608a --- /dev/null +++ b/.github/workflows/changelog-release.yml @@ -0,0 +1,31 @@ +name: "Changelog - Release Unreleased" + +################################################################### +# WARNING - THIS ACTION WILL PUSH COMMIT DIRECTLY INTO REPOSITORY # +################################################################### + +on: + push: + tags: + - '*' + +jobs: + changelog-release-unreleased: + name: "Update Changelog - Release Unreleased" + + runs-on: "ubuntu-latest" + + steps: + - name: "Get tag name" + id: "tag-name" + run: | + tag=$(echo ${{ github.event.ref }} | cut -c11-) + echo "::set-output name=tag::$tag" + + - name: "Update CHANGELOG" + uses: "docker://aeonphp/automation:latest" + env: + AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + with: + entrypoint: "/composer/vendor/bin/automation" + args: "changelog:release:unreleased ${{ github.repository }} CHANGELOG.md ${{ steps.tag-name.outputs.tag }} --github-file-changelog-update" diff --git a/.github/workflows/changelog-update.yml b/.github/workflows/changelog-update.yml new file mode 100644 index 0000000..e0ae30a --- /dev/null +++ b/.github/workflows/changelog-update.yml @@ -0,0 +1,38 @@ +name: "Changelog - Update Unreleased" + +################################################################### +# WARNING - THIS ACTION WILL PUSH COMMIT DIRECTLY INTO REPOSITORY # +################################################################### + +on: + push: + branches: + - 6.x + +jobs: + changelog-update-unreleased: + name: "Changelog - Update Unreleased" + + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Restore Automation cache" + uses: "actions/cache@v2" + with: + path: | + cache + key: "${{ runner.os }}-automation-${{ hashFiles('**/CHANGELOG.md') }}" + restore-keys: | + ${{ runner.os }}-automation- + + - name: "Update CHANGELOG" + uses: "docker://aeonphp/automation:latest" + env: + AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + EON_AUTOMATION_CACHE_DIR: "/github/workspace/cache" + with: + entrypoint: "/composer/vendor/bin/automation" + args: "changelog:generate ${{ github.repository }} --github-file-update-path=CHANGELOG.md --skip-from=\"dependabot[bot]\" --skip-from=\"aeon-automation\"" diff --git a/.github/workflows/pull-request-description-check.yml b/.github/workflows/pull-request-description-check.yml new file mode 100644 index 0000000..f624146 --- /dev/null +++ b/.github/workflows/pull-request-description-check.yml @@ -0,0 +1,20 @@ +name: "Pull Request Description Check" + +on: + pull_request: + types: ["opened", "edited", "reopened", "ready_for_review"] + +jobs: + pull-request-description-check: + name: "Pull Request Description" + + runs-on: "ubuntu-latest" + + steps: + - name: "Pull Request Description - Check" + uses: "docker://aeonphp/automation:latest" + env: + AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + with: + entrypoint: "/composer/vendor/bin/automation" + args: "pull-request:description:check ${{ github.repository }} ${{ github.event.pull_request.number }} --skip-from=\"dependabot[bot]\"" \ No newline at end of file diff --git a/.github/workflows/release-description-update.yml b/.github/workflows/release-description-update.yml new file mode 100644 index 0000000..c2db558 --- /dev/null +++ b/.github/workflows/release-description-update.yml @@ -0,0 +1,25 @@ +name: "Release - Description Update" + +######################################################### +# WARNING - THIS ACTION WILL UPDATE RELEASE DESCRIPTION # +######################################################### + +on: + release: + types: + - created + +jobs: + release-description-update: + name: "Release - Description Update" + + runs-on: "ubuntu-latest" + + steps: + - name: "Update CHANGELOG" + uses: "docker://aeonphp/automation:latest" + env: + AEON_AUTOMATION_GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + with: + entrypoint: "/composer/vendor/bin/automation" + args: "changelog:generate ${{ github.repository }} --tag=${{ github.event.release.tag_name }} --github-release-update --skip-from=\"dependabot[bot]\" --skip-from=\"aeon-automation\"" From 1c5c034bf5acaff1c5fb4aa52f72efcba986fc66 Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Sun, 21 Feb 2021 22:58:51 +0100 Subject: [PATCH 4/5] Removed travis configuration --- .github/workflows/static-analyze.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- .travis.yml | 19 ------------------- 3 files changed, 4 insertions(+), 23 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/static-analyze.yml b/.github/workflows/static-analyze.yml index c54217e..c68cd73 100644 --- a/.github/workflows/static-analyze.yml +++ b/.github/workflows/static-analyze.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - "6.x" + - "4.x" schedule: - cron: '* 8 * * *' @@ -59,7 +59,7 @@ jobs: php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer- - name: "Install tools" - run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,8A03EA3B385DBAA1,C5095986493B4AA0 --force-accept-unsigned" + run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,12CE0F1D262429A5 --force-accept-unsigned" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7bb3c28..4379881 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,7 +4,7 @@ on: pull_request: push: branches: - - "6.x" + - "4.x" schedule: - cron: '* 8 * * *' @@ -62,7 +62,7 @@ jobs: php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer- - name: "Install tools" - run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,8A03EA3B385DBAA1,C5095986493B4AA0 --force-accept-unsigned" + run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,12CE0F1D262429A5 --force-accept-unsigned" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index aa0c007..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 7.3 - - php: 7.4 - -before_install: - - composer self-update - -install: - - composer update - -script: - - composer run test \ No newline at end of file From d72f75fd7a37a57f3e0476e735b1e507d7367431 Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Sun, 21 Feb 2021 23:01:03 +0100 Subject: [PATCH 5/5] Fixed missing phive keys --- .github/workflows/static-analyze.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static-analyze.yml b/.github/workflows/static-analyze.yml index c68cd73..45b6c03 100644 --- a/.github/workflows/static-analyze.yml +++ b/.github/workflows/static-analyze.yml @@ -59,7 +59,7 @@ jobs: php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer- - name: "Install tools" - run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,12CE0F1D262429A5 --force-accept-unsigned" + run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,8A03EA3B385DBAA1,12CE0F1D262429A5 --force-accept-unsigned" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4379881..5a2eb63 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,7 +62,7 @@ jobs: php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer- - name: "Install tools" - run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,12CE0F1D262429A5 --force-accept-unsigned" + run: "phive install --trust-gpg-keys E82B2FB314E9906E,CF1A108D0E7AE720,8A03EA3B385DBAA1,12CE0F1D262429A5 --force-accept-unsigned" - name: "Install lowest dependencies" if: ${{ matrix.dependencies == 'lowest' }}