From bef6150827be29b80159ec34533018a0bcbb68ef Mon Sep 17 00:00:00 2001 From: Benoit POLASZEK Date: Fri, 18 Jul 2025 10:34:01 +0200 Subject: [PATCH 1/2] Chore: Update function usage and package version --- composer.json | 2 +- src/StringCombinations.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index da1a2e8..2a8a859 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ }, "require": { "php": ">=7.4", - "bentools/cartesian-product": "^1.1" + "bentools/cartesian-product": "^1.5|^2.0" }, "require-dev": { "phpunit/phpunit": "^8.0|^9.0", diff --git a/src/StringCombinations.php b/src/StringCombinations.php index 70d7d6b..b9c9728 100644 --- a/src/StringCombinations.php +++ b/src/StringCombinations.php @@ -2,7 +2,7 @@ namespace BenTools\StringCombinations; -use function BenTools\CartesianProduct\cartesian_product; +use function BenTools\CartesianProduct\combinations; use Countable; use IteratorAggregate; use Traversable; @@ -54,7 +54,7 @@ public function count(): int { if (null === $this->count) { $this->count = array_sum(array_map(function ($set) { - return count(cartesian_product($set)); + return count(combinations($set)); }, iterator_to_array($this->generateSets()))); } return $this->count; @@ -63,7 +63,7 @@ public function count(): int public function getIterator(): Traversable { foreach ($this->generateSets() as $set) { - foreach (cartesian_product($set) as $combination) { + foreach (combinations($set) as $combination) { yield implode($this->glue, $combination); } } From 46ad739f6b2c20f6667b3cc1806f347437deaecb Mon Sep 17 00:00:00 2001 From: Benoit POLASZEK Date: Fri, 18 Jul 2025 10:37:51 +0200 Subject: [PATCH 2/2] Chore: Upgrade CI workflow to use latest Ubuntu and PHP versions --- .github/workflows/ci-workflow.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 7b306db..fb96931 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -9,10 +9,10 @@ on: jobs: code-style: name: Code Style & Static Analysis - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -32,7 +32,7 @@ jobs: tests: name: Test Suite - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: max-parallel: 10 matrix: @@ -40,10 +40,14 @@ jobs: - 7.4 - 8.0 - 8.1 + - 8.2 + - 8.3 + - 8.4 + - 8.5 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2