com php-langspec: V7 Update Exception to implement Throwable: spec/17-exception-handling.md
[email protected] (Stanislav Malyshev) Wed, 09 Dec 2015 23:23:33 +0000
| Newsgroups | php.standards.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: a907a1a600f98d1549ca6053c8333f44d1792454 Author: Rex Jaeschke <[email protected]> Wed, 9 Dec 2015 18:23:33 -0500 Parents: ee3934dc2757e3dc62c0e2b865fddbd6512673d0 Branches: master Link: http://git.php.net/?p=php-langspec.git;a=commitdiff;h=a907a1a600f98d1549ca6053c8333f44d1792454 Log: V7 Update Exception to implement Throwable Changed paths: M spec/17-exception-handling.md Diff: diff --git a/spec/17-exception-handling.md b/spec/17-exception-handling.md index 68be578..90452ef 100644 --- a/spec/17-exception-handling.md +++ b/spec/17-exception-handling.md @@ -48,12 +48,8 @@ Class `Exception` is the base class of all exception types. This class is defined, as follows: ```PHP -Class Exception +Class Exception implements Throwable { - private $string; - private $trace; - private $previous; - protected $message = 'Unknown exception'; protected $code = 0; protected $file; @@ -63,20 +59,13 @@ Class Exception Exception $previous = NULL); final private function __clone(); - - final public function getMessage(); - final public function getCode(); - final public function getFile(); - final public function getLine(); - final public function getTrace(); - final public function getPrevious(); - final public function getTraceAsString(); - public function __toString(); } ``` For information about exception trace-back and nested exceptions, see [tracing exceptions](#tracing-exceptions). +For information about the base interface, see [Throwable](15-interfaces.md#interface-Throwable). + The class members are defined below: Name | Purpose @@ -85,19 +74,8 @@ Name | Purpose `$file` | `string`; the name of the script where the exception was generated `$line` | `int`; the source line number in the script where the exception was generated `$message` | `string`; the exception message (as provided by the constructor) -`$previous` | The previous exception in the chain, if this is a nested exception; otherwise, `NULL` -`$string` | Work area for `__toString` -`$trace` | Work area for function-call tracing `__construct` | Takes three (optional) arguments – `string`: the exception message (defaults to ""), `int`: the exception code (defaults to 0), and `Exception`: the previous exception in the chain (defaults to `NULL`) `__clone` | Present to inhibit the cloning of exception objects -`__toString` | `string`; retrieves a string representation of the exception in some unspecified format -`getCode` | `mixed`; retrieves the exception code (as set by the constructor). For an exception of type Exception, the returned value has type int; for subclasses of `Exception`, it may have some other type. -`getFile` | `string`; retrieves the name of the script where the exception was generated -`getLine` | `int`; retrieves the source line number in the script where the exception was generated -`getMessage` | `string`; retrieves the exception message -`getPrevious` | `Exception`; retrieves the previous exception (as set by the constructor), if one exists; otherwise, `NULL` -`getTrace` | `array`; retrieves the function [stack trace information](#tracing-exceptions) as an array -`getTraceAsString` | `string`; retrieves the function stack trace information formatted as a single string in some unspecified format ##Tracing Exceptions