com php-langspec: V7 Add the new predefined class types: spec/14-classes.md
[email protected] (Stanislav Malyshev) Wed, 16 Dec 2015 15:02:28 +0000
| Newsgroups | php.standards.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: a9241b28db549639df01097e9fad69ad80cc3d78 Author: Rex Jaeschke <[email protected]> Thu, 10 Dec 2015 12:33:50 -0500 Committer: Joel Marcey <[email protected]> Wed, 16 Dec 2015 07:02:28 -0800 Parents: ee3934dc2757e3dc62c0e2b865fddbd6512673d0 Branches: master Link: http://git.php.net/?p=php-langspec.git;a=commitdiff;h=a9241b28db549639df01097e9fad69ad80cc3d78 Log: V7 Add the new predefined class types Changed paths: M spec/14-classes.md Diff: diff --git a/spec/14-classes.md b/spec/14-classes.md index ce80c52..eebda61 100644 --- a/spec/14-classes.md +++ b/spec/14-classes.md @@ -1803,6 +1803,34 @@ $v = unserialize($s); ##Predefined Classes +###Class `ArithmeticError` + +An instance of this class is thrown when an error occurs during certain mathematical operations. It is defined, as follows: + +```PHP +class ArithmeticError extends Error +{ +} +``` + +**Defined elsewhere** + +* [`Error`](14-classes.md#class-error) + +###Class `AssertionError` + +An instance of this class is thrown when an assertion made via the intrinsic `assert` fails. The class type is defined, as follows: + +```PHP +class AssertionError extends Error +{ +} +``` + +**Defined elsewhere** + +* [`Error`](14-classes.md#class-error) + ### Class `Closure` The predefined class [`Closure`](http://php.net/manual/class.closure.php) is used @@ -1913,6 +1941,34 @@ case, the `Closure` object is empty. Closure objects can not be serialized or unserialized. +###Class `DivisionByZeroError` + +An instance of this class is thrown when an attempt is made to divide a number by zero using the remainder operators ([`%`](10-expressions.md#multiplicative-operators) and [`%=`](10-expressions.md#compound-assignment)). The class type is defined, as follows: + +```PHP +class DivisionByZeroError extends Error +{ +} +``` + +**Defined elsewhere** + +* [`Error`](14-classes.md#class-error) + +###Class `Error` + +This class is the base class for all internal PHP error exceptions. It is defined, as follows: + +```PHP +class Error implements Throwable +{ +} +``` + +**Defined elsewhere** + +* [`Throwable`](15-interfaces.md#interface-throwable) + ###Class `Generator` This class supports the [`yield` operator](10-expressions.md#yield-operator). This class cannot be @@ -1945,6 +2001,20 @@ Name | Purpose Generator objects can not be serialized or unserialized. +###Class `ParseError` + +An instance of this class is thrown when an error occurs while parsing PHP code (such as when calling the intrinsic [`eval`](10-expressions.md#eval)). It is defined, as follows: + +```PHP +class ParseError extends Error +{ +} +``` + +**Defined elsewhere** + +* [`Error`](14-classes.md#class-error) + ###Class `__PHP_Incomplete_Class` There are certain circumstances in which a program can generate an @@ -1994,4 +2064,22 @@ base class. An instance of this type is automatically created when a non-object is [converted to an object](08-conversions.md#converting-to-object-type), or the [member selection operator](10-expressions.md#member-selection-operator) is applied to `NULL`, `FALSE`, or an empty string. +###Class `TypeError` + +An instance of this class is thrown when any of the following occurs: + + * The type of an argument being passed to a function does not match its corresponding parameter’s declared type. + * The type of the value being returned from a function does not match the function’s declared return type. + * In [strict mode](13-functions.md#type-check-modes), an invalid number of arguments are passed to a library function. + +The class is defined, as follows: + +```PHP +class TypeError extends Error +{ +} +``` + +**Defined elsewhere** +* [`Error`](14-classes.md#class-error)