From 86b5a99c2b0f52ffcfda052873102744e7ccd8fa Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Mon, 2 Feb 2026 21:08:52 +0100 Subject: [PATCH 1/3] Require PHP 7.2+ --- .github/workflows/code-style.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- .github/workflows/test.yml | 14 +++++------ CHANGELOG.md | 24 +++++++++++++++++++ Dockerfile | 2 +- Makefile | 8 +++---- composer.json | 4 ++-- docker-compose.yaml | 8 +++---- ...nit07-helpers.xml => phpunit08-helpers.xml | 2 +- phpunit07.xml => phpunit08.xml | 2 +- 10 files changed, 46 insertions(+), 22 deletions(-) rename phpunit07-helpers.xml => phpunit08-helpers.xml (88%) rename phpunit07.xml => phpunit08.xml (90%) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 735e565..36891b9 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -14,7 +14,7 @@ jobs: uses: shivammathur/setup-php@v2 with: coverage: none - php-version: "7.1" + php-version: "7.2" ini-values: memory_limit=-1 tools: phpcs, cs2pr - name: Run PHP Code Sniffer diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 8ec4b0e..4e435fd 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -13,7 +13,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: "7.1" + php-version: "7.2" ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4b61d5..9cc574c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: php-version: - - "7.1" + - "7.2" - "7.4" - "8.4" steps: @@ -39,10 +39,10 @@ jobs: - name: Run PHPUnit run: make test-coveralls env: - PHPUNIT_VERSION: "${{ matrix.php-version == '8.4' && '11' || '07' }}" + PHPUNIT_VERSION: "${{ matrix.php-version == '8.4' && '11' || '08' }}" - name: Upload code coverage - if: ${{ matrix.php-version == '7.1' }} + if: ${{ matrix.php-version == '7.2' }} env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -58,7 +58,7 @@ jobs: uses: shivammathur/setup-php@v2 with: coverage: xdebug - php-version: "7.1" + php-version: "7.2" ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies @@ -67,8 +67,8 @@ jobs: path: | ~/.composer/cache vendor - key: "php-7.1" - restore-keys: "php-7.1" + key: "php-7.2" + restore-keys: "php-7.2" - name: Install dependencies run: composer install --no-interaction --no-progress @@ -76,4 +76,4 @@ jobs: - name: Run PHPUnit run: make test env: - PHPUNIT_VERSION: "07-helpers" + PHPUNIT_VERSION: "08-helpers" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3649d4b..5d13be7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # CHANGELOG +## v4.0.0 + +### New requirements + +Require PHP 7.2+ + +### New features + +None + +### Backward Incompatible Changes + +None + +### Deprecated Features + +None + +### Other Changes + +Updated PHPUnit to v.8.5.52 to avoid [vulnerability](https://github.com/ICanBoogie/Inflector/security/dependabot/1). + + + ## v3.0.2 ### New requirements diff --git a/Dockerfile b/Dockerfile index 55a178e..9223d1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG PHP_TAG=7.1-cli-buster +ARG PHP_TAG=7.2-cli-buster FROM php:${PHP_TAG} RUN <<-EOF diff --git a/Makefile b/Makefile index 309f5b7..bc0a68a 100644 --- a/Makefile +++ b/Makefile @@ -25,11 +25,11 @@ test-coveralls: test-dependencies @XDEBUG_MODE=coverage $(PHPUNIT) --coverage-clover build/logs/clover.xml .PHONY: test-container -test-container: test-container-71 +test-container: test-container-72 -.PHONY: test-container-71 -test-container-71: - @-docker-compose run --rm app71 bash +.PHONY: test-container-72 +test-container-72: + @-docker-compose run --rm app72 bash @docker-compose down -v .PHONY: test-container-84 diff --git a/composer.json b/composer.json index db2f068..6475a67 100644 --- a/composer.json +++ b/composer.json @@ -29,13 +29,13 @@ "sort-packages": true }, "require": { - "php": ">=7.1", + "php": ">=7.2", "ext-mbstring": "*" }, "require-dev": { "icanboogie/common": "^2.1", "phpstan/phpstan": "^1.4|^2.0", - "phpunit/phpunit": "^7.5.20|^11.4" + "phpunit/phpunit": "^8.5.22|^11.4" }, "conflict": { "icanboogie/common": "<2.0" diff --git a/docker-compose.yaml b/docker-compose.yaml index 0f3c6ed..4dfd636 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,13 +1,13 @@ --- services: - app71: + app72: build: context: . args: - PHP_TAG: "7.1-cli-buster" + PHP_TAG: "7.2-cli-buster" environment: PHP_IDE_CONFIG: 'serverName=icanboogie-inflector' - PHPUNIT_VERSION: "07" + PHPUNIT_VERSION: "08" volumes: &vol - .:/app:delegated - ~/.composer:/root/.composer:delegated @@ -16,7 +16,7 @@ services: build: context: . args: - PHP_TAG: "8.4.0RC4-cli-bookworm" + PHP_TAG: "8.4-cli-bookworm" environment: PHP_IDE_CONFIG: 'serverName=icanboogie-inflector' PHPUNIT_VERSION: "11" diff --git a/phpunit07-helpers.xml b/phpunit08-helpers.xml similarity index 88% rename from phpunit07-helpers.xml rename to phpunit08-helpers.xml index 389ac39..83997da 100644 --- a/phpunit07-helpers.xml +++ b/phpunit08-helpers.xml @@ -1,6 +1,6 @@ Date: Wed, 4 Feb 2026 01:54:08 +0100 Subject: [PATCH 2/3] Require PHP 7.4+ --- .github/workflows/code-style.yml | 2 +- .github/workflows/static-analysis.yml | 2 +- .github/workflows/test.yml | 13 +++-- CHANGELOG.md | 4 +- Dockerfile | 23 ++------- Makefile | 8 ++-- composer.json | 6 +-- docker-compose.yaml | 6 +-- lib/Inflections.php | 37 ++++++++------ lib/InflectionsNotFound.php | 9 ---- lib/Inflector.php | 18 ++----- phpcs.xml | 4 ++ phpunit08-helpers.xml | 21 -------- phpunit08.xml | 25 ---------- phpunit09-helpers.xml | 21 ++++++++ phpunit09.xml | 21 ++++++++ tests/InflectionsTest.php | 13 ++--- tests/InflectorTest.php | 69 ++++++++++++++++----------- 18 files changed, 140 insertions(+), 162 deletions(-) delete mode 100644 phpunit08-helpers.xml delete mode 100644 phpunit08.xml create mode 100644 phpunit09-helpers.xml create mode 100644 phpunit09.xml diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 36891b9..ce3b7e8 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -14,7 +14,7 @@ jobs: uses: shivammathur/setup-php@v2 with: coverage: none - php-version: "7.2" + php-version: "8.4" ini-values: memory_limit=-1 tools: phpcs, cs2pr - name: Run PHP Code Sniffer diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 4e435fd..06260ee 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -13,7 +13,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: "7.2" + php-version: "8.4" ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9cc574c..d1f14ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,6 @@ jobs: strategy: matrix: php-version: - - "7.2" - "7.4" - "8.4" steps: @@ -39,10 +38,10 @@ jobs: - name: Run PHPUnit run: make test-coveralls env: - PHPUNIT_VERSION: "${{ matrix.php-version == '8.4' && '11' || '08' }}" + PHPUNIT_VERSION: "${{ matrix.php-version == '8.4' && '11' || '09' }}" - name: Upload code coverage - if: ${{ matrix.php-version == '7.2' }} + if: ${{ matrix.php-version == '7.4' }} env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -58,7 +57,7 @@ jobs: uses: shivammathur/setup-php@v2 with: coverage: xdebug - php-version: "7.2" + php-version: "7.4" ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies @@ -67,8 +66,8 @@ jobs: path: | ~/.composer/cache vendor - key: "php-7.2" - restore-keys: "php-7.2" + key: "php-7.4" + restore-keys: "php-7.4" - name: Install dependencies run: composer install --no-interaction --no-progress @@ -76,4 +75,4 @@ jobs: - name: Run PHPUnit run: make test env: - PHPUNIT_VERSION: "08-helpers" + PHPUNIT_VERSION: "09-helpers" diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d13be7..6e8fbdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### New requirements -Require PHP 7.2+ +Require PHP 7.4+ (older Debian distributions are now archived) ### New features @@ -20,7 +20,7 @@ None ### Other Changes -Updated PHPUnit to v.8.5.52 to avoid [vulnerability](https://github.com/ICanBoogie/Inflector/security/dependabot/1). +Updated PHPUnit to v9.6 to avoid [vulnerability](https://github.com/ICanBoogie/Inflector/security/dependabot/1). diff --git a/Dockerfile b/Dockerfile index 9223d1c..e4cd7c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,10 @@ -ARG PHP_TAG=7.2-cli-buster +ARG PHP_TAG=7.4-cli-bullseye FROM php:${PHP_TAG} RUN <<-EOF + apt-get update + apt-get install unzip docker-php-ext-enable opcache - - if [ "$PHP_VERSION" \< "7.4" ]; then - apt-get update - apt-get install -y autoconf pkg-config - pecl channel-update pecl.php.net - pecl install xdebug-2.9.0 - docker-php-ext-enable xdebug - fi EOF RUN <<-EOF @@ -23,14 +17,7 @@ EOF ENV COMPOSER_ALLOW_SUPERUSER 1 -RUN <<-EOF - apt-get update - apt-get install unzip - curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet - mv composer.phar /usr/local/bin/composer - cat <<-SHELL >> /root/.bashrc - export PATH="$HOME/.composer/vendor/bin:$PATH" - SHELL -EOF +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer +ENV PATH="/root/.composer/vendor/bin:${PATH}" RUN composer global require squizlabs/php_codesniffer diff --git a/Makefile b/Makefile index bc0a68a..e540da7 100644 --- a/Makefile +++ b/Makefile @@ -25,11 +25,11 @@ test-coveralls: test-dependencies @XDEBUG_MODE=coverage $(PHPUNIT) --coverage-clover build/logs/clover.xml .PHONY: test-container -test-container: test-container-72 +test-container: test-container-74 -.PHONY: test-container-72 -test-container-72: - @-docker-compose run --rm app72 bash +.PHONY: test-container-74 +test-container-74: + @-docker-compose run --rm app74 bash @docker-compose down -v .PHONY: test-container-84 diff --git a/composer.json b/composer.json index 6475a67..94e91ca 100644 --- a/composer.json +++ b/composer.json @@ -29,13 +29,13 @@ "sort-packages": true }, "require": { - "php": ">=7.2", + "php": ">=7.4", "ext-mbstring": "*" }, "require-dev": { "icanboogie/common": "^2.1", - "phpstan/phpstan": "^1.4|^2.0", - "phpunit/phpunit": "^8.5.22|^11.4" + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^9.6.34|^11.4" }, "conflict": { "icanboogie/common": "<2.0" diff --git a/docker-compose.yaml b/docker-compose.yaml index 4dfd636..a44d30b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,13 +1,13 @@ --- services: - app72: + app74: build: context: . args: - PHP_TAG: "7.2-cli-buster" + PHP_TAG: "7.4-cli-bullseye" environment: PHP_IDE_CONFIG: 'serverName=icanboogie-inflector' - PHPUNIT_VERSION: "08" + PHPUNIT_VERSION: "09" volumes: &vol - .:/app:delegated - ~/.composer:/root/.composer:delegated diff --git a/lib/Inflections.php b/lib/Inflections.php index 28e75ed..9be2546 100644 --- a/lib/Inflections.php +++ b/lib/Inflections.php @@ -9,11 +9,11 @@ /** * A representation of the inflections used by an inflector. * - * @property-read array $plurals Rules for {@see pluralize()}. - * @property-read array $singulars Rules for {@see singularize()}. - * @property-read array $uncountables Uncountables. - * @property-read array $humans Rules for {@see humanize()}. - * @property-read array $acronyms Acronyms. + * @property-read array $plurals Rules for {@see pluralize()}. + * @property-read array $singulars Rules for {@see singularize()}. + * @property-read array $uncountables Uncountables. + * @property-read array $humans Rules for {@see humanize()}. + * @property-read array $acronyms Acronyms. * @property-read string $acronym_regex Acronyms regex. */ final class Inflections @@ -21,7 +21,7 @@ final class Inflections /** * @var array */ - private static $inflections = []; + private static array $inflections = []; /** * Returns inflections for the specified locale. @@ -52,42 +52,51 @@ public static function get(string $locale = Inflector::DEFAULT_LOCALE): Inflecti * * @var array Where _key_ is a rule and _value_ a replacement. */ - protected $plurals = []; + private array $plurals = []; /** * Rules for {@see singularize()}. * * @var array Where _key_ is a rule and _value_ a replacement. */ - protected $singulars = []; + private array $singulars = []; /** * Uncountables. * * @var array Where _key_ is a word and _value_ the same word. */ - protected $uncountables = []; + private array $uncountables = []; /** * Rules for {@see humanize()}. * * @var array Where _key_ is a rule and _value_ a replacement. */ - protected $humans = []; + private array $humans = []; /** * Acronyms. * * @var array Where _key_ is a lower case version of _value_. */ - protected $acronyms = []; + private array $acronyms = []; /** * Acronyms regex. * * @var string */ - protected $acronym_regex = '/(?=a)b/'; + private string $acronym_regex = '/(?=a)b/'; + + private const READERS = [ + 'acronyms' => true, + 'acronym_regex' => true, + 'plurals' => true, + 'singulars' => true, + 'uncountables' => true, + 'humans' => true, + ]; /** * Returns the {@see $acronyms}, {@see $acronym_regex}, {@see $plurals}, {@see $singulars}, @@ -102,9 +111,7 @@ public static function get(string $locale = Inflector::DEFAULT_LOCALE): Inflecti */ public function __get(string $property) { - static $readers = [ 'acronyms', 'acronym_regex', 'plurals', 'singulars', 'uncountables', 'humans' ]; - - if (in_array($property, $readers)) { + if (isset(self::READERS[$property])) { return $this->$property; } diff --git a/lib/InflectionsNotFound.php b/lib/InflectionsNotFound.php index 50ceaad..a92bf4b 100644 --- a/lib/InflectionsNotFound.php +++ b/lib/InflectionsNotFound.php @@ -1,14 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace ICanBoogie; use LogicException; diff --git a/lib/Inflector.php b/lib/Inflector.php index 22d5d21..2146cf6 100644 --- a/lib/Inflector.php +++ b/lib/Inflector.php @@ -1,14 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace ICanBoogie; use InvalidArgumentException; @@ -44,7 +35,7 @@ class Inflector /** * @var array */ - private static $inflectors = []; + private static array $inflectors = []; /** * Returns an inflector for the specified locale. @@ -54,16 +45,13 @@ class Inflector */ public static function get(string $locale = self::DEFAULT_LOCALE): self { - return self::$inflectors[$locale] - ?? self::$inflectors[$locale] = new self(Inflections::get($locale)); + return self::$inflectors[$locale] ??= new self(Inflections::get($locale)); } /** * Inflections used by the inflector. - * - * @var Inflections */ - private $inflections; + private Inflections $inflections; public function __construct(?Inflections $inflections = null) { diff --git a/phpcs.xml b/phpcs.xml index d3d67e1..16eae2b 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -31,4 +31,8 @@ */tests/HelpersTest.php + + + lib/Inflections/* + diff --git a/phpunit08-helpers.xml b/phpunit08-helpers.xml deleted file mode 100644 index 83997da..0000000 --- a/phpunit08-helpers.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - tests/HelpersTest.php - - - - - - lib - - - diff --git a/phpunit08.xml b/phpunit08.xml deleted file mode 100644 index 3374d16..0000000 --- a/phpunit08.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - tests - tests/HelpersTest.php - - - - - - lib - - lib/helpers.php - - - - diff --git a/phpunit09-helpers.xml b/phpunit09-helpers.xml new file mode 100644 index 0000000..c2b1fbd --- /dev/null +++ b/phpunit09-helpers.xml @@ -0,0 +1,21 @@ + + + + + tests/HelpersTest.php + + + + + + lib + + + diff --git a/phpunit09.xml b/phpunit09.xml new file mode 100644 index 0000000..2a7960e --- /dev/null +++ b/phpunit09.xml @@ -0,0 +1,21 @@ + + + + + tests + + + + + + lib + + + diff --git a/tests/InflectionsTest.php b/tests/InflectionsTest.php index 67a5ff2..7b49573 100644 --- a/tests/InflectionsTest.php +++ b/tests/InflectionsTest.php @@ -1,14 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Tests\ICanBoogie; use ICanBoogie\Inflections; @@ -56,7 +47,9 @@ public static function provide_singular_and_plural(): array $rc = []; foreach ($locales as $locale) { - foreach (require __DIR__ . "/Inflections/$locale.php" as $singular => $plural) { + /** @var array $cases */ + $cases = require __DIR__ . "/Inflections/$locale.php"; + foreach ($cases as $singular => $plural) { $rc[] = [ $locale, $singular, $plural ]; } } diff --git a/tests/InflectorTest.php b/tests/InflectorTest.php index a82d797..9746803 100644 --- a/tests/InflectorTest.php +++ b/tests/InflectorTest.php @@ -1,14 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Tests\ICanBoogie; use ICanBoogie\Inflections; @@ -68,15 +59,15 @@ public function test_uncountable_word_is_not_greedy(): void public function test_camelize(): void { + /** @var array $ar */ $ar = require __DIR__ . '/cases/camel_to_underscore.php'; - foreach ($ar as $camel => $underscore) { $this->assertEquals($camel, self::$inflector->camelize($underscore)); $this->assertEquals($camel, StaticInflector::camelize($underscore)); } + /** @var array $ar */ $ar = require __DIR__ . '/cases/camel_to_dash.php'; - foreach ($ar as $camel => $dash) { $this->assertEquals($camel, self::$inflector->camelize($dash)); $this->assertEquals($camel, StaticInflector::camelize($dash)); @@ -184,16 +175,18 @@ public function test_acronyms_camelize_lower(): void public function test_underscore_to_lower_camel(): void { - foreach (require __DIR__ . '/cases/underscore_to_lower_camel.php' as $underscored => $lower_camel) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/underscore_to_lower_camel.php'; + foreach ($cases as $underscored => $lower_camel) { $this->assertEquals($lower_camel, self::$inflector->camelize($underscored, true)); } } public function test_camelize_with_namespace(): void { - $cases = '/cases/camel_with_namespace_to_underscore_with_slash.php'; - - foreach (require __DIR__ . $cases as $camel => $underscore) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/camel_with_namespace_to_underscore_with_slash.php'; + foreach ($cases as $camel => $underscore) { $this->assertEquals($camel, self::$inflector->camelize($underscore)); } } @@ -211,24 +204,30 @@ public function test_underscore_acronym_sequence(): void public function test_underscore(): void { - foreach (require __DIR__ . '/cases/camel_to_underscore.php' as $camel => $underscore) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/camel_to_underscore.php'; + foreach ($cases as $camel => $underscore) { $this->assertEquals($underscore, self::$inflector->underscore($camel)); } - foreach (require __DIR__ . '/cases/camel_to_underscore_without_reverse.php' as $camel => $underscore) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/camel_to_underscore_without_reverse.php'; + foreach ($cases as $camel => $underscore) { $this->assertEquals($underscore, self::$inflector->underscore($camel)); } - foreach (require __DIR__ . '/cases/misc_to_underscore.php' as $misc => $underscore) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/misc_to_underscore.php'; + foreach ($cases as $misc => $underscore) { $this->assertEquals($underscore, self::$inflector->underscore($misc)); } } public function test_underscore_with_slashes(): void { - $cases = '/cases/camel_with_namespace_to_underscore_with_slash.php'; - - foreach (require __DIR__ . $cases as $camel => $underscore) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/camel_with_namespace_to_underscore_with_slash.php'; + foreach ($cases as $camel => $underscore) { $this->assertEquals($underscore, self::$inflector->underscore($camel)); } } @@ -245,18 +244,24 @@ public function test_hyphenate(): void $this->assertEquals($hyphenated, $inflector->hyphenate($str)); } - foreach (require __DIR__ . '/cases/underscores_to_dashes.php' as $underscore => $dash) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/underscores_to_dashes.php'; + foreach ($cases as $underscore => $dash) { $this->assertEquals($dash, self::$inflector->hyphenate($underscore)); } - foreach (require __DIR__ . '/cases/misc_to_hyphens.php' as $misc => $dash) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/misc_to_hyphens.php'; + foreach ($cases as $misc => $dash) { $this->assertEquals($dash, self::$inflector->hyphenate($misc)); } } public function test_humanize(): void { - foreach (require __DIR__ . '/cases/underscore_to_human.php' as $underscore => $human) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/underscore_to_human.php'; + foreach ($cases as $underscore => $human) { $this->assertEquals($human, self::$inflector->humanize($underscore)); } } @@ -284,28 +289,36 @@ public function test_humanize_by_string(): void public function test_ordinal(): void { - foreach (require __DIR__ . '/cases/ordinal_numbers.php' as $number => $ordinalized) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/ordinal_numbers.php'; + foreach ($cases as $number => $ordinalized) { $this->assertEquals($ordinalized, $number . self::$inflector->ordinal($number)); } } public function test_ordinalize(): void { - foreach (require __DIR__ . '/cases/ordinal_numbers.php' as $number => $ordinalized) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/ordinal_numbers.php'; + foreach ($cases as $number => $ordinalized) { $this->assertEquals($ordinalized, self::$inflector->ordinalize($number)); } } public function test_dasherize(): void { - foreach (require __DIR__ . '/cases/underscores_to_dashes.php' as $underscored => $dasherized) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/underscores_to_dashes.php'; + foreach ($cases as $underscored => $dasherized) { $this->assertEquals($dasherized, self::$inflector->dasherize($underscored)); } } public function test_underscore_as_reverse_of_dasherize(): void { - foreach (require __DIR__ . '/cases/underscores_to_dashes.php' as $underscored => $dasherized) { + /** @var array $cases */ + $cases = require __DIR__ . '/cases/underscores_to_dashes.php'; + foreach ($cases as $underscored => $dasherized) { $this->assertEquals($underscored, self::$inflector->underscore(self::$inflector->dasherize($underscored))); } } From 218ff133e624c304254e52af41a3ceaa6faf08b7 Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Wed, 4 Feb 2026 01:59:36 +0100 Subject: [PATCH 3/3] Remove helper functions --- .github/workflows/test.yml | 29 ----------------------------- CHANGELOG.md | 2 +- README.md | 13 +------------ phpunit09-helpers.xml | 21 --------------------- 4 files changed, 2 insertions(+), 63 deletions(-) delete mode 100644 phpunit09-helpers.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1f14ef..fd7608e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,32 +47,3 @@ jobs: run: | composer global require php-coveralls/php-coveralls php-coveralls --coverage_clover=build/logs/clover.xml -v - - test-helpers: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install PHP - uses: shivammathur/setup-php@v2 - with: - coverage: xdebug - php-version: "7.4" - ini-values: memory_limit=-1 - tools: composer:v2 - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: | - ~/.composer/cache - vendor - key: "php-7.4" - restore-keys: "php-7.4" - - - name: Install dependencies - run: composer install --no-interaction --no-progress - - - name: Run PHPUnit - run: make test - env: - PHPUNIT_VERSION: "09-helpers" diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e8fbdb..ddb0a9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ None ### Backward Incompatible Changes -None +Removed helper functions, use `StaticInflector` instead. ### Deprecated Features diff --git a/README.md b/README.md index c555523..523bf18 100644 --- a/README.md +++ b/README.md @@ -125,26 +125,15 @@ Static interfaces are also available: ```php [!WARNING] -> Since v3.0 the file with the helper functions is no longer included in the -> autoload. -> You need to include the file `vendor/icanboogie/inflector/lib/helpers.php` -> in your `composer.json` if you want to continue using these functions. ## About inflections diff --git a/phpunit09-helpers.xml b/phpunit09-helpers.xml deleted file mode 100644 index c2b1fbd..0000000 --- a/phpunit09-helpers.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - tests/HelpersTest.php - - - - - - lib - - -