Report a bug!

PHP source formatting kills readabilty

2 times applied source formatting makes PHP code difficult to read. There is example of problem. Original PHP code looks like this:

class ExampleClass {

private function brokenFormatting() {
print("anything");
}


private function anotherMethod() {
print("anything");
}

}

After first source formatting it changes to this:

class ExampleClass {

private
function brokenFormatting() {
print( "anything" );
}

private
function anotherMethod() {
print( "anything" );
}

It looks awful but it is still readable, Notice that "private" keyword should not be in another line with function. I makes potential risk of loosing "private" when the method is copied. The situation gets worst after second code formatting:

class ExampleClass {

private

function brokenFormatting() {
print( "anything" );
}

private

function anotherMethod() {
print( "anything" );
}

}

Now "private" is isolated from class method. It is easy to make mistakes when new method is created under "private" keyword. In this case the new method will become private and method below will lose its privacy.

Another consequence of source formatting is difficulty of reading the code. There is a lot of space between "private" keyword and method name. It gets hard to find that method is private.

2 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Marek shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    UNDER REVIEW  ·  Adminkragarwa (Admin, Adobe Dreamweaver) responded  · 

    Hi,

    Thanks for reporting the issue.
    We have logged an internal bug for this issue and tracking it.
    We will update you once the bug is fixed.

    Thanks
    Kratika
    Dreamweaver Team

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base