thePHP.cc Logo Deutsch Contact
mood

Type Safety

A type determines what kind of values a variable can hold. A type system specifies which operations are permitted on these values and how they are performed. Type Safety is classically defined as the extent to which a programming language prevents type errors.

Explicit declaration of types is not required in PHP , but is possible. Programs written in PHP are not compiled ahead-of-time, so type errors are run-time errors. With Psalm and PHPStan , there are very good tools to detect type errors before they can become a problem when executing code.

Matthew Brown, the creator of Psalm, has therefore redefined the concept of type safety as follows: „Type safety measures the ability of available language tooling to help avoid type errors when running code in a production environment.”

Training Type-Safe PHP

Type checking allows many errors to be found before a program is even executed.

More training
Video

A whirlwind tour through the interesting land of programming language design principles.