| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* Squiz_Sniffs_Formatting_MultipleStatementAlignmentSniff.
|
|
|
4 |
*
|
|
|
5 |
* PHP version 5
|
|
|
6 |
*
|
|
|
7 |
* @category PHP
|
|
|
8 |
* @package PHP_CodeSniffer
|
|
|
9 |
* @author Greg Sherwood <gsherwood@squiz.net>
|
|
|
10 |
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
|
11 |
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
|
|
|
12 |
* @version CVS: $Id: MultipleStatementAlignmentSniff.php 270193 2008-12-01 02:29:14Z squiz $
|
|
|
13 |
* @link http://pear.php.net/package/PHP_CodeSniffer
|
|
|
14 |
*/
|
|
|
15 |
|
|
|
16 |
if (class_exists('Generic_Sniffs_Formatting_MultipleStatementAlignmentSniff', true) === false) {
|
|
|
17 |
throw new PHP_CodeSniffer_Exception('Class Generic_Sniffs_Formatting_MultipleStatementAlignmentSniff not found');
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* Squiz_Sniffs_Formatting_MultipleStatementAlignmentSniff.
|
|
|
22 |
*
|
|
|
23 |
* Checks alignment of assignments. If there are multiple adjacent assignments,
|
|
|
24 |
* it will check that the equals signs of each assignment are aligned. It will
|
|
|
25 |
* display a warning to advise that the signs should be aligned.
|
|
|
26 |
*
|
|
|
27 |
* @category PHP
|
|
|
28 |
* @package PHP_CodeSniffer
|
|
|
29 |
* @author Greg Sherwood <gsherwood@squiz.net>
|
|
|
30 |
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
|
31 |
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
|
|
|
32 |
* @version Release: 1.2.1
|
|
|
33 |
* @link http://pear.php.net/package/PHP_CodeSniffer
|
|
|
34 |
*/
|
|
|
35 |
class Squiz_Sniffs_Formatting_MultipleStatementAlignmentSniff extends Generic_Sniffs_Formatting_MultipleStatementAlignmentSniff
|
|
|
36 |
{
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* The maximum amount of padding before the alignment is ignored.
|
|
|
40 |
*
|
|
|
41 |
* If the amount of padding required to align this assignment with the
|
|
|
42 |
* surrounding assignments exceeds this number, the assignment will be
|
|
|
43 |
* ignored and no errors or warnings will be thrown.
|
|
|
44 |
*
|
|
|
45 |
* @var int
|
|
|
46 |
*/
|
|
|
47 |
protected $maxPadding = 8;
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
* If true, multi-line assignments are not checked.
|
|
|
51 |
*
|
|
|
52 |
* @var int
|
|
|
53 |
*/
|
|
|
54 |
protected $ignoreMultiLine = true;
|
|
|
55 |
|
|
|
56 |
/**
|
|
|
57 |
* If true, an error will be thrown; otherwise a warning.
|
|
|
58 |
*
|
|
|
59 |
* @var bool
|
|
|
60 |
*/
|
|
|
61 |
protected $error = true;
|
|
|
62 |
|
|
|
63 |
}//end class
|
|
|
64 |
|
|
|
65 |
?>
|