Skip to content
Psalm
Documentation Atomic Type Reference
Type to start searching
    GitHub
    GitHub
    • Documentation Home
      • Installation
      • Configuration
        • Using plugins
        • Authoring plugins
        • How Psalm represents types
      • Command line usage
      • IDE support
        • Dealing with code issues
        • Issue Types
      • Checking non-PHP files
      • Using Type Annotations
      • Union Types
      • Atomic Type Reference
      • Intersection Types
      • Supported Annotations
      • Template Annotations
      • Assert Annotations
      • Fixing code with Psalter
      • Refactoring code
      • Introduction
      • Taint annotations
      • Taint flow annotations
      • Custom taint sources
      • Custom taint sinks
      • Avoiding false-positives
      • Avoiding false-negatives
    • Contributing
    

    Atomic types

    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:

    Note: you can view detailed documentation and usage examples for all atomic types by clicking on each type in the following list.

    • Scalar types
      • bool
      • int
      • float
      • string
      • int-range<x, y>
      • int-mask<1, 2, 4>
      • int-mask-of<MyClass::CLASS_CONSTANT_*>
      • class-string and class-string<Foo>
      • trait-string
      • enum-string
      • callable-string
      • numeric-string
      • literal-string
      • literal-int
      • array-key
      • numeric
      • scalar
    • Object types
      • object
      • object{foo: string}
      • Exception, Foo\MyClass and Foo\MyClass<Bar>
      • Generator
    • Array types
      • array<int, string>
      • non-empty-array
      • string[]
      • list & non-empty-list
      • list<string>
      • array{foo: int, bar: string} and list{int, string}
      • callable-array
    • Callable types
    • Value types
      • null
      • true, false
      • 6, 7.0, "forty-two" and 'forty two'
      • Foo\Bar::MY_SCALAR_CONST
    • Utility types
      • (T is true ? string : bool)
      • key-of<T>
      • value-of<T>
      • properties-of<T>
      • class-string-map<T of Foo, T>
      • T[K]
      • Type aliases
      • Variable templates
    • Other types
      • iterable<TKey, TValue>
      • void
      • resource
      • closed-resource
    • Top and bottom types
      • mixed
      • never
    Previous Union Types
    Next Intersection Types
    powered by MkDocs and Material for MkDocs