Skip to content

Commit

Permalink
Merge pull request #9675 from robchett/master
Browse files Browse the repository at this point in the history
Valid array access on a non-empty-string yields a non-empty-string
  • Loading branch information
orklah committed Apr 19, 2023
2 parents 76ebf54 + 836953e commit 5efddb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Psalm/Type/Atomic/TSingleLetter.php
Expand Up @@ -7,6 +7,6 @@
*
* @psalm-immutable
*/
final class TSingleLetter extends TString
final class TSingleLetter extends TNonEmptyString
{
}
9 changes: 9 additions & 0 deletions tests/ArrayAccessTest.php
Expand Up @@ -524,6 +524,15 @@ function bar (array $a): void {
}
}',
],
'nonEmptyStringAccess' => [
'code' => '<?php
/** @var non-empty-string $a */
$a = "blah";
$b = $a[0];',
'assertions' => [
'$b===' => 'non-empty-string',
],
],
'notEmptyStringOffset' => [
'code' => '<?php
/**
Expand Down

0 comments on commit 5efddb4

Please sign in to comment.