rfc:make-reflection-setaccessible-no-op

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:make-reflection-setaccessible-no-op [2021/06/13 16:24] ocramiusrfc:make-reflection-setaccessible-no-op [2021/07/07 14:01] – Close vote - unanimous approval with 31 votes **for** this RFC to be adopted ocramius
Line 1: Line 1:
-====== PHP RFC: #[Deprecated] Attribute ======+====== PHP RFC: Make reflection setAccessible() no-op ======
  
   * Version: 1.0   * Version: 1.0
   * Date: 2021-06-13   * Date: 2021-06-13
   * Author: Marco Pivetta    * Author: Marco Pivetta 
-  * Status: Draft+  * Status: Accepted
   * First Published at: https://wiki.php.net/rfc/make-reflection-setaccessible-no-op   * First Published at: https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
  
Line 78: Line 78:
   * make `ReflectionProperty` and `ReflectionMethod` behave as if `#setAccessible(true)` had been called upfront   * make `ReflectionProperty` and `ReflectionMethod` behave as if `#setAccessible(true)` had been called upfront
   * make `ReflectionProperty#setAccessible()` and `ReflectionMethod#setAccessible()` no-op operations, with no side-effects nor state mutation involved   * make `ReflectionProperty#setAccessible()` and `ReflectionMethod#setAccessible()` no-op operations, with no side-effects nor state mutation involved
 +
 +After the RFC is successfully accepted/implemented, the following code should no longer throw, improving therefore the ergonomics around reflection.
 +
 +<code php>
 +class Foo { private $bar = 'a'; }
 +
 +(new ReflectionProperty(Foo::class, 'bar'))->getValue();
 +</code>
 +
  
  
Line 96: Line 105:
   * `ReflectionMethod#invoke()` will no longer throw an exception when used against a protected/private method   * `ReflectionMethod#invoke()` will no longer throw an exception when used against a protected/private method
   * `ReflectionMethod#invokeArgs()` will no longer throw an exception when used against a protected/private method   * `ReflectionMethod#invokeArgs()` will no longer throw an exception when used against a protected/private method
 +  * for extensions developers, `reflection_object->ignore_visibility` no longer exists
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
Line 126: Line 136:
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
  
-Accept turning `ReflectionProperty#setAccessible()` and `ReflectionMethod#setAccessible()` into a no-op?+Accept turning `ReflectionProperty#setAccessible()` and `ReflectionMethod#setAccessible()` into a no-op? (yes/no)
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
Line 132: Line 142:
 https://github.com/php/php-src/pull/5412 https://github.com/php/php-src/pull/5412
  
 +
 +===== Vote =====
 +
 +This is a Yes/No vote, requiring a 2/3 majority. Voting started on 2021-06-23 and ends on 2021-07-07.
 +
 +<doodle title="Make reflection setAccessible() no-op" auth="ocramius" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
rfc/make-reflection-setaccessible-no-op.txt · Last modified: 2021/07/08 08:57 by nikic