Atomic types are the basic building block of all type information used in Psalm. Multiple atomic types can be combined, either with union types or intersection types. Psalm allows many different sorts of atomic types to be expressed in docblock syntax:
- class-string and class-string
iterable- represents the iterable pseudo-type. Like arrays, iterables can have type parameters e.g.
void- can be used in a return type when a function does not return a value.
empty- a type that represents a lack of type - not just a lack of type information (that's where mixed is useful) but where there can be no type. A good example is the type of the empty array
. Psalm types this as
mixedrepresents a lack of type information. Psalm warns about mixed when the
totallyTypedflag is turned on.
resourcerepresents a PHP resource.
no-returnis the 'return type' for a function that can never actually return, such as
exit(), or a function that always throws an exception. It may also be written as
never-returns, and is also known as the bottom type.