Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update phpstan packages to v2 (major) #58

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
Loading