Skip to content

Commit ed682a9

Browse files
committed
fix
1 parent 5d6ddf3 commit ed682a9

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/Type/Php/ImplodeFunctionReturnTypeExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private function implode(Type $arrayType, Type $separatorType): Type
9191
}
9292

9393
// implode is one of the four functions that can produce literal strings as blessed by the original RFC: wiki.php.net/rfc/is_literal
94-
if ($valueTypeAsString->isLiteralString()->yes() && $separatorType->isLiteralString()->yes()) {
94+
if ($arrayType->getIterableValueType()->isLiteralString()->yes() && $separatorType->isLiteralString()->yes()) {
9595
$accessoryTypes[] = new AccessoryLiteralStringType();
9696
}
9797
if ($valueTypeAsString->isLowercaseString()->yes() && $separatorType->isLowercaseString()->yes()) {

tests/PHPStan/Analyser/nsrt/implode.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ public function constArrays5($constArr) {
6161

6262
/** @param array{0: 1, 1: 'a'|'b', 3?: 'c'|'d', 4?: 'e'|'f', 5?: 'g'|'h', 6?: 'x'|'y'} $constArr */
6363
public function constArrays6($constArr) {
64-
assertType("literal-string&lowercase-string&non-falsy-string", implode('', $constArr));
64+
assertType("lowercase-string&non-falsy-string", implode('', $constArr));
6565
}
6666
}

tests/PHPStan/Analyser/nsrt/non-empty-string.php

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ public function sayHello(int $i): void
213213
$s = array(1, $i);
214214

215215
assertType('lowercase-string&non-falsy-string', implode("a", $s));
216+
assertType('non-falsy-string&uppercase-string', implode("A", $s));
216217
}
217218

218219
/**

0 commit comments

Comments
 (0)