Skip to content
Simple trait to make your class strict, when calling or accessing undefined member (property or method).
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Simple set of traits to make your classes strict, when calling or accessing an undefined member (property or method).

Build Status Downloads this Month Latest stable Coverage Status

This library is heavily inspired by Nette\ObjectMixin.


The best way to install Kdyby/StrictObjects is using Composer:

composer require kdyby/strict-objects


Simply include the trait in your class and it will behave strictly!

use Kdyby\StrictObjects\Scream;

class MyClass
    use Scream;

    // my code

If you for some reason can't or don't want to make all undefined property and method access strict, you can enable the behavior selectively by using specific traits:

  • Kdyby\StrictObjects\PropertyReadScreamer: Will throw when attempting to read an undeclared property.
  • Kdyby\StrictObjects\PropertyWriteScreamer: Will throw when attempting to write to an undeclared property.
  • Kdyby\StrictObjects\PropertyExistsScreamer: Will throw when attempting to check existence of an undeclared property.
  • Kdyby\StrictObjects\PropertyRemovalScreamer: Will throw when attempting to unset an undeclared property.
  • Kdyby\StrictObjects\InstanceMethodCallScreamer: Will throw when attempting to call an undefined instance method.
  • Kdyby\StrictObjects\StaticMethodCallScreamer: Will throw when attempting to call an undefined static method.

For convenience, there are also:

  • Kdyby\StrictObjects\PropertyScreamer: Combines all property access, will throw on any interaction.
  • Kdyby\StrictObjects\MethodCallScreamer: Combines both method call types, will throw for all methods.
  • Kdyby\StrictObjects\Scream combines all screamers into one.

Homepage and repository

You can’t perform that action at this time.