rfc:stack-frame-class
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:stack-frame-class [2020/07/07 19:49] – brzuchal | rfc:stack-frame-class [2020/08/04 08:00] (current) – change status to declined brzuchal | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: StackFrame class ====== | ====== PHP RFC: StackFrame class ====== | ||
- | * Version: | + | * Version: |
* Date: 2020-07-07 | * Date: 2020-07-07 | ||
- | * Author: Michał Brzuchalski, | + | * Author: Michał |
- | * Status: | + | * Status: |
+ | * Target Version: PHP 8.0 | ||
* First Published at: http:// | * First Published at: http:// | ||
+ | * Implementation: | ||
+ | ===== Introduction ===== | ||
The '' | The '' | ||
- | |||
- | ===== Introduction ===== | ||
- | ... | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | Introduce new '' | + | Introduce new '' |
- | array of '' | + | |
- | '' | + | There are two places where this could be a replacement for retrieving trace in array of arrays way and these are '' |
+ | |||
+ | ==== StackFrame class ==== | ||
+ | |||
+ | '' | ||
+ | |||
+ | There are additional properties and methods which expose additional information: | ||
+ | |||
+ | * property '' | ||
+ | * property '' | ||
<code php> | <code php> | ||
- | final class StackFrame | + | final class StackFrame |
{ | { | ||
- | public | + | public |
- | public | + | |
- | public | + | public |
- | public | + | |
- | public readonly ?object $object; | + | public ?string $function; |
- | public readonly array $args; | + | |
+ | public ?string $class; | ||
| | ||
- | public | + | public |
- | public | + | public |
- | public | + | public |
- | public | + | public ?\Closure $closure; |
- | + | ||
- | public function | + | public |
+ | |||
+ | public static | ||
+ | } | ||
+ | </ | ||
- | public function getObject(): ?object {} | + | ==== Example ==== |
+ | An example below shows exactly the same portion of information as if it would call '' | ||
- | public | + | <code php> |
- | + | function | |
- | | + | |
} | } | ||
+ | $frame = frames()[0]; | ||
+ | |||
+ | var_dump([ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ]); | ||
</ | </ | ||
+ | |||
+ | ==== Performance ==== | ||
+ | On a test script with 1M recursions to produce huge result results were as above: | ||
+ | |||
+ | - '' | ||
+ | - '' | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 63: | Line 94: | ||
==== New Constants ==== | ==== New Constants ==== | ||
- | Not yet. | + | None. |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | As this is a language | + | As this is a change |
The vote will be a simple Yes/No for '' | The vote will be a simple Yes/No for '' | ||
+ | |||
+ | ===== Vote ===== | ||
+ | Voting opened 2020-07-21 and closes 2020-08-04. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | '''' | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | ... | + | * [[https:// |
rfc/stack-frame-class.1594151368.txt.gz · Last modified: 2020/07/07 19:49 by brzuchal