Bug report
In this code:
<?php declare(strict_types = 1);
class HelloWorld
{
private string $prefix = '';
/** @var non-empty-string $name */
private string $name = 'identifier';
/** @return non-empty-string */
public function getPrefixedName(): string
{
$name = $this->prefix;
$search = str_split('()<>@');
$replace = array_map(rawurlencode(...), $search);
$name .= str_replace($search, $replace, $this->name);
return $name;
}
}
$name becomes a string instead of non-empty-string when the search & replace arguments are non-empty arrays.
Code snippet that reproduces the problem
https://phpstan.org/r/bd4e8c23-0ffc-4d13-8050-0780f827f2f0
Expected output
It should retain as non-empty-string
Did PHPStan help you today? Did it make you happy in any way?
No response
Bug report
In this code:
$namebecomes astringinstead ofnon-empty-stringwhen the search & replace arguments are non-empty arrays.Code snippet that reproduces the problem
https://phpstan.org/r/bd4e8c23-0ffc-4d13-8050-0780f827f2f0
Expected output
It should retain as
non-empty-stringDid PHPStan help you today? Did it make you happy in any way?
No response