Completed
Push — develop ( 71fd61...bbac44 )
by Jaap
06:03 queued 02:27
created

tests/ReferenceImplementation.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * This is a file Summary.
4
 *
5
 * This is a file description
6
 * @package File
7
 * @filesource
8
 */
9
10
namespace {
11
12
    /**
13
     * This is the summary of a constant in the global namespace.
14
     *
15
     * To check if the description is displayed correctly we *check* if it is handled correctly. And
16
     * if it shows any [Markdown](http://daringfireball.net) formatting.
17
     */
18
    const GLOBAL_CONSTANT_DEFINE_WITH_ROOT_NAMESPACE = 'test';
19
}
20
21
namespace My\Space {
22
23
    define("GLOBAL_CONSTANT_DEFINE", 'test');
24
25
    /**
26
     * @package Constant
27
     */
28
    define("Namespaced\\GLOBAL_CONSTANT_DEFINE", 'test');
29
30
    /**
31
     * @package Constant\Specific
32
     */
33
    const GLOBAL_CONSTANT_CONST = 'test';
34
35
    /**
36
     *
37
     *
38
     * @param integer   $param1 Example of a description & with ampersand (&).
39
     * @param \stdClass $param2
40
     * @param string    $param3
41
     *
42
     * @return void
43
     */
44
    function globalFunction($param1, \stdClass $param2, $param3 = '')
0 ignored issues
show
The parameter $param1 is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $param2 is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $param3 is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
    {
46
47
    }
48
49
    /**
50
     * A reference implementation for a subclass.
51
     *
52
     * This subclass's package has a different case than the superclass to test issue #558.
53
     *
54
     * @package class
55
     */
56
    class SubClass extends SuperClass
57
    {
58
59
        /**
60
         * @var integer   $propertyListItem1 The first property in a list
61
         * @var \stdClass $propertyListItem2 The second property in a list
62
         */
63
        public $propertyListItem1, $propertyListItem2;
64
    }
65
66
    /**
67
     * This is the summary for this class.
68
     *
69
     * This is a *longer* description that may contain Markdown code
70
     * and span multiple lines without causing any issues.
71
     *
72
     * @source
73
     * @author Mike van Riel <[email protected]>
74
     * @package Class
75
     * @method string myMagicMethod(\stdClass $argument1) This is a description.
76
     * @method static string myStaticMagicMethod(\stdClass $argument1) This is a description.
77
     * @property string $myMagicProperty This is a description.
78
     */
79
    class SuperClass implements SubInterface
80
    {
81
        const CLASS_CONSTANT = 'test';
82
83
        /** @var integer $staticProperty A static property */
84
        public static $staticProperty;
85
86
        /**
87
         * A public property
88
         * @var SubClass
89
         * @deprecated
90
         */
91
        public $publicProperty;
92
93
        protected $protectedProperty;
94
95
        private $privateProperty;
96
97
        /**
98
         * This is a public method.
99
         *
100
         * Example:
101
         *
102
         * ```
103
         * <?php
104
         * echo (string) $class->publicMethod();
105
         * if (true) {
106
         *     echo 'indented string';
107
         * }
108
         * ```
109
         *
110
         * @deprecated This is superseded by the SuperClass
111
         *
112
         * @see GLOBAL_CONSTANT_DEFINE       Refer to global constant.
113
         * @see globalFunction()             Refer to global function.
114
         * @see SuperClass::CLASS_CONSTANT   Refer to class constant.
115
         * @see self::CLASS_CONSTANT         Refer to class constant.
116
         * @see self::staticMethod()         Refer to method.
117
         * @see self::$privateProperty       Refer to property.
118
         * @see SuperClass::$privateProperty Refer to property.
119
         * @see SuperInterface               Refer to interface.
120
         * @see SubClass                     Refer to class.
121
         *
122
         * @throws \Exception if it fails.
123
         * @uses self::protectedMethod()
124
         * @link http://www.phpdoc.org
125
         *
126
         * @return SubInterface an instance of the SubInterface interface.
127
         * Example in the return statement:
128
         * ```
129
         * <?php
130
         * if (true) {
131
         *     echo 'another indented string';
132
         * }
133
         * ```
134
         */
135
        public function publicMethod()
136
        {
137
        }
138
139
        /**
140
         * This is a method definition showcasing the variadic syntax pre-php5.6.
141
         *
142
         * @param string $first
143
         * @param string ...$second
144
         *
145
         * @return void
146
         */
147
        public function variadicMethodWithOneExplicitParameter($first)
148
        {
149
150
        }
151
152
        static public function staticMethod()
153
        {
154
        }
155
156
        protected function protectedMethod(\stdClass $argument)
0 ignored issues
show
The parameter $argument is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
157
        {
158
        }
159
160
        private function privateMethod()
0 ignored issues
show
This method is not used, and could be removed.
Loading history...
161
        {
162
        }
163
    }
164
165
    interface SubInterface extends SuperInterface,AnotherSuperInterface
166
    {
167
168
    }
169
170
    /**
171
     * @package File
172
     * @subpackage Interface\Super
173
     */
174
    interface SuperInterface
175
    {
176
        const INTERFACE_CONSTANT = 'test';
177
178
        public function publicMethod();
179
    }
180
181
    /**
182
     * @package File
183
     * @subpackage Interface
184
     */
185
    interface AnotherSuperInterface
186
    {
187
        static public function staticMethod();
188
    }
189
}
190
191
namespace My\Space\Errors {
192
193
    /**
194
     * @package Package1
195
     * @package Package2
196
     * @subpackage Subpackage1
197
     * @subpackage Subpackage2
198
     */
199
    class MultiplePackageTags
200
    {
201
202
        /**
203
         * @return type This is a generic default injected by IDEs, and is not a valid type
204
         */
205
        public function responseMayNotBeType()
206
        {
207
208
        }
209
    }
210
211
    /**
212
     * @subpackage Subpackage1
213
     */
214
    class SubPackageWithoutPackage
215
    {
216
217
    }
218
}
219