1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Merge pull request #9675 from robchett/master

Valid array access on a non-empty-string yields a non-empty-string
This commit is contained in:
orklah 2023-04-19 21:12:29 +02:00 committed by GitHub
commit 5efddb4201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,6 @@ namespace Psalm\Type\Atomic;
*
* @psalm-immutable
*/
final class TSingleLetter extends TString
final class TSingleLetter extends TNonEmptyString
{
}

View File

@ -524,6 +524,15 @@ class ArrayAccessTest extends TestCase
}
}',
],
'nonEmptyStringAccess' => [
'code' => '<?php
/** @var non-empty-string $a */
$a = "blah";
$b = $a[0];',
'assertions' => [
'$b===' => 'non-empty-string',
],
],
'notEmptyStringOffset' => [
'code' => '<?php
/**