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:
commit
5efddb4201
@ -7,6 +7,6 @@ namespace Psalm\Type\Atomic;
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
final class TSingleLetter extends TString
|
||||
final class TSingleLetter extends TNonEmptyString
|
||||
{
|
||||
}
|
||||
|
@ -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
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user