joomla/joomla-framework — pull request #67 by eirslett (2013-03-05 17:36:51+00:00)
Title: Some improvements to ArrayHelper - enforce the Utility pattern

They are two separate commits - accept both, cherry-pick one of them, or reject it all. ;-)

The first commit refactors ArrayHelper::sortObjects(), by using an anonymous function instead of a separate/protected method. This also removes the protected properties in the class - by looking at the code I guess they were there primarily to get around the limits of earlier PHP versions (no anonymous functions). The scope is reduced and the class is now stateless.

The second commit adds a final modifier to the class, to prevent extension. (I would say an "abstract" modifier *encourages* extension, despite its intention). A private constructor enforces the Utility class pattern.

These commits should help protect ArrayHelper against "abuse".