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 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); } }