title: PHP coding standards at work: Insane, or am I?
body: <p>I prefer coding standards to be logical. This is my argument for why the following set of standards are not.
  <br /><br />
   <strong>I need to know one of two things: (1) why I'm wrong, or (2) how to convince my team to change them</strong>.</p>
  
  <p><br />
  <strong>camelCase: Functions, class names, methods, and variables must be camelCase.</strong></p>
  
  <ul>
  <li>Makes it hard to differentiate between variables and classes</li>
  <li>Goes against PHP's lowercase/underscored variables/functions and UpperCamelCase classes</li>
  </ul>
  
  <p>Example:</p>
  
  <pre><code>$customerServiceBillingInstance = new customerServiceBillingInstance(); // theirs
  $customer_service_billing_instance = new CustomerServiceBillingInstance();
  </code></pre>
  
  <p><br />
  <strong>Functions/methods must always return a value (and returned values must always be stored).</strong></p>
  
  <p>This appears on hundreds of our php pages:</p>
  
  <pre><code>$equipmentList = new equipmentList();
  $success = $equipmentList-&gt;loadFromDatabase(true, '');
  $success = $equipmentList-&gt;setCustomerList();
  $success = $equipmentList-&gt;setServerList();
  $success = $equipmentList-&gt;setObjectList();
  $success = $equipmentList-&gt;setOwnerList();
  $success = $equipmentList-&gt;setAccessList();
  </code></pre>
  
  <p>The return value is rarely used but always stored. It encourages the use of copy-and-paste.</p>
  
  <p><br />
  <strong>No static methods</strong></p>
  
  <p>Lines like the following appear thousands of times in the codebase:</p>
  
  <pre><code>$equipmentList = new equipmentList();
  $success = $equipmentList-&gt;loadFromDatabase();
  </code></pre>
  
  <p>I would prefer:</p>
  
  <pre><code>$equipmentList = equipmentList::load();
  </code></pre>
  
  <p>What reason is there to not use static methods or properties? Aren't static methods responsible for non-instance-specific logic? Like initializing or populating a new instance?</p>
  
  <p><br />
  <strong>Your code is not OOP unless everything returns an object</strong></p>
  
  <p>There's a piece of code that performs a query, checks it several ways for errors, and then processes the resulting array. It is repeated (copied+pasted) several times, so I put it in the base class. Then I was told returning an array is not OOP.</p>
  
  <p><br />
  <strong>How do you defend these practices?</strong> I really do need to know. I feel like I'm taking crazy pills.</p>
  
  <p><strong>If you can't defend them,</strong> how do you convince the adamant author they need to be changed?</p>