Syntax Comparison
Edit pageLast modified: 10 January 2025The language is defined by a syntax that is based on the grammar of popular static code analysis tools: PHPStan and Psalm.
PHPStan: https://phpstan.org
Psalm: https://psalm.dev
tip
There are others that are not currently tested for compatibility. For example:
PHAN: https://github.com/phan
phpDocumentor: https://docs.phpdoc.org
If you wish, you can add information about this software using a pull request to the documentation.
tip
Below is a comparison list of all syntactic structures (grammar). The logical component (the physical existence of the type) is NOT taken into account.
General table across all type parsing capabilities
Basic Types
Below is a list of simple, logical and other common types.
|
|
| |
Class or type name (including FQN)
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
|
| ||
| |||
Prefixed class constant mask types
| |||
Non-prefixed class constant mask types
| |||
| |||
Conditional Types
Below is a list of conditional types.
|
|
| |
Conditional positive equality types
| |||
Conditional negative equality types
| |||
| |||
Conditional referenced types in Yoda-style
| |||
Functions in conditional types
| |||
Functions in conditional types in Yoda-style
| |||
Literal Types
Below is a list of literal types/lexemes.
|
|
| |
Boolean
| |||
| |||
| |||
| |||
Escape sequences in a double-quoted string literals
| |||
Hexadecimal sequences in a double-quoted string literals
| |||
Unicode sequences in a double-quoted string literals
| |||
| |||
BigInteger (
| |||
Integer literals in binary format
| |||
Integer literals in octal format
| |||
Integer literals in legacy octal format
| |||
Integer literals in hexadecimal format
| |||
| |||
Float literals without leading zero
| |||
Float literals without trailing zero
| |||
Float literals in scientific notation
| |||
Float literals in scientific notation
| |||
Float hexadecimal literals in scientific notation
| |||
Shape Types
Below is a list of grammar of shaped types.
|
|
| |
| |||
Trailing comma in explicit shape types
| |||
| |||
Trailing comma in implicit shape types
| |||
Optional keys in explicit shape types
| |||
| |||
| |||
| |||
| |||
| |||
| |||
Callables Types
Below is a list of grammar of callable (function) types.
|
|
| |
| |||
| |||
Callable with typed parameters
| |||
Callable with optional parameters
| |||
Callable with named parameters
| |||
Callable with optional named parameters
| |||
Callable with output parameters
| |||
Callable with output optional parameters
| |||
Callable with output optional named parameters
| |||
Callable with suffixed variadic parameters
| |||
Callable with prefixed variadic parameters
| |||
Callable with prefixed and suffixed variadic parameters
| |||
| |||
Callable with optional variadic parameters
| |||
| |||
Callable with named variadic parameters
| |||
Callable with output named variadic parameters
| |||