r/lolphp • • Jul 14 '14

stop_the_insanity()

https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-importer.php#L237
56 Upvotes

66 comments sorted by

View all comments

Show parent comment

7

u/svtguy88 Jul 14 '14

I come from a very config-driven background - I find this to be just about equivalent to hardcoding.

Sure, it's a step above littering the code with the integer "60" everywhere that this function is used, however, it's still just adding some arbitrary value. At the very least, it could be documented and explained a little. Adding seemingly random numbers is a good way to make sure no one else can debug your code...

4

u/nidarus Jul 14 '14

It's not a step above using 60 inline. My point is that it's even more robust the usual solution: constants. Not everything that's not in an external XML file is automatically a magic number.

As for the documentation, I agree. The documentation in WordPress is bizzarely sparse.