Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » commas first(Set formatter or config file to allow for 'comma first' coding style)
commas first [message #1239262] Mon, 03 February 2014 20:00 Go to next message
Steve Browning is currently offline Steve BrowningFriend
Messages: 1
Registered: February 2014
Junior Member
Hi,

I've googled and did not find anything regarding the 'comma first' formatting for Elcipse PHP formatter.

As an example long method parameter lists with an anonymous function as a parameter are hard to read:

$o_criterion->page_types = array_values( array_filter( $a_item [ 'criteria' ] [ 'page_types' ] [ $j ], function ( $s_page_type ) use($a_page_types ) {
     return array_key_exists( $s_page_type, $a_page_types );
} ) );


Is hard to read, with the PHP formatter options can auto format this like:

$o_criterion->page_types = array_values( 
     array_filter( 
         $a_item [ 'criteria' ] [ 'page_types' ] [ $j ], 
         function ( $s_page_type ) use( $a_page_types ) {
             return array_key_exists( 
                $s_page_type, 
                $a_page_types 
             );
         } 
    ) 
);


However for easier debugging and ability to add / remove additional parameters I like to use the 'comma first' formatting; so would like that same block like:

$o_criterion->page_types = array_values( 
     array_filter( 
         $a_item [ 'criteria' ] [ 'page_types' ] [ $j ]
         , function ( $s_page_type ) use( $a_page_types ) {
             return array_key_exists( 
                $s_page_type 
                , $a_page_types 
             );
         } 
    ) 
);


Or an array like

$codes = [
            'one'
            , 'two'
            , $code
            , get_sub_id()
]


Does anyone know how or if the formatter can be setup to format like this?

Regards,
Steve
Re: commas first [message #1239445 is a reply to message #1239262] Tue, 04 February 2014 08:07 Go to previous message
Toshihiro Izumi is currently offline Toshihiro IzumiFriend
Messages: 360
Registered: July 2009
Location: Japan
Senior Member
Since there is no such option(internal code) in the formatter, it is impossible.
Previous Topic:Error with the documentation box?
Next Topic:Can't Install PDT on kepler 20130919-0819
Goto Forum:
  


Current Time: Fri Apr 26 07:23:35 GMT 2024

Powered by FUDForum. Page generated in 0.02928 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top