Skip to content

Commit cb548d0

Browse files
authored
Added each method to the Rows class and use the latest version of phi… (#13)
* Added each method to the Rows class and use the latest version of phive tools. * Changed trust-gpg-key for psalm * Changed trust-gpg-key for psalm for mutation also * Changed trust-gpg-key * Fixed psalm errors * Use psalm-param instead of psalm-suppress
1 parent 9172678 commit cb548d0

File tree

7 files changed

+34
-17
lines changed

7 files changed

+34
-17
lines changed

‎.github/workflows/mutation.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
run: "composer install --no-interaction --no-progress --no-suggest"
6363

6464
- name: "Install tools"
65-
run: "phive install --trust-gpg-keys E82B2FB314E9906E,C5095986493B4AA0,CF1A108D0E7AE720,8A03EA3B385DBAA1 --force-accept-unsigned"
65+
run: "phive install --trust-gpg-keys E82B2FB314E9906E,C5095986493B4AA0,CF1A108D0E7AE720,12CE0F1D262429A5 --force-accept-unsigned"
6666

6767
- name: "Mutation Tests"
6868
run: "composer test:mutation"

‎.github/workflows/static-analyze.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
run: "composer install --no-interaction --no-progress --no-suggest"
6363

6464
- name: "Install tools"
65-
run: "phive install --trust-gpg-keys E82B2FB314E9906E,C5095986493B4AA0,CF1A108D0E7AE720,8A03EA3B385DBAA1 --force-accept-unsigned"
65+
run: "phive install --trust-gpg-keys E82B2FB314E9906E,C5095986493B4AA0,CF1A108D0E7AE720,12CE0F1D262429A5 --force-accept-unsigned"
6666

6767
- name: "Static Analyze"
6868
run: "composer static:analyze"

‎.phive/phars.xml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^2.16.4" installed="2.16.4" location="./tools/php-cs-fixer" copy="true"/>
4-
<phar name="infection" version="^0.20.1" installed="0.20.1" location="./tools/infection" copy="true"/>
5-
<phar name="phpstan" version="^0.12.59" installed="0.12.59" location="./tools/phpstan" copy="true"/>
6-
<phar name="psalm" version="^3.12.1" installed="3.14.2" location="./tools/psalm" copy="true"/>
7-
</phive>
3+
<phar name="php-cs-fixer" version="^2.18.3" installed="2.18.3" location="./tools/php-cs-fixer" copy="true"/>
4+
<phar name="infection" version="^0.21.4" installed="0.21.4" location="./tools/infection" copy="true"/>
5+
<phar name="phpstan" version="^0.12.81" installed="0.12.81" location="./tools/phpstan" copy="true"/>
6+
<phar name="psalm" version="^4.5.2" installed="4.5.2" location="./tools/psalm" copy="true"/>
7+
</phive>

‎src/Flow/ETL/ETL.php‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,17 @@ final class ETL
1010

1111
private Transformers $transformers;
1212

13-
/**
14-
* @psalm-pure
15-
*/
1613
private function __construct(Extractor $extractor, Transformers $transformers)
1714
{
1815
$this->extractor = $extractor;
1916
$this->transformers = $transformers;
2017
}
2118

22-
/**
23-
* @psalm-pure
24-
*/
2519
public static function extract(Extractor $extractor) : self
2620
{
2721
return new self($extractor, new Transformers());
2822
}
2923

30-
/**
31-
* @psalm-pure
32-
*/
3324
public function transform(Transformer ...$transformer) : self
3425
{
3526
return new self($this->extractor, $this->transformers->add(...$transformer));

‎src/Flow/ETL/Row/Entries.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function count() : int
9696
}
9797

9898
/**
99+
* @psalm-suppress ImpureFunctionCall
99100
* @psalm-suppress MixedReturnTypeCoercion
100101
* @template ReturnType
101102
*
@@ -109,6 +110,9 @@ public function map(callable $callable) : array
109110
}
110111

111112
/**
113+
* @psalm-suppress ImpureFunctionCall
114+
* @psalm-suppress MixedArgumentTypeCoercion
115+
*
112116
* @param callable(Entry) : bool $callable
113117
*/
114118
public function filter(callable $callable) : self

‎src/Flow/ETL/Row/Entry/CollectionEntry.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function value() : array
8787
return $this->mapEntries(fn (Entries $entries) : array => $entries->toArray());
8888
}
8989

90+
/**
91+
* @psalm-suppress InvalidArgument
92+
*/
9093
public function is(string $name) : bool
9194
{
9295
return $this->key === \mb_strtolower($name);
@@ -98,7 +101,7 @@ public function rename(string $name) : Entry
98101
}
99102

100103
/**
101-
* @psalm-param callable(Entries) : bool $filter
104+
* @psalm-param pure-callable(Entries) : bool $filter
102105
*/
103106
public function filterEntries(callable $filter) : self
104107
{
@@ -119,6 +122,7 @@ public function isEqual(Entry $entry) : bool
119122
}
120123

121124
/**
125+
* @psalm-suppress ImpureFunctionCall
122126
* @phpstan-ignore-next-line
123127
*/
124128
private function mapEntries(callable $callable) : array

‎src/Flow/ETL/Rows.php‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function __construct(Row ...$rows)
2828
}
2929

3030
/**
31+
* @psalm-suppress MixedArgument
3132
* @pslam-param callable (Row) : string|int|float $groupBy Returns group identifier for the given Row
3233
*/
3334
public function groupTo(string $collectionEntryName, callable $groupBy) : self
@@ -86,6 +87,9 @@ public function empty() : bool
8687
}
8788

8889
/**
90+
* @psalm-param pure-callable(Row) : bool $callable
91+
* @psalm-suppress MixedArgumentTypeCoercion
92+
*
8993
* @param callable(Row) : bool $callable
9094
*/
9195
public function filter(callable $callable) : self
@@ -94,6 +98,7 @@ public function filter(callable $callable) : self
9498
}
9599

96100
/**
101+
* @psalm-param pure-callable(Row) : Row $callable
97102
* @psalm-suppress MixedArgument Psalm doesn't understand that array_map will return array<int, Row>
98103
*
99104
* @param callable(Row) : Row $callable
@@ -104,6 +109,19 @@ public function map(callable $callable) : self
104109
}
105110

106111
/**
112+
* @psalm-param pure-callable(Row) : Row $callable
113+
*
114+
* @param callable(Row) : Row $callable
115+
*/
116+
public function each(callable $callable) : void
117+
{
118+
\array_map($callable, $this->rows);
119+
}
120+
121+
/**
122+
* @psalm-param pure-callable(mixed, Row) : mixed $callable
123+
* @psalm-suppress MixedAssignment
124+
*
107125
* @param callable(mixed, Row) : mixed $callable
108126
* @param null|mixed $input
109127
*

0 commit comments

Comments
 (0)