Skip to content

Commit e3dd0d6

Browse files
authored
FIX: update phpstan to latest and remove ignored file (#198)
* phpstan: update to latest and remove ignored file * add specific ignores for phpstan into now processable Progress prompt
1 parent 96a0e11 commit e3dd0d6

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
},
2525
"require-dev": {
2626
"illuminate/collections": "^10.0|^11.0|^12.0",
27-
"phpstan/phpstan": "^1.11",
27+
"phpstan/phpstan": "^1.12.28",
2828
"pestphp/pest": "^2.3|^3.4",
2929
"mockery/mockery": "^1.5",
30-
"phpstan/phpstan-mockery": "^1.1"
30+
"phpstan/phpstan-mockery": "^1.1.3"
3131
},
3232
"conflict": {
3333
"illuminate/console": ">=10.17.0 <10.25.0",

phpstan.neon.dist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,5 @@ parameters:
44

55
level: 7
66

7-
excludePaths:
8-
analyse:
9-
- src/Progress.php # Progress causes infinite loop
10-
117
includes:
128
- vendor/phpstan/phpstan-mockery/extension.neon

src/Progress.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ class Progress extends Prompt
3434
*/
3535
public function __construct(public string $label, public iterable|int $steps, public string $hint = '')
3636
{
37-
$this->total = match (true) { // @phpstan-ignore assign.propertyType
37+
/** @phpstan-ignore assign.propertyType (PHPStan doesn't parse that we convert from iterable to int in the below match) */
38+
$this->total = match (true) {
3839
is_int($this->steps) => $this->steps,
3940
is_countable($this->steps) => count($this->steps),
4041
is_iterable($this->steps) => iterator_count($this->steps),
42+
/** @phpstan-ignore match.unreachable (Technically we shouldn't be able to reach the default as should be int|countable|iterable ) */
4143
default => throw new InvalidArgumentException('Unable to count steps.'),
4244
};
4345

@@ -53,6 +55,7 @@ public function __construct(public string $label, public iterable|int $steps, pu
5355
*
5456
* @param Closure((TSteps is int ? int : value-of<TSteps>), $this): TReturn $callback
5557
* @return array<TReturn>
58+
* @throws Throwable
5659
*/
5760
public function map(Closure $callback): array
5861
{

0 commit comments

Comments
 (0)