Skip to content

Commit

Permalink
Switch TSingleLetter to extend TNonEmptyString instead of TString as …
Browse files Browse the repository at this point in the history
…it is more precise
  • Loading branch information
robchett committed Apr 19, 2023
1 parent 958eb5a commit 1341c03
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 1341c03

Please sign in to comment.