rfc:stack-frame-class

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
rfc:stack-frame-class [2020/07/09 06:48]
brzuchal added info on getTrace arguments and new methods and properties
rfc:stack-frame-class [2020/07/21 15:55]
brzuchal
Line 1: Line 1:
 ====== PHP RFC: StackFrame class ====== ====== PHP RFC: StackFrame class ======
-  * Version: 0.9+  * Version: 1.2
   * Date: 2020-07-07   * Date: 2020-07-07
   * Author: Michał Marcin Brzuchalski, <brzuchal@php.net>   * Author: Michał Marcin Brzuchalski, <brzuchal@php.net>
-  * Status: Under Discussion+  * Status: Voting
   * Target Version: PHP 8.0   * Target Version: PHP 8.0
   * First Published at: http://wiki.php.net/rfc/stack-frame-class   * First Published at: http://wiki.php.net/rfc/stack-frame-class
Line 18: Line 18:
 ==== StackFrame class ==== ==== StackFrame class ====
  
-''StackFrame'' class provides properties and methods which mirrors information from ''debug_backtrace()''.+''StackFrame'' class provides properties which mirrors information from ''debug_backtrace()''.
  
 There are additional properties and methods which expose additional information: There are additional properties and methods which expose additional information:
  
-  * property ''object_class'' and ''getObjectClass(): ?string'' method which exposes object class which is useful when ''$option'' passed without ''DEBUG_BACKTRACE_PROVIDE_OBJECT'' flag; +  * property ''object_class'' exposes object class which is useful when ''$option'' passed without ''DEBUG_BACKTRACE_PROVIDE_OBJECT'' flag; 
-  * property ''closure'' and ''getClosure(): ?\Closure'' method which exposes a closure within the frame was produced upon.+  * property ''closure'' exposes a closure within the frame was produced upon.
  
 <code php> <code php>
 final class StackFrame implements ArrayAccess final class StackFrame implements ArrayAccess
 { {
-    public readonly string $file;+    public ?string $file;
          
-    public readonly int $line;+    public ?int $line;
          
-    public readonly ?string $function;+    public ?string $function;
          
-    public readonly ?string $class;+    public ?string $class;
          
-    public readonly ?object $object;+    public ?object $object;
  
-    public readonly ?string $object_class;+    public ?string $objectClass;
  
-    public readonly ?\Closure $closure;+    public ?string $type; 
 + 
 +    public ?\Closure $closure;
          
-    public readonly array $args;+    public array $args = [];
          
     public static function getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0): array {}     public static function getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0): array {}
- 
-    public function getFile(): string {} 
- 
-    public function getLine(): int {} 
- 
-    public function getFunction(): ?string {} 
- 
-    public function getClass(): ?string {} 
- 
-    public function getObject(): ?object {} 
-     
-    public function getObjectClass(): ?string {} 
- 
-    public function getClosure(): ?\Closure {} 
- 
-    public function getType(): ?string {} 
- 
-    public function getArgs(): array {} 
 } }
 </code> </code>
Line 114: Line 98:
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
-As this is a language in exception handling mechanism it requires 2/3 accepted.+As this is a change in exception handling mechanism it requires 2/3 accepted.
  
 The vote will be a simple Yes/No for ''StackFrame'' inclusion and second vote a simple Yes/No for exception trace replacement. The vote will be a simple Yes/No for ''StackFrame'' inclusion and second vote a simple Yes/No for exception trace replacement.
 +
 +===== Vote =====
 +Voting opened 2020-07-21 and closes 2020-08-04.
 +
 +<doodle title="Add object-based debug_backtrace() alternative?" auth="brzuchal" voteType="single" closed="false">
 +   * Yes
 +   * No
 +</doodle>
 +
 +''''
 +
 +<doodle title="Replace object-based trace for Throwable::getTrace()?" auth="brzuchal" voteType="single" closed="false">
 +   * Yes
 +   * No
 +</doodle>
  
 ===== Implementation ===== ===== Implementation =====
   * [[https://github.com/php/php-src/pull/5820|PR]]   * [[https://github.com/php/php-src/pull/5820|PR]]
rfc/stack-frame-class.txt · Last modified: 2020/08/04 08:00 by brzuchal