~ubuntu-branches/ubuntu/vivid/php-codesniffer/vivid

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.5.5/CodeSniffer/Standards/PEAR/Tests/ControlStructures/ControlSignatureUnitTest.inc

  • Committer: Package Import Robot
  • Author(s): David Prévot, Greg Sherwood, Alexey, Emily, David Prévot
  • Date: 2014-09-26 13:44:35 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140926134435-wvjq16miqq4d60y0
Tags: 1.5.5-1
[ Greg Sherwood ]
* Improved closure support in Generic ScopeIndentSniff
* Improved indented PHP tag support in Generic ScopeIndentSniff
* Standards can now be located within hidden directories
 (further fix for bug #20323)
* Fixed bug #20373 : Inline comment sniff tab handling way
* Fixed bug #20378 : Report appended to existing file if no errors
  found in run
* Fixed bug #20381 : Invalid "Comment closer must be on a new line"
* PHP tokenizer no longer converts class/function names to special
  tokens types
* Fixed bug #20386 : Squiz.Commenting.ClassComment.SpacingBefore
  thrown if first block comment
* Squiz and PEAR FunctionCommentSnif now support _()
* PEAR ValidFunctionNameSniff no longer throws an error for _()
* Fixed bug #248 : FunctionCommentSniff expects ampersand on param name
* Fixed bug #248 in Squiz sniff as well
* Fixed bug #265 : False positives with type hints in ForbiddenFunctionsSniff
* Prepare for 1.5.5 release

[ Alexey ]
* Allowed single undersored methods and functions

[ Emily ]
* Added var_dump to discouraged functions sniff

[ David Prévot ]
* Revert "Add XS-Testsuite still needed for ci.d.n"
* Add self to uploaders
* Bump standards version to 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
// do ... while
 
4
$i = 0;
 
5
do {
 
6
    echo $i;
 
7
} while ($i > 0);
 
8
 
 
9
do
 
10
{
 
11
    echo $i;
 
12
} while ($i > 0);
 
13
 
 
14
do
 
15
{
 
16
    echo $i;
 
17
}
 
18
while ($i > 0);
 
19
 
 
20
do { echo $i; } while ($i > 0);
 
21
 
 
22
do{
 
23
    echo $i;
 
24
}while($i > 0);
 
25
 
 
26
 
 
27
// while
 
28
while ($i < 1) {
 
29
    echo $i;
 
30
}
 
31
 
 
32
while($i < 1){
 
33
    echo $i;
 
34
}
 
35
 
 
36
while ($i < 1) { echo $i; }
 
37
 
 
38
 
 
39
// for
 
40
for ($i = 1; $i < 1; $i++) {
 
41
    echo $i;
 
42
}
 
43
 
 
44
for($i = 1; $i < 1; $i++){
 
45
    echo $i;
 
46
}
 
47
 
 
48
for ($i = 1; $i < 1; $i++) { echo $i; }
 
49
 
 
50
 
 
51
// foreach
 
52
foreach ($items as $item) {
 
53
    echo $item;
 
54
}
 
55
 
 
56
foreach($items as $item){
 
57
    echo $item;
 
58
}
 
59
 
 
60
for ($items as $item) { echo $item; }
 
61
 
 
62
 
 
63
// if
 
64
if ($i == 0) {
 
65
    $i = 1;
 
66
}
 
67
 
 
68
if($i == 0){
 
69
    $i = 1;
 
70
}
 
71
 
 
72
if ($i == 0) { $i = 1; }
 
73
 
 
74
 
 
75
// else
 
76
if ($i == 0) {
 
77
    $i = 1;
 
78
} else {
 
79
    $i = 0;
 
80
}
 
81
 
 
82
if ($i == 0) {
 
83
    $i = 1;
 
84
}else{
 
85
    $i = 0;
 
86
}
 
87
 
 
88
if ($i == 0) { $i = 1; } else { $i = 0; }
 
89
 
 
90
 
 
91
// else
 
92
if ($i == 0) {
 
93
    $i = 1;
 
94
} else {
 
95
    $i = 0;
 
96
}
 
97
 
 
98
if ($i == 0) {
 
99
    $i = 1;
 
100
}else{
 
101
    $i = 0;
 
102
}
 
103
 
 
104
if ($i == 0) { $i = 1; } else { $i = 0; }
 
105
 
 
106
 
 
107
// else if
 
108
if ($i == 0) {
 
109
    $i = 1;
 
110
} else if ($i == 2) {
 
111
    $i = 0;
 
112
}
 
113
 
 
114
if ($i == 0) {
 
115
    $i = 1;
 
116
} elseif ($i == 2) {
 
117
    $i = 0;
 
118
}
 
119
 
 
120
if ($i == 0) {
 
121
    $i = 1;
 
122
}else if($i == 2){
 
123
    $i = 0;
 
124
}
 
125
 
 
126
if ($i == 0) {
 
127
    $i = 1;
 
128
}elseif($i == 2){
 
129
    $i = 0;
 
130
}
 
131
 
 
132
if ($i == 0) { $i = 1; } else if ($i == 2) { $i = 0; }
 
133
if ($i == 0) { $i = 1; } elseif ($1 == 2) { $i = 0; }
 
134
 
 
135
if ($i == 0) { // this is ok because comments are allowed
 
136
    $i = 1;
 
137
}
 
138
 
 
139
if ($i == 0) {// this is ok because comments are allowed
 
140
    $i = 1;
 
141
}
 
142
 
 
143
if ($i == 0) { /* this is ok because comments are allowed*/
 
144
    $i = 1;
 
145
}
 
146
 
 
147
if ($i == 0)
 
148
{ // this is not ok
 
149
    $i = 1;
 
150
}
 
151
 
 
152
if ($i == 0) /* this is ok */ {
 
153
}
 
154
 
 
155
if ($i == 0) {
 
156
}
 
157
else {
 
158
}
 
159
?>
 
 
b'\\ No newline at end of file'