Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface SomeObjectInterface
- {
- public function create(): ?SomeObject;
- public function action();
- }
- class SomeObject implements SomeObjectInterface
- {
- ...
- }
- $object = new SomeObject;
- //Тут что-то пошло не так и вместо объекта вернулся null.
- $initializedObject = $object->create();
- //Fatal error: Uncaught Error: Call to a member function action() on null
- $initializedObject->action();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement