Skip to content
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
48 changes: 48 additions & 0 deletions tests/PHPStan/Type/BenevolentUnionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
class BenevolentUnionTypeTest extends PHPStanTestCase
{

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataCanAccessProperties(): Iterator
{
yield [
Expand Down Expand Up @@ -49,6 +52,9 @@ public function testCanAccessProperties(BenevolentUnionType $type, TrinaryLogic
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, string, TrinaryLogic}>
*/
public static function dataHasProperty(): Iterator
{
yield [
Expand Down Expand Up @@ -87,6 +93,9 @@ public function testHasProperty(BenevolentUnionType $type, string $propertyName,
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataCanCallMethods(): Iterator
{
yield [
Expand Down Expand Up @@ -116,6 +125,9 @@ public function testCanCanCallMethods(BenevolentUnionType $type, TrinaryLogic $e
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, string, TrinaryLogic}>
*/
public static function dataHasMethod(): Iterator
{
yield [
Expand Down Expand Up @@ -151,6 +163,9 @@ public function testHasMethod(BenevolentUnionType $type, string $methodName, Tri
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataCanAccessConstants(): Iterator
{
yield [
Expand Down Expand Up @@ -180,6 +195,9 @@ public function testCanAccessConstants(BenevolentUnionType $type, TrinaryLogic $
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsIterable(): Iterator
{
yield [
Expand Down Expand Up @@ -215,6 +233,9 @@ public function testIsIterable(BenevolentUnionType $type, TrinaryLogic $expected
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsIterableAtLeastOnce(): Iterator
{
yield [
Expand Down Expand Up @@ -250,6 +271,9 @@ public function testIsIterableAtLeastOnce(BenevolentUnionType $type, TrinaryLogi
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsArray(): Iterator
{
yield [
Expand Down Expand Up @@ -279,6 +303,9 @@ public function testIsArray(BenevolentUnionType $type, TrinaryLogic $expectedRes
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsString(): Iterator
{
yield [
Expand Down Expand Up @@ -311,6 +338,9 @@ public function testIsString(BenevolentUnionType $type, TrinaryLogic $expectedRe
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsNumericString(): Iterator
{
yield [
Expand Down Expand Up @@ -342,6 +372,9 @@ public function testIsNumericString(BenevolentUnionType $type, TrinaryLogic $exp
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsNonFalsyString(): Iterator
{
yield [
Expand Down Expand Up @@ -373,6 +406,9 @@ public function testIsNonFalsyString(BenevolentUnionType $type, TrinaryLogic $ex
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsLiteralString(): Iterator
{
yield [
Expand Down Expand Up @@ -404,6 +440,9 @@ public function testIsLiteralString(BenevolentUnionType $type, TrinaryLogic $exp
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsOffsetAccesible(): Iterator
{
yield [
Expand Down Expand Up @@ -439,6 +478,9 @@ public function testIsOffsetAccessible(BenevolentUnionType $type, TrinaryLogic $
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, ConstantStringType, TrinaryLogic}>
*/
public static function dataHasOffsetValueType(): Iterator
{
yield [
Expand Down Expand Up @@ -477,6 +519,9 @@ public function testHasOffsetValue(BenevolentUnionType $type, Type $offsetType,
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsCallable(): Iterator
{
yield [
Expand Down Expand Up @@ -506,6 +551,9 @@ public function testIsCallable(BenevolentUnionType $type, TrinaryLogic $expected
);
}

/**
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
*/
public static function dataIsCloneable(): Iterator
{
yield [
Expand Down
11 changes: 10 additions & 1 deletion tests/PHPStan/Type/IntersectionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
class IntersectionTypeTest extends PHPStanTestCase
{

/**
* @return Iterator<int, array{Type, Type, TrinaryLogic}>
*/
public static function dataAccepts(): Iterator
{
$intersectionType = new IntersectionType([
Expand Down Expand Up @@ -70,7 +73,7 @@ public static function dataAccepts(): Iterator
}

#[DataProvider('dataAccepts')]
public function testAccepts(IntersectionType $type, Type $otherType, TrinaryLogic $expectedResult): void
public function testAccepts(Type $type, Type $otherType, TrinaryLogic $expectedResult): void
{
$actualResult = $type->accepts($otherType, true)->result;
$this->assertSame(
Expand Down Expand Up @@ -121,6 +124,9 @@ public function testIsCallable(IntersectionType $type, TrinaryLogic $expectedRes
);
}

/**
* @return Iterator<int, array{IntersectionType, Type, TrinaryLogic}>
*/
public static function dataIsSuperTypeOf(): Iterator
{
$intersectionTypeA = new IntersectionType([
Expand Down Expand Up @@ -242,6 +248,9 @@ public function testIsSuperTypeOf(IntersectionType $type, Type $otherType, Trina
);
}

/**
* @return Iterator<int, array{IntersectionType, Type, TrinaryLogic}>
*/
public static function dataIsSubTypeOf(): Iterator
{
$intersectionTypeA = new IntersectionType([
Expand Down
3 changes: 3 additions & 0 deletions tests/PHPStan/Type/ObjectTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,9 @@ public function testAccepts(
);
}

/**
* @return Iterator<int, array{ObjectType, string, TrinaryLogic}>
*/
public static function dataHasConstant(): Iterator
{
yield [
Expand Down
9 changes: 9 additions & 0 deletions tests/PHPStan/Type/UnionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public function testIsCallable(UnionType $type, TrinaryLogic $expectedResult): v
);
}

/**
* @return Iterator<int, array{Type}>
*/
public static function dataSelfCompare(): Iterator
{
$reflectionProvider = self::createReflectionProvider();
Expand Down Expand Up @@ -166,6 +169,9 @@ public function testSelfCompare(Type $type): void
);
}

/**
* @return Iterator<array-key, array{UnionType, Type, TrinaryLogic}>
*/
public static function dataIsSuperTypeOf(): Iterator
{
$unionTypeA = new UnionType([
Expand Down Expand Up @@ -460,6 +466,9 @@ public function testIsSuperTypeOf(UnionType $type, Type $otherType, TrinaryLogic
);
}

/**
* @return Iterator<int, array{UnionType, Type, TrinaryLogic}>
*/
public static function dataIsSubTypeOf(): Iterator
{
$unionTypeA = new UnionType([
Expand Down
Loading