Page MenuHomePhorge

Deprecate id() function: no longer necessary since PHP 5.4.0
Open, WishlistPublic

Description

The id() function is syntax sugar that returns the first argument as-is for PHP 5.4.0 that explodes with this:

(new ClassName())
  ->method();

So, there is no need to do this anymore I guess, since it adds extra overhead:

id(new ClassName())
  ->method();

We can at least avoid to introduce id() on new code in the first phase.

Event Timeline

valerio.bozzolan triaged this task as Wishlist priority.
valerio.bozzolan created this object in space S1 Public.

grep -r " id(" --include=*.php . | wc -l gives a whopping 11220 results.
Would we accept a patch if I cooked up one? :)

Note that (clone $foo)->bar() is still invalid so you need to use id(clone $foo)->bar().

Would we accept a patch if I cooked up one? :)

Probably better to split this into multiple patches instead of doing one massive patch :-P