~ubuntu-branches/ubuntu/saucy/php-codesniffer/saucy

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.0.1/CodeSniffer/Standards/Squiz/Tests/Formatting/OperatorBracketUnitTest.inc

  • Committer: Bazaar Package Importer
  • Author(s): Jack Bates
  • Date: 2008-10-01 17:39:43 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081001173943-2dy06n1e8zwyw1o8
Tags: 1.1.0-1
* New upstream release
* Acknowledge NMU, thanks Jan

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
$value = ($one + $two);
3
 
$value = $one + $two;
4
 
 
5
 
$value = ($one - $two);
6
 
$value = $one - $two;
7
 
 
8
 
$value = ($one * $two);
9
 
$value = $one * $two;
10
 
 
11
 
$value = ($one / $two);
12
 
$value = $one / $two;
13
 
 
14
 
$value = ($one % $two);
15
 
$value = $one % $two;
16
 
 
17
 
$value = ($one + $two + $three);
18
 
$value = $one + $two + $three;
19
 
$value = ($one + ($two + $three));
20
 
$value = $one + ($two + $three);
21
 
 
22
 
$value++;
23
 
$value--;
24
 
$value = -1;
25
 
$value = - 1;
26
 
 
27
 
$value = (1 + 2);
28
 
$value = 1 + 2;
29
 
 
30
 
$value = (1 - 2);
31
 
$value = 1 - 2;
32
 
 
33
 
$value = (1 * 2);
34
 
$value = 1 * 2;
35
 
 
36
 
$value = (1 / 2);
37
 
$value = 1 / 2;
38
 
 
39
 
$value = (1 % 2);
40
 
$value = 1 % 2;
41
 
 
42
 
$value = (1 + 2 + 3);
43
 
$value = 1 + 2 + 3;
44
 
$value = (1 + (2 + 3));
45
 
$value = 1 + (2 + 3);
46
 
 
47
 
$value = $one + 2 + 3 - ($four * $five * (6 + 7)) + $nine + 2;
48
 
$value = myFunction($tokens[$stackPtr - 1]);
49
 
 
50
 
for ($i = 1 + 2; $i < 4 + 5; $i++) {
51
 
}
52
 
 
53
 
function myFunction()
54
 
{
55
 
    $value = ($one + 1) + ($two + 2) + (myFunction() + 2);
56
 
    $value = myFunction() + 2;
57
 
    $value = (myFunction($var) + myFunction2($var));
58
 
    return -1;
59
 
}
60
 
 
61
 
$line  = substr($line, 0, -2);
62
 
$words = preg_split('|(\s+)|', $line."\n", -1, $flags);
63
 
if (!isset($this->words[$wordPos-1]) || $this->words[$wordPos-1] !== ' ') {
64
 
} else if ($this->tokens[$pos + 1] === "\n") {
65
 
}
66
 
 
67
 
if ($pos === count($this->tokens) - 1) {
68
 
    $file = '...'.substr($file, (($padding * -1) + 3));
69
 
}
70
 
 
71
 
if (substr($basename, -5) !== 'Sniff') {
72
 
    $i = ($this->_tokens[$i]['parenthesis_closer'] + 1);
73
 
}
74
 
 
75
 
$pos = $this->_getShortCommentEndPos();
76
 
if ($pos === -1) {
77
 
    $stackPtr = ($tokens[$next][$to] - 1);
78
 
    $stackPtr = ($tokens[$next][$pattern[$i]['to']] + 1);
79
 
    $var = (($var1 + $var2) + $var3 + $var4)
80
 
}
81
 
 
82
 
$commentStart = ($phpcsFile->findPrevious(T_DOC_COMMENT, ($commentEnd - 1), null, true) + 1);
83
 
$commentEnd   = ($this->_phpcsFile->findNext(T_DOC_COMMENT, ($commentStart + 1), null, true) - 1);
84
 
$expected    .= '...'.substr($tokens[($stackPtr - 2)]['content'], -5).$tokens[$stackPtr]['content'];
85
 
 
86
 
if (($tokens[$nextToken - 1]['code']) !== T_WHITESPACE) {
87
 
    $errorPos = ($params[(count($params) - 1)]->getLine() + $commentStart);
88
 
}
89
 
 
90
 
while (($nextSpace = $phpcsFile->findNext(T_WHITESPACE, $nextSpace + 1, $nextBreak)) !== false) {
91
 
}
92
 
 
93
 
foreach ($attributes as $id => &$attribute) {
94
 
}
95
 
 
96
 
class MyClass
97
 
{
98
 
 
99
 
 
100
 
    public function &myFunction(array &$one, array &$two)
101
 
    {
102
 
 
103
 
    }//end myFunction()
104
 
 
105
 
 
106
 
}//end class
107
 
?>