Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion build/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ parameters:
- '#^Dynamic call to static method PHPUnit\\Framework\\\S+\(\)\.$#'
- '#should be contravariant with parameter \$node \(PhpParser\\Node\) of method PHPStan\\Rules\\Rule<PhpParser\\Node>::processNode\(\)$#'
- '#Variable property access on PhpParser\\Node#'
- '#Test::data[a-zA-Z0-9_]+\(\) return type has no value type specified in iterable type#'
-
identifier: shipmonk.deadMethod
message: '#^Unused .*?Factory::create#' # likely used in DIC
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"php-parallel-lint/php-parallel-lint": "^1.2.0",
"phpstan/phpstan-deprecation-rules": "^2.0.2",
"phpstan/phpstan-nette": "^2.0",
"phpstan/phpstan-phpunit": "^2.0.7",
"phpstan/phpstan-phpunit": "^2.0.8",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^11.5.23",
"shipmonk/composer-dependency-analyser": "^1.5",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Type/ClosureTypeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(
}

/**
* @param Closure(): mixed $closure
* @param Closure(mixed): mixed $closure
*/
public function fromClosureObject(Closure $closure): ClosureType
{
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Command/CommandHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public static function dataParameters(): array
}

/**
* @param array<string, string> $expectedParameters
* @param array<string, mixed> $expectedParameters
* @throws InceptionNotSuccessfulException
*/
#[DataProvider('dataParameters')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public static function dataFormatterOutputProvider(): iterable
0,
0,
'',
'',
];

yield [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function testConstUnknown(string $constantName): void
}

/**
* @param class-string[] $expectedIdentifiers
* @param array<string> $expectedIdentifiers
*/
#[DataProvider('dataForIdenifiersByType')]
public function testLocateIdentifiersByType(
Expand Down
7 changes: 7 additions & 0 deletions tests/PHPStan/Reflection/ClassReflectionPropertyHooksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Reflection;

use PHPStan\ShouldNotHappenException;
use PHPStan\Testing\PHPStanTestCase;
use PHPStan\Type\Generic\GenericObjectType;
use PHPStan\Type\IntegerType;
Expand Down Expand Up @@ -226,6 +227,9 @@ public static function dataPropertyHooks(): iterable
];

$specificFooGenerics = (new GenericObjectType('PropertyHooksTypes\\FooGenerics', [new IntegerType()]))->getClassReflection();
if ($specificFooGenerics === null) {
throw new ShouldNotHappenException();
}

yield [
$specificFooGenerics,
Expand Down Expand Up @@ -291,6 +295,9 @@ public static function dataPropertyHooks(): iterable
];

$specificFooGenericsConstructor = (new GenericObjectType('PropertyHooksTypes\\FooGenericsConstructor', [new IntegerType()]))->getClassReflection();
if ($specificFooGenericsConstructor === null) {
throw new ShouldNotHappenException();
}

yield [
$specificFooGenericsConstructor,
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Type/ClosureTypeFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function dataFromClosureObjectParameter(): array
}

/**
* @param Closure(): mixed $closure
* @param Closure(mixed): mixed $closure
*/
#[DataProvider('dataFromClosureObjectParameter')]
public function testFromClosureObjectParameter(Closure $closure, int $index, string $type): void
Expand All @@ -75,7 +75,7 @@ public function testFromClosureObjectParameter(Closure $closure, int $index, str
}

/**
* @param Closure(): mixed $closure
* @param Closure(mixed): mixed $closure
*/
private function getClosureType(Closure $closure): ClosureType
{
Expand Down
12 changes: 6 additions & 6 deletions tests/PHPStan/Type/StringTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public static function dataIsSuperTypeOf(): array
}

#[DataProvider('dataIsSuperTypeOf')]
public function testIsSuperTypeOf(StringType $type, Type $otherType, TrinaryLogic $expectedResult): void
public function testIsSuperTypeOf(Type $stringType, Type $otherType, TrinaryLogic $expectedResult): void
{
$actualResult = $type->isSuperTypeOf($otherType);
$actualResult = $stringType->isSuperTypeOf($otherType);
$this->assertSame(
$expectedResult->describe(),
$actualResult->describe(),
sprintf('%s -> isSuperTypeOf(%s)', $type->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
sprintf('%s -> isSuperTypeOf(%s)', $stringType->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
);
}

Expand Down Expand Up @@ -174,13 +174,13 @@ public static function dataAccepts(): iterable
}

#[DataProvider('dataAccepts')]
public function testAccepts(StringType $type, Type $otherType, TrinaryLogic $expectedResult): void
public function testAccepts(Type $stringType, Type $otherType, TrinaryLogic $expectedResult): void
{
$actualResult = $type->accepts($otherType, true)->result;
$actualResult = $stringType->accepts($otherType, true)->result;
$this->assertSame(
$expectedResult->describe(),
$actualResult->describe(),
sprintf('%s -> accepts(%s)', $type->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
sprintf('%s -> accepts(%s)', $stringType->describe(VerbosityLevel::precise()), $otherType->describe(VerbosityLevel::precise())),
);
}

Expand Down
12 changes: 6 additions & 6 deletions tests/PHPStan/Type/UnionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ public static function dataIsCallable(): array
}

#[DataProvider('dataIsCallable')]
public function testIsCallable(UnionType $type, TrinaryLogic $expectedResult): void
public function testIsCallable(Type $unionType, TrinaryLogic $expectedResult): void
{
$actualResult = $type->isCallable();
$actualResult = $unionType->isCallable();
$this->assertSame(
$expectedResult->describe(),
$actualResult->describe(),
sprintf('%s -> isCallable()', $type->describe(VerbosityLevel::precise())),
sprintf('%s -> isCallable()', $unionType->describe(VerbosityLevel::precise())),
);
}

Expand Down Expand Up @@ -699,13 +699,13 @@ public static function dataIsScalar(): array
}

#[DataProvider('dataIsScalar')]
public function testIsScalar(UnionType $type, TrinaryLogic $expectedResult): void
public function testIsScalar(Type $unionType, TrinaryLogic $expectedResult): void
{
$actualResult = $type->isScalar();
$actualResult = $unionType->isScalar();
$this->assertSame(
$expectedResult->describe(),
$actualResult->describe(),
sprintf('%s -> isScalar()', $type->describe(VerbosityLevel::precise())),
sprintf('%s -> isScalar()', $unionType->describe(VerbosityLevel::precise())),
);
}

Expand Down
Loading