Skip to content

Commit d291d6d

Browse files
committed
fix expectations
1 parent 536d3a8 commit d291d6d

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

tests/PHPStan/Analyser/nsrt/bug-3842.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ function testIsArrayOnCallable(callable $value): void {
2222
if (is_array($value)) {
2323
assertType('array<mixed, mixed>&callable(): mixed', $value);
2424
assertType('class-string|object', $value[0]);
25-
assertType('string', $value[1]);
25+
assertType('non-falsy-string', $value[1]);
2626
}
2727
}
2828

2929
/** @param callable-array $value */
3030
function testCallableArrayPhpDoc(array $value): void {
3131
assertType('array&callable(): mixed', $value);
3232
assertType('class-string|object', $value[0]);
33-
assertType('string', $value[1]);
33+
assertType('non-falsy-string', $value[1]);
3434
}
3535

3636
function testIsStringOnCallable(callable $value): void {
@@ -50,7 +50,7 @@ function checkClassString(array $values): void {
5050
/** @param 0|1 $offset */
5151
function testCallableArrayUnionOffset(callable $value, int $offset): void {
5252
if (is_array($value)) {
53-
assertType('object|string', $value[$offset]);
53+
assertType('object|non-falsy-string', $value[$offset]);
5454
}
5555
}
5656

tests/PHPStan/Rules/Methods/data/bug-14549.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ public function doFoo(array $task): void
1313
{
1414
foreach($task as $k => $v) {
1515
assertType('0|1', $k);
16-
assertType('object|non-empty-string', $v);
16+
assertType('object|non-falsy-string', $v);
1717
}
1818
assertType('class-string|object', $task[0]);
19-
assertType('string', $task[1]);
19+
assertType('non-falsy-string', $task[1]);
2020
}
2121

2222
/**
@@ -30,11 +30,11 @@ public function doBar(array $list): void
3030
if (is_callable($list)) {
3131
assertType('non-empty-list<string>&callable(): mixed&hasOffsetValue(0, non-empty-string)', $list);
3232
assertType('non-empty-string', $list[0]);
33-
assertType('string', $list[1]);
33+
assertType('non-falsy-string', $list[1]);
3434

3535
foreach($list as $k => $v) {
3636
assertType('0|1', $k);
37-
assertType('non-empty-string', $v);
37+
assertType('non-falsy-string', $v);
3838
}
3939
}
4040
}

tests/PHPStan/Type/Constant/ConstantStringTypeTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function testIsCallable(TrinaryLogic $trinaryLogic, string $constantValue
190190
{
191191
$this->assertSame(
192192
$trinaryLogic,
193-
(new ConstantStringType($constantValue))->isCallable()
193+
(new ConstantStringType($constantValue))->isCallable(),
194194
);
195195
}
196196

@@ -199,7 +199,8 @@ public static function dataIsCallable(): iterable
199199
yield [TrinaryLogic::createNo(), ''];
200200
yield [TrinaryLogic::createNo(), '0'];
201201
yield [TrinaryLogic::createYes(), 'substr'];
202-
yield [TrinaryLogic::createYes(), self::class.'::dataIsCallable'];
203-
yield [TrinaryLogic::createMaybe(), self::class.'::methodDoesNotExist'];
202+
yield [TrinaryLogic::createYes(), self::class . '::dataIsCallable'];
203+
yield [TrinaryLogic::createMaybe(), self::class . '::methodDoesNotExist'];
204204
}
205+
205206
}

0 commit comments

Comments
 (0)