granam / strict-object
Base object, checking access to undefined properties and methods
Installs: 44 806
Dependents: 36
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.3
Requires (Dev)
- granam/exceptions-hierarchy: ~5.0
- phpunit/phpunit: ~9.0
README
A base object, throwing an exception in case of access to undefined property or method.
You deserve to know...
Be lazy. Be smart.
To achieve that, you need to know.
Know about access to an undefined property, to an undefined method.
It can be anything, but at first it is a problem.
And you should be lazy enough to want to know that happened immediately, rather than searching logs after.
Usage
Just extend the object...
use Granam\StrictObject\StrictObject; class Foo extends StrictObject { public $everythingOk = true; // body }
...and your code then immediately stops on mistakes like
// test.php $foo = new Foo(); if (!$foo->everythinkOk) { // Did you noticed the typo? Maybe not, but StrictObject will! }
...which results into PHP Fatal error: Uncaught exception 'ReadingAccess' on line 4 in file test.php Think twice about catching something like that! Remember, you need to know...
Install
composer require granam/strict-object