Sometimes, readers submit code and say, "every line is wrong!" Usually, they mean that every line contains a bad choice, or represents a bad way of accomplishing the program's goal, or there's a series of compounding mistakes.
David sends us a block which… well, yes, every line is wrong, because every line contradicts every other one.
/**
* gets instance of Product Status object
*
* @return object Warehouse Supplier object
*/
function __construct() {
$this->_price = new OrderValidator();
}
The only thing "correct" about this is that PHP does have you name your constructor __construct
. Ignoring that, between the comment and the one line of executable code, not a single thing agrees with anything else. I'd suspect that this was progamming by copy/paste, but I feel like that'd be more coherent. It might be really bad AI generated code, but David assures us that this was written by an actual human.

This post originally appeared on The Daily WTF.