Skip to content

Commit 2425e62

Browse files
committed
Fix for phpstan
1 parent b414a04 commit 2425e62

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

phpstan-baseline.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,28 @@
22

33
$ignoreErrors = [];
44
$ignoreErrors[] = [
5-
'message' => '#^Method Nexus\\\\Collection\\\\Collection\\:\\:all\\(\\) should return array\\<T\\> but returns array\\<TKey, T\\>\\.$#',
5+
'rawMessage' => 'Method Nexus\\Collection\\Collection::all() should return array<T> but returns array<TKey, T>.',
66
'identifier' => 'return.type',
77
'count' => 1,
88
'path' => __DIR__ . '/src/Nexus/Collection/Collection.php',
99
];
1010
$ignoreErrors[] = [
11-
'message' => '#^Function Nexus\\\\Option\\\\option\\(\\) never returns Nexus\\\\Option\\\\Some\\<T of mixed\\> so it can be removed from the return type\\.$#',
11+
'rawMessage' => 'Function Nexus\\Option\\option() never returns Nexus\\Option\\Some<T of mixed> so it can be removed from the return type.',
1212
'identifier' => 'return.unusedType',
1313
'count' => 1,
1414
'path' => __DIR__ . '/src/Nexus/Option/functions.php',
1515
];
1616
$ignoreErrors[] = [
17-
'message' => '#^Method Nexus\\\\Tests\\\\AutoReview\\\\ComposerJsonTest\\:\\:getComposer\\(\\) should return array\\<string, mixed\\> but returns mixed\\.$#',
17+
'rawMessage' => 'Method Nexus\\Tests\\AutoReview\\ComposerJsonTest::getComposer() should return array<string, mixed> but returns mixed.',
1818
'identifier' => 'return.type',
1919
'count' => 1,
2020
'path' => __DIR__ . '/tests/AutoReview/ComposerJsonTest.php',
2121
];
2222
$ignoreErrors[] = [
23-
'message' => '#^Call to function in_array\\(\\) with arguments string, array\\{\\} and true will always evaluate to false\\.$#',
23+
'rawMessage' => 'Call to function in_array() with arguments string, array{} and true will always evaluate to false.',
2424
'identifier' => 'function.impossibleType',
2525
'count' => 1,
2626
'path' => __DIR__ . '/tests/AutoReview/TestCodeTest.php',
2727
];
28-
$ignoreErrors[] = [
29-
'message' => '#^Call to method Nexus\\\\Option\\\\Some\\<int\\>\\:\\:isNone\\(\\) will always evaluate to false\\.$#',
30-
'identifier' => 'method.impossibleType',
31-
'count' => 1,
32-
'path' => __DIR__ . '/tests/Option/OptionTest.php',
33-
];
3428

3529
return ['parameters' => ['ignoreErrors' => $ignoreErrors]];

src/Nexus/Option/Option.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ public function isSomeAnd(\Closure $predicate): bool;
4444
/**
4545
* Returns `true` if the option is a **None** value.
4646
*
47-
* @phpstan-assert-if-true None $this
48-
* @phpstan-assert-if-true false $this->isSome()
49-
* @phpstan-assert-if-false Some<T> $this
50-
* @phpstan-assert-if-false true $this->isSome()
47+
* @phpstan-assert-if-true false $this->isSome()
48+
* @phpstan-assert-if-false true $this->isSome()
5149
*/
5250
public function isNone(): bool;
5351

0 commit comments

Comments
 (0)