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

Added documentation for literal-string

This commit is contained in:
Matthew Brown 2021-06-16 11:53:13 -04:00 committed by GitHub
parent cfa5492286
commit 5f8f249168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,24 @@ Psalm also supports a `trait-string` annotation denote a trait that exists.
`numeric-string` denotes a string value that has passed an `is_numeric` check.
### literal-string
`literal-string` denotes a string value that is entirely composed of strings in your application.
Examples:
- `"hello " . "world"`
- `"hello " . Person::DEFAULT_NAME
- `implode([', ', ["one", "two"])`
- `implode([', ', [1, 2, 3])`
- `"hello " . <another literal-string>`
Strings that don't pass this type check:
- `file_get_contents("foo.txt")`
- `$_GET["foo"]`
- `"hello " . $_GET["foo"]`
### lowercase-string, non-empty-string, non-empty-lowercase-string
An empty string, lowercased or both at once.