php-cs-fixer/accessible-object

A library to reveal object internals.

Installs: 405 023

Dependents: 7

Suggesters: 0

Security: 0

Stars: 11

Watchers: 6

Forks: 0

Open Issues: 0

Type:application

v1.1.0 2020-10-23 16:25 UTC

This package is auto-updated.

Last update: 2024-10-24 00:57:22 UTC


README

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 $bar = 'baz';
}

$object = new Foo();
echo $object->bar; // PHP Fatal error:  Uncaught Error: Cannot access private property Foo::$bar

$accessibleObject = new AccessibleObject($object);
echo $accessibleObject->bar; // 'baz'