This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 181207

Summary: Better support for fluent interfaces
Product: php Reporter: berdir <berdir>
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: NEW ---    
Severity: normal CC: amobilia
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description berdir 2010-02-25 08:03:17 UTC
Fluent interfaces (http://en.wikipedia.org/wiki/Fluent_interface#PHP) are often formatted by placing each method call on a new line.

Currently, when you have such an interface and hit [Enter] to go the the next line, the curser jumps to a strange position:

----
    db_delete('comment')
      ->condition('cid', array_keys($comments), 'IN')
            | (<-- after Enter, curser is here)
---

Especially in Drupal with the new OOP DB Abstraction layer, code like the above example will become more and more popular, it would be great if the curser would jump to the correct position.

Not that these interfaces might get complexer than the above example.

Some typical ones from common Drupal 7 code:
----- Multi-line array arguments:
$comment->cid = db_insert('comment')
  ->fields(array(
    'nid' => $comment->nid,
    'pid' => empty($comment->pid) ? 0 : $comment->pid,
    'uid' => $comment->uid,
    'subject' => $comment->subject,
    'hostname' => ip_address(),
    'created' => $comment->created,
    'changed' => $comment->changed,
    'status' => $comment->status,
    'thread' => $thread,
    'name' => $comment->name,
    'mail' => $comment->mail,
    'homepage' => $comment->homepage,
    'language' => $comment->language,
  ))
  ->execute();
----- Nested stuff (not necessarly good coding style :) )
$query->condition(db_or()
  ->condition('ur.requester_id', $value)
  ->condition(db_and()
    ->condition(db_or()
      ->condition('ur.approved', 1, '<>')
      ->condition('urt.is_oneway', 0, '<>')
    )
    ->condition('ur.requestee_id', $value)
  )
);

I can provide more examples if you need them, but you can also check the source yourself, for example through the github mirror: http://github.com/drupal/drupal
Comment 1 Filip Zamboj 2010-09-15 12:30:54 UTC
batch reassigning
Comment 2 amobilia 2016-09-22 03:34:40 UTC
Reproductible in 8.2rc / Dev 201609210002