Skip to content

Commit

Permalink
chore(deps): update phpstan packages to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored and simPod committed Nov 11, 2024
1 parent 7fcd334 commit 3a807e4
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"infection/infection": "^0.29.0",
"php-ds/php-ds": "^1.4",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0.0",
"phpunit/phpunit": "^11.0",
"shipmonk/composer-dependency-analyser": "^1.5"
},
Expand Down
7 changes: 6 additions & 1 deletion src/assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

use function assert;

/** @phpstan-pure */
/**
* @param TValue $assertionFn
* @param callable(TValue):(bool|string) $assertionFn
*
* @template TValue
*/
function assert_return(mixed $value, callable $assertionFn, Throwable|string|null $description = null): mixed
{
assert($assertionFn($value), $description);
Expand Down
1 change: 1 addition & 0 deletions src/noop.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Cdn77\Functions;

/** @phpstan-ignore void.pure */
function noop(): void
{
return;
Expand Down
1 change: 1 addition & 0 deletions tests/AssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function testAssertReturn(): void
$value = 1;
self::assertSame(
$value,
/** @phpstan-ignore function.alreadyNarrowedType */
assert_return($value, is_int(...)),
);
}
Expand Down
8 changes: 2 additions & 6 deletions tests/DsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ final class DsTest extends TestCase
{
public function testMapFromEntries(): void
{
/** @var callable():Generator<array{int, bool}> $iterableFactory */
$iterableFactory = static function (): Generator {
yield [1, true];
yield [2, true];
Expand All @@ -41,7 +40,6 @@ public function testMapFromEntries(): void

public function testMapFromIterable(): void
{
/** @var callable():Generator<int, bool> $iterableFactory */
$iterableFactory = static function (): Generator {
yield 1 => true;
yield 2 => false;
Expand All @@ -57,7 +55,6 @@ public function testMapFromIterable(): void

public function testMappedQueuesFromIterable(): void
{
/** @var callable():Generator<int, string> $iterableFactory */
$iterableFactory = static function (): Generator {
yield 1 => 'a';
yield 1 => 'b';
Expand All @@ -67,6 +64,7 @@ public function testMappedQueuesFromIterable(): void

$map = mappedQueuesFromIterable(
$iterableFactory(),
/** @phpstan-ignore argument.type */
static fn (int $key, string $value) => new Pair($key * 2, $value . '_'),
);

Expand All @@ -83,7 +81,6 @@ public function testMappedQueuesFromIterable(): void

public function testMappedSetsFromIterable(): void
{
/** @var callable():Generator<int, string> $iterableFactory */
$iterableFactory = static function (): Generator {
yield 1 => 'a';
yield 1 => 'b';
Expand All @@ -93,6 +90,7 @@ public function testMappedSetsFromIterable(): void

$map = mappedSetsFromIterable(
$iterableFactory(),
/** @phpstan-ignore argument.type */
static fn (int $key, string $value) => new Pair($key * 2, $value . '_'),
);

Expand All @@ -103,7 +101,6 @@ public function testMappedSetsFromIterable(): void

public function testSetFromIterable(): void
{
/** @var callable():Generator<int, bool> $iterableFactory */
$iterableFactory = static function (): Generator {
yield 1 => true;
yield 2 => false;
Expand All @@ -118,7 +115,6 @@ public function testSetFromIterable(): void

public function testVectorFromIterable(): void
{
/** @var callable():Generator<int, bool> $iterableFactory */
$iterableFactory = static function (): Generator {
yield 1 => true;
yield 2 => false;
Expand Down
1 change: 1 addition & 0 deletions tests/IterableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function testFindFirst(): void
public function testDontFind(): void
{
$iterable = [0, 1, 2, 3];
/** @phpstan-ignore greater.alwaysFalse */
$option = find($iterable, static fn (mixed $_, int $value) => $value > 3);

self::assertTrue($option->isNone());
Expand Down
2 changes: 1 addition & 1 deletion tests/NoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public function testRun(): void
{
noop();

self::assertTrue(true);
self::addToAssertionCount(1);
}
}

0 comments on commit 3a807e4

Please sign in to comment.