From 7bfe2d393010576646cacf4df5bd640292a2f14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Rumi=C5=84ski?= Date: Wed, 20 Aug 2025 22:39:54 +0200 Subject: [PATCH 1/2] Deprecation notice --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fecdd10..4e2a477 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ +# 💀 Deprecation notice + +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: +```php +$bar = \Closure::bind(static fn ($object): string => $object->bar, null, Foo::class)($object); +``` + # AccessibleObject `AccessibleObject` is small class allowing you to easily access internals of any object. @@ -10,12 +18,12 @@ While we strongly discourage you to using it, it may be helpful in debugging or bar; // PHP Fatal error: Uncaught Error: Cannot access private property Foo::$bar +$bar = $object->bar; // PHP Fatal error: Uncaught Error: Cannot access private property Foo::$bar $accessibleObject = new AccessibleObject($object); -echo $accessibleObject->bar; // 'baz' +$bar = $accessibleObject->bar; // 'baz' ``` From 6445bb6902189e225cbd4a649ca20deb4fcfad34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Rumi=C5=84ski?= Date: Fri, 12 Sep 2025 13:30:13 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e2a477..7341512 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ 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: ```php -$bar = \Closure::bind(static fn ($object): string => $object->bar, null, Foo::class)($object); +$bar = \Closure::bind(static fn (Foo $object): string => $object->bar, null, Foo::class)($object); ``` # AccessibleObject