php-cs-fixer/accessible-object
最新稳定版本:v1.2.0
Composer 安装命令:
composer require php-cs-fixer/accessible-object
包简介
A library to reveal object internals.
README 文档
README
Accessing internals using this package makes it difficult for your IDE/SCA tools to track types properly. If you need to access internals, consider the following alternative:
$bar = \Closure::bind(static fn (Foo $object): string => $object->bar, null, Foo::class)($object);
AccessibleObject
AccessibleObject is small class allowing you to easily access internals of any object.
In general, it's bad practice to do so.
While we strongly discourage you to using it, it may be helpful in debugging or testing old, sad, legacy projects.
Example
<?php class Foo { private string $bar = 'baz'; } $object = new Foo(); $bar = $object->bar; // PHP Fatal error: Uncaught Error: Cannot access private property Foo::$bar $accessibleObject = new AccessibleObject($object); $bar = $accessibleObject->bar; // 'baz'
统计信息
- 总下载量: 552.27k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 1
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-07