Skip to content

Commit 0224072

Browse files
authored
Chore: Update function usage and package version (#7)
1 parent f32178e commit 0224072

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ on:
99
jobs:
1010
code-style:
1111
name: Code Style & Static Analysis
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
1616

1717
- name: Setup PHP
1818
uses: shivammathur/setup-php@v2
@@ -32,18 +32,22 @@ jobs:
3232

3333
tests:
3434
name: Test Suite
35-
runs-on: ubuntu-20.04
35+
runs-on: ubuntu-latest
3636
strategy:
3737
max-parallel: 10
3838
matrix:
3939
php:
4040
- 7.4
4141
- 8.0
4242
- 8.1
43+
- 8.2
44+
- 8.3
45+
- 8.4
46+
- 8.5
4347

4448
steps:
4549
- name: Checkout
46-
uses: actions/checkout@v2
50+
uses: actions/checkout@v4
4751

4852
- name: Setup PHP
4953
uses: shivammathur/setup-php@v2

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"require": {
2121
"php": ">=7.4",
22-
"bentools/cartesian-product": "^1.1"
22+
"bentools/cartesian-product": "^1.5|^2.0"
2323
},
2424
"require-dev": {
2525
"phpunit/phpunit": "^8.0|^9.0",

src/StringCombinations.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace BenTools\StringCombinations;
44

5-
use function BenTools\CartesianProduct\cartesian_product;
5+
use function BenTools\CartesianProduct\combinations;
66
use Countable;
77
use IteratorAggregate;
88
use Traversable;
@@ -54,7 +54,7 @@ public function count(): int
5454
{
5555
if (null === $this->count) {
5656
$this->count = array_sum(array_map(function ($set) {
57-
return count(cartesian_product($set));
57+
return count(combinations($set));
5858
}, iterator_to_array($this->generateSets())));
5959
}
6060
return $this->count;
@@ -63,7 +63,7 @@ public function count(): int
6363
public function getIterator(): Traversable
6464
{
6565
foreach ($this->generateSets() as $set) {
66-
foreach (cartesian_product($set) as $combination) {
66+
foreach (combinations($set) as $combination) {
6767
yield implode($this->glue, $combination);
6868
}
6969
}

0 commit comments

Comments
 (0)