|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-05-07 13:28 UTC] di3 at gmx dot net
Description: ------------ add a magic null method for objects (like __toString) to check if object is_null or empty. public function __isNull() return true or false many using null objects to get a secure returnvalue would be nice a object representate null is comparable. same for empty PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 11:00:01 2025 UTC |
i agree its related to te other requests you found. the boolean representation wod work too. i' m just missing a empty representation for a object usecase is nullobject design returning a magic null object with nested method calls class nullObject { public function __isNull() { return true; } public function __call($a,$b) { return $this } } class mapper { public function find($x) { ...some thing else return new nullObject; } } ... if ($mapper->find(..)->getUser()->getGroup() === null .. so i want to call null as object or call a object which represent null. if i call a method on null there should be a result null for that call too same as int bool array why is there only toString