~ubuntu-branches/ubuntu/trusty/php-codesniffer/trusty

« back to all changes in this revision

Viewing changes to PHP_CodeSniffer-1.0.1/CodeSniffer/Standards/Squiz/Tests/Arrays/ArrayDeclarationUnitTest.inc

  • Committer: Bazaar Package Importer
  • Author(s): Jan Wagner
  • Date: 2008-03-21 23:29:33 UTC
  • Revision ID: james.westby@ubuntu.com-20080321232933-za8kvi1bgvrvud6z
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
function test()
 
4
{
 
5
    $a = array();
 
6
 
 
7
    $b = Array ();
 
8
 
 
9
    $c = Array(
 
10
            'a' => 1,
 
11
         );
 
12
}
 
13
 
 
14
 
 
15
class TestClass
 
16
{
 
17
    public $good = array(
 
18
                    'width'  => '',
 
19
                    'height' => '',
 
20
                   );
 
21
 
 
22
    private $_bad = Array(
 
23
                    'width' => '',
 
24
                    'height' => ''
 
25
                     );
 
26
 
 
27
 
 
28
    public function test()
 
29
    {
 
30
        $truck = array(
 
31
                 'width' => '',
 
32
                  'height' => '',
 
33
                 );
 
34
 
 
35
        $plane = Array(
 
36
                'width' => '',
 
37
                  'height' => '',
 
38
                 );
 
39
 
 
40
        $car = array(
 
41
                'width' => '',
 
42
                'height' => '',
 
43
               );
 
44
 
 
45
        $bus = array(
 
46
                'width'  =>   '',
 
47
                'height' => ''
 
48
               );
 
49
 
 
50
        $train = array  (
 
51
                   TRUE,
 
52
                  FALSE,
 
53
                  'aaa'
 
54
                 );
 
55
 
 
56
        $inline = array('aaa', 'bbb', 'ccc');
 
57
        $inline = array('aaa');
 
58
        $inline = Array('aaa');
 
59
 
 
60
        $bigone = array(
 
61
                   'name' => 'bigone',
 
62
                   'children'   => Array(
 
63
                                    '1a' => 'child',
 
64
                                    '11b' => 'child',
 
65
                                    '111c'      => 'child',
 
66
                                    'children'  => Array(
 
67
                                                    'child' => 'aaa',
 
68
                                                   ),
 
69
                                   ),
 
70
                   'short_name' => 'big'
 
71
                  );
 
72
    }
 
73
 
 
74
}//end class
 
75
 
 
76
$value = array ( );
 
77
$value = array(  );
 
78
$value = array('1'=>$one, '2'  =>  $two, '3'=> $three, '4' =>$four);
 
79
$value = array('1'=>$one);
 
80
 
 
81
if (in_array('1', array('1','2','3')) === TRUE) {
 
82
    $value = in_array('1', array('1'  ,   '2',     '3','4'));
 
83
}
 
84
 
 
85
$value = array(
 
86
          '1'=> TRUE,
 
87
          FALSE,
 
88
          '3' => 'aaa',);
 
89
 
 
90
$value = array(
 
91
          '1'=> TRUE,
 
92
          FALSE,
 
93
         );
 
94
 
 
95
$value = array(
 
96
          TRUE,
 
97
          '1' => FALSE,
 
98
         );
 
99
 
 
100
$value = array(1,
 
101
          2 ,
 
102
          3 ,
 
103
         );
 
104
 
 
105
$value = array(1 => $one,
 
106
          2 => $two ,
 
107
          3 => $three ,
 
108
         );
 
109
 
 
110
$value = array(
 
111
          'tag'   => $tag,
 
112
          'space' => $this->_getIndentation($tag, $tagElement),
 
113
         );
 
114
 
 
115
$expected = array(
 
116
             array(
 
117
              '1' => 1,
 
118
              '1' => 2,
 
119
             ),
 
120
            );
 
121
 
 
122
$expected = array(
 
123
             array(
 
124
              '1' => 1,
 
125
              '1' => 2
 
126
             )
 
127
            );
 
128
 
 
129
// Space in second arg.
 
130
$args = array(
 
131
         '"'.$this->id.'"',
 
132
         (int) $hasSessions,
 
133
        );
 
134
 
 
135
// No errors.
 
136
$paths = array(
 
137
          Init::ROOT_DIR.'/Systems'   => 'Systems',
 
138
          Init::ROOT_DIR.'/Installer' => 'Systems',
 
139
         );
 
140
 
 
141
$x = array(
 
142
     );
 
143
 
 
144
$x = array('test'
 
145
     );
 
146
$x = array('test',
 
147
     );
 
148
$x = array('name' => 'test',
 
149
     );
 
150
 
 
151
$x = array(
 
152
      $x,
 
153
     );
 
154
 
 
155
$func = array(
 
156
         $x,
 
157
         'get'.$x.'Replacement'
 
158
        );
 
159
?>
 
 
b'\\ No newline at end of file'