简体   繁体   中英

String concatenation compliant with Symfony2 coding style standard

How could I write a long string like the following to be Symfony2 CS standard compliant?

$str = 'A very long line that' .
    'spans in multiple lines';

Now I'm getting a "Concat operator must not be surrounded by spaces" error. Any suggestion on this?

Consider using something like that:

$str  = 'A very long line that';
$str .= 'spans in multiple lines';

https://github.com/squizlabs/PHP_CodeSniffer/issues/651

<rule ref="Squiz.Strings.ConcatenationSpacing">
   <properties>
       <property name="ignoreNewlines" value="1"/>
   </properties>
</rule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM