Last Updated: February 25, 2016
·
732
· sanguis

Don't manage the semi collin

when i am working on php classes some times I need to run multiple
class::functions on an object.

$query = new SysbioEntityFieldQuery();
    $query
      ->entityCondition('bundle', 'event')
      ->fieldCondition('field_event_type', 'tid', 'NULL', '!=')
      ->addTag('debug');

What if I need to add a function? I can just add it to the end w/o moving the semi colln, and this is constanly causeing me an extrea few keystrokes of debugging.

$query = new SysbioEntityFieldQuery();
    $query
      ->entityCondition('bundle', 'event')
      ->fieldCondition('field_event_type', 'tid', 'NULL', '!=')
      ->addTag('debug'); //declartions ends
      ->addTag('distinct') // error

So intead I have just moved the semi colin to its own line and I never have to waste that time again.

$query = new SysbioEntityFieldQuery();
$query
  ->entityCondition('bundle', 'event')
  ->fieldCondition('field_event_type', 'tid', 'NULL', '!=')
  ->addTag('debug')
  ->addTag('distinct')
  ;

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside