0

I interesting your opinion about code style for separating lines with > 120 symbols. Where should write equal symbol? On the first line or next line?

Example #1

const MY_LONG_LONG_ORIGINAL_CONST_NAME_EXAMPLE =
    'Framework\Framework\Class\Service::execute() : execute are unsupported by the Service class';

Example #2

const MY_LONG_LONG_ORIGINAL_CONST_NAME_EXAMPLE 
    = 'Framework\Framework\Class\Service::execute() : execute are unsupported by the Service class';

I didn’t find rules for it in PSR.

Thank you in advance.

maybe_vp
  • 1
  • 1

1 Answers1

0

In my opinion, you leave it on the same line because it's a string of text. I would break up code on separate lines, but generally don't care what the remaining text in that string is.

If I want to see the text clearly and stay under a 120 limit, then I would break the text in separate lines. I would never split the statement at the =.

const MY_LONG_LONG_ORIGINAL_CONST_NAME_EXAMPLE = 'Framework\Framework\Class\Service'
    . '::execute() : execute are unsupported by the Service class';

As a side note, here's a pretty succinct code style guideline: https://gist.github.com/heiswayi/d93744aadd0acc5aa58f#1-line-length

Erin
  • 5,315
  • 2
  • 20
  • 36