PHP: Hypertext Preprocessor (original) (raw)
(PHP 7, PHP 8)
Introduction
A TypeError may be thrown when:
- The value being set for a class property does not match the property's corresponding declared type.
- The argument type being passed to a function does not match its corresponding declared parameter type.
- A value being returned from a function does not match the declared function return type.
Class synopsis
class **TypeError extends Error {
/* Inherited properties */
/* Inherited methods */
}
Changelog
Version | Description |
---|---|
7.1.0 | In strict mode, passing an incorrect number of arguments to a built-in PHP function no longer results in a generic TypeError. Instead, a more specific ArgumentCountError, which extends TypeError, is thrown. |