Re: PHPCS 1.2.0RC2 and standard rules
| From: | Michael Gauthier | Date: | Fri, 03 Jul 2009 03:30:44 +0000 |
| Subject: | Re: PHPCS 1.2.0RC2 and standard rules | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-52302@lists.php.net to get a copy of this message | ||
On 02/07/2009 6:16 PM, Laurent Laville wrote:
With PHP_CodeSniffer 1.2.0RC2, it's impossible to write
if (preg_match_all(
'/^(@[a-zA-Z\-]+)\s+(.+);\s*$/m', $struct, $atRules,
PREG_SET_ORDER)
) {
Or you get
1931 | ERROR | Each line in a multi-line IF statement must begin with a
| | boolean operator
1932 | ERROR | Each line in a multi-line IF statement must begin with a
| | boolean operator
1932 | ERROR | Multi-line function call not indented correctly; expected 12
| | spaces but found 16
1932 | ERROR | Closing parenthesis of a multi-line function call must be
on a
| | line by itself
I've encountered this problem before as well. It's really a problem any time you get a multi-line method or function call in an if block. How about the following proposed syntax:
if (preg_match_all(
'/^(@[a-zA-Z\-]+)\s+(.+);\s*$/m',
$struct,
$atRules,
PREG_SET_ORDER
)
) {
// do stuff} // combined with multiline conditional if ( $foo == 'bar'
&& preg_match_all(
'/^(@[a-zA-Z\-]+)\s+(.+);\s*$/m',
$struct,
$atRules,
PREG_SET_ORDER
)
&& $baz == 'goo'
) {
// do stuff} Regards, Mike