Skip to content

Commit 8213017

Browse files
herndlmondrejmirtes
authored andcommitted
Support list type
1 parent c8cd404 commit 8213017

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"require": {
99
"php": "^7.2 || ^8.0",
10-
"phpstan/phpstan": "^1.8.0"
10+
"phpstan/phpstan": "^1.9.0"
1111
},
1212
"require-dev": {
1313
"nikic/php-parser": "^4.13.0",

src/Type/WebMozartAssert/AssertTypeSpecifyingExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,11 @@ private static function getExpressionResolvers(): array
351351
[$expr]
352352
),
353353
new Identical(
354+
$expr->value,
354355
new FuncCall(
355-
new Name('array_filter'),
356-
[$expr, new Arg(new String_('is_int')), new Arg(new ConstFetch(new Name('ARRAY_FILTER_USE_KEY')))]
357-
),
358-
$expr->value
356+
new Name('array_values'),
357+
[$expr]
358+
)
359359
)
360360
);
361361
},

tests/Type/WebMozartAssert/AssertTypeSpecifyingExtensionTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public function testFileAsserts(
3535

3636
public static function getAdditionalConfigFiles(): array
3737
{
38-
return [__DIR__ . '/../../../extension.neon'];
38+
return [
39+
__DIR__ . '/../../../extension.neon',
40+
'phar://' . __DIR__ . '/../../../vendor/phpstan/phpstan/phpstan.phar/conf/bleedingEdge.neon',
41+
];
3942
}
4043

4144
}

tests/Type/WebMozartAssert/data/array.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,19 @@ public function countBetween(array $a, array $b, array $c, array $d): void
101101
public function isList($a, $b): void
102102
{
103103
Assert::isList($a);
104-
assertType('array<int, mixed>', $a);
104+
assertType('list<mixed>', $a);
105105

106106
Assert::nullOrIsList($b);
107-
assertType('array<int, mixed>|null', $b);
107+
assertType('list<mixed>|null', $b);
108108
}
109109

110110
public function isNonEmptyList($a, $b): void
111111
{
112112
Assert::isNonEmptyList($a);
113-
assertType('non-empty-array<int, mixed>', $a);
113+
assertType('non-empty-list<mixed>', $a);
114114

115115
Assert::nullOrIsNonEmptyList($b);
116-
assertType('non-empty-array<int, mixed>|null', $b);
116+
assertType('non-empty-list<mixed>|null', $b);
117117
}
118118

119119
public function isMap($a, $b): void

0 commit comments

Comments
 (0)