Commit ed2cde1
committed
Mark
This will highlight unused code.
Ref: php/php-src#5412
Ref: https://wiki.php.net/rfc/make-reflection-setaccessible-no-op
Ref: php/php-src#5411
Example https://3v4l.org/PNeeZ
```php
<?php
class Foo {
private $bar = 'baz';
private function taz() { return 'waz'; }
}
//var_dump((new ReflectionProperty(Foo::class, 'bar'))->getValue(new Foo));
//var_dump((new ReflectionMethod(Foo::class, 'taz'))->invoke(new Foo));
```
Produces (starting from PHP 8.1):
```
string(3) "baz"
string(3) "waz"
```Reflection(Method|Property)#setAccessible() as pure starting from PHP 8.1 onwards1 parent 93c5df6 commit ed2cde1
1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
34 | 54 | | |
35 | 55 | | |
36 | 56 | | |
| |||
0 commit comments