├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── phpunit.xml ├── src └── DocBlockReader │ └── Reader.php └── tests ├── DocBlockReader └── ReaderTest.php └── bootstrap.php /.gitignore: -------------------------------------------------------------------------------- 1 | composer.phar 2 | *.sublime-* 3 | test.php 4 | vendor -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) Copyright (c) 2013 Jan Święcki 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Simple Annotations 2 | 3 | ## Installation 4 | 5 | Get [composer](http://getcomposer.org/) and learn to use it. 6 | 7 | Library is on [packagist](https://packagist.org/packages/jan-swiecki/simple-annotations). 8 | 9 | If you refuse to use composer then instead of `include_once "vendor/autoload.php"` use `include_once "src/DocBlockReader/Reader.php"`. 10 | 11 | ## Test 12 | 13 | You need [PHPUnit](https://github.com/sebastianbergmann/phpunit/). After you get it run: 14 | 15 | > git clone https://github.com/jan-swiecki/php-simple-annotations 16 | > cd php-simple-annotations 17 | > composer install 18 | > phpunit 19 | 20 | ## Introduction 21 | 22 | This library gives you the ability to extract and auto-parse DocBlock comment blocks. 23 | 24 | Example: 25 | 26 | class TestClass { 27 | /** 28 | * @x 1 29 | * @y yes! 30 | */ 31 | private $myVar; 32 | } 33 | 34 | $reader = new \DocBlockReader\Reader('TestClass', 'myVar', 'property'); 35 | $x = $reader->getParameter("x"); // 1 (with number type) 36 | $y = $reader->getParameter("y"); // "yes!" (with string type) 37 | 38 | So as you can see to do this you need to construct `Reader` object and target it at something. Then you extract data. 39 | 40 | You can point at classes, class methods and class properties. 41 | 42 | * Targeting class: `$reader = new \DocBlockReader\Reader(String $className)` 43 | * Targeting method or property: `$reader = new \DocBlockReader\Reader(String $className, String $name [, String $type = 'method'])` 44 | 45 | This will initialize DocBlock Reader on method `$className::$name` or property `$className::$name`. 46 | 47 | To choose method use only two arguments or provide third argument as `method` string value. To get property value put `property` string value in third argument. 48 | 49 | To extract parsed properties you have two methods: 50 | 51 | * `$reader->getParameter(String $key)` 52 | 53 | Returns DocBlock value of parameter `$key`. E.g. 54 | 55 | ```php 56 | getParameter("awesomeVariable") 74 | ``` 75 | 76 | will return string `I am a string` (without quotes). 77 | 78 | * `$reader->getParameters()` 79 | 80 | returns array of all parameters (see examples below). 81 | 82 | ## API 83 | 84 | * Constructor `$reader = new \DocBlockReader\Reader(String $className [, String $name [, String $type = 'method'] ])` 85 | 86 | Creates `Reader` pointing at class, class method or class property - based on provided arguments (see Introduction). 87 | 88 | * `$reader->getParameter(String $key)` 89 | 90 | Returns value of parameter `$key` extracted from DocBlock. 91 | 92 | * `$reader->getParameters()` 93 | 94 | returns array of all parameters (see examples below). 95 | 96 | * `$reader->getVariableDeclarations()` - See last example below. 97 | 98 | 99 | ## Examples 100 | 101 | Examples based on ReaderTest.php. 102 | 103 | Note: DocBlock Reader converts type of values basing on the context (see below). 104 | 105 | ### Type conversion example 106 | 107 | ```php 108 | getParameters()); 141 | ``` 142 | 143 | will print 144 | 145 | 146 |
147 | array (size=14)
148 |   'var0' => float 1.5
149 |   'var1' => int 1
150 |   'var2' => string '123' (length=3)
151 |   'var3' => string 'abc' (length=3)
152 |   'var4' => 
153 |     array (size=2)
154 |       0 => string 'a' (length=1)
155 |       1 => string 'b' (length=1)
156 |   'var5' => 
157 |     array (size=1)
158 |       'x' => string 'y' (length=1)
159 |   'var6' => 
160 |     array (size=1)
161 |       'x' => 
162 |         array (size=1)
163 |           'y' => string 'z' (length=1)
164 |   'var7' => 
165 |     array (size=1)
166 |       'x' => 
167 |         array (size=1)
168 |           'y' => 
169 |             array (size=2)
170 |               0 => string 'z' (length=1)
171 |               1 => string 'p' (length=1)
172 |   'var8' => boolean true
173 |   'var9' => null
174 |   'var10' => boolean true
175 |   'var11' => boolean true
176 |   'var12' => boolean false
177 |   'var13' => null
178 | 
179 | 180 | ### Multi value example 181 | 182 | ```php 183 | getParameters()); 204 | ``` 205 | 206 | will print 207 | 208 | 209 |
210 | array (size=3)
211 |   'var' => string 'x' (length=1)
212 |   'var2' => int 1024
213 |   'param' => 
214 |     array (size=3)
215 |       0 => string 'string x' (length=8)
216 |       1 => string 'integer y' (length=9)
217 |       2 => string 'array z' (length=7)
218 | 
219 | 220 | ### Variables on the same line 221 | 222 | ```php 223 | getParameters()); 243 | ``` 244 | 245 | will print 246 | 247 |
248 | array (size=4)
249 |   'get' => boolean true
250 |   'post' => boolean true
251 |   'ajax' => boolean true
252 |   'postParam' => 
253 |     array (size=3)
254 |       0 => string 'x' (length=1)
255 |       1 => string 'y' (length=1)
256 |       2 => string 'z' (length=1)
257 | 
258 | 259 | ### Variable declarations functionality example 260 | 261 | I found below functionality useful for filtering `$_GET`/`$_POST` data in CodeIgniter. Hopefully I will soon release my CodeIgniter's modification. 262 | 263 | ```php 264 | getVariableDeclarations("param")); 282 | ``` 283 | 284 | will print 285 | 286 |
287 | array (size=2)
288 |   0 => 
289 |     array (size=2)
290 |       'type' => string 'string' (length=6)
291 |       'name' => string 'var1' (length=4)
292 |   1 => 
293 |     array (size=2)
294 |       'type' => string 'integer' (length=7)
295 |       'name' => string 'var2' (length=4)
296 | 
-------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jan-swiecki/simple-annotations", 3 | "description": "Simple annotation parser", 4 | "homepage": "https://github.com/jan-swiecki/php-simple-annotations", 5 | "keywords": ["annotations", "annotation", "docblock", "parser"], 6 | "license": "MIT", 7 | "authors": 8 | [ 9 | { 10 | "name": "Jan Święcki", 11 | "email": "jan.swiecki@gmail.com", 12 | "role": "Developer" 13 | } 14 | ], 15 | "require": 16 | { 17 | "php": ">=5.3.0" 18 | }, 19 | "autoload": 20 | { 21 | "psr-0": 22 | { 23 | "DocBlockReader": "src/" 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "5b678a370a8d8600b3cfcfec147c1d93", 8 | "packages": [], 9 | "packages-dev": [], 10 | "aliases": [], 11 | "minimum-stability": "stable", 12 | "stability-flags": [], 13 | "prefer-stable": false, 14 | "prefer-lowest": false, 15 | "platform": { 16 | "php": ">=5.3.0" 17 | }, 18 | "platform-dev": [] 19 | } 20 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | tests/DocBlockReader/ 7 | 8 | 9 | 10 | 11 | 12 | src/DocBlockReader/ 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/DocBlockReader/Reader.php: -------------------------------------------------------------------------------- 1 | rawDocBlock = $reflection->getDocComment(); 39 | $this->parameters = array(); 40 | } 41 | 42 | private function parseSingle($key) 43 | { 44 | if(isset($this->parameters[$key])) 45 | { 46 | return $this->parameters[$key]; 47 | } 48 | else 49 | { 50 | if(preg_match("/@".preg_quote($key).$this->endPattern."/", $this->rawDocBlock, $match)) 51 | { 52 | return TRUE; 53 | } 54 | else 55 | { 56 | preg_match_all("/@".preg_quote($key)." (.*)".$this->endPattern."/U", $this->rawDocBlock, $matches); 57 | $size = sizeof($matches[1]); 58 | 59 | // not found 60 | if($size === 0) 61 | { 62 | return NULL; 63 | } 64 | // found one, save as scalar 65 | elseif($size === 1) 66 | { 67 | return $this->parseValue($matches[1][0]); 68 | } 69 | // found many, save as array 70 | else 71 | { 72 | $this->parameters[$key] = array(); 73 | foreach($matches[1] as $elem) 74 | { 75 | $this->parameters[$key][] = $this->parseValue($elem); 76 | } 77 | 78 | return $this->parameters[$key]; 79 | } 80 | } 81 | } 82 | } 83 | 84 | private function parse() 85 | { 86 | $pattern = "/@(?=(.*)".$this->endPattern.")/U"; 87 | 88 | preg_match_all($pattern, $this->rawDocBlock, $matches); 89 | 90 | foreach($matches[1] as $rawParameter) 91 | { 92 | if(preg_match("/^(".$this->keyPattern.") (.*)$/", $rawParameter, $match)) 93 | { 94 | $parsedValue = $this->parseValue($match[2]); 95 | if(isset($this->parameters[$match[1]])) 96 | { 97 | $this->parameters[$match[1]] = array_merge((array)$this->parameters[$match[1]], (array)$parsedValue); 98 | } 99 | else 100 | { 101 | $this->parameters[$match[1]] = $parsedValue; 102 | } 103 | } 104 | else if(preg_match("/^".$this->keyPattern."$/", $rawParameter, $match)) 105 | { 106 | $this->parameters[$rawParameter] = TRUE; 107 | } 108 | else 109 | { 110 | $this->parameters[$rawParameter] = NULL; 111 | } 112 | } 113 | } 114 | 115 | public function getVariableDeclarations($name) 116 | { 117 | $declarations = (array)$this->getParameter($name); 118 | 119 | foreach($declarations as &$declaration) 120 | { 121 | $declaration = $this->parseVariableDeclaration($declaration, $name); 122 | } 123 | 124 | return $declarations; 125 | } 126 | 127 | private function parseVariableDeclaration($declaration, $name) 128 | { 129 | $type = gettype($declaration); 130 | 131 | if($type !== 'string') 132 | { 133 | throw new \InvalidArgumentException( 134 | "Raw declaration must be string, $type given. Key='$name'."); 135 | } 136 | 137 | if(strlen($declaration) === 0) 138 | { 139 | throw new \InvalidArgumentException( 140 | "Raw declaration cannot have zero length. Key='$name'."); 141 | } 142 | 143 | $declaration = explode(" ", $declaration); 144 | if(sizeof($declaration) == 1) 145 | { 146 | // string is default type 147 | array_unshift($declaration, "string"); 148 | } 149 | 150 | // take first two as type and name 151 | $declaration = array( 152 | 'type' => $declaration[0], 153 | 'name' => $declaration[1] 154 | ); 155 | 156 | return $declaration; 157 | } 158 | 159 | private function parseValue($originalValue) 160 | { 161 | if($originalValue && $originalValue !== 'null') 162 | { 163 | // try to json decode, if cannot then store as string 164 | if( ($json = json_decode($originalValue,TRUE)) === NULL) 165 | { 166 | $value = $originalValue; 167 | } 168 | else 169 | { 170 | $value = $json; 171 | } 172 | } 173 | else 174 | { 175 | $value = NULL; 176 | } 177 | 178 | return $value; 179 | } 180 | 181 | public function getParameters() 182 | { 183 | if(! $this->parsedAll) 184 | { 185 | $this->parse(); 186 | $this->parsedAll = TRUE; 187 | } 188 | 189 | return $this->parameters; 190 | } 191 | 192 | public function getParameter($key) 193 | { 194 | return $this->parseSingle($key); 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /tests/DocBlockReader/ReaderTest.php: -------------------------------------------------------------------------------- 1 | commonTest($reader); 60 | } 61 | 62 | public function testPropertyParsing2() { 63 | $reader = new Reader($this, 'myVar2', 'property'); 64 | $x = $reader->getParameter("x"); 65 | $y = $reader->getParameter("y"); 66 | $this->assertSame(1, $x); 67 | $this->assertSame("yes!", $y); 68 | } 69 | 70 | /** 71 | * Issue: https://github.com/jan-swiecki/php-simple-annotations/issues/2 72 | * Thanks to @KrekkieD (https://github.com/KrekkieD) for reporting this issue! 73 | */ 74 | public function testIssue2Problem() { 75 | $reader = new Reader($this, 'issue2', 'property'); 76 | $Lalala = $reader->getParameters()["Lalala"]; 77 | 78 | $this->assertSame(array("somejsonarray", "2", "anotherjsonarray", "3"), $Lalala); 79 | } 80 | 81 | public function testParserOne() 82 | { 83 | $reader = new Reader($this, 'parserFixture'); 84 | $this->commonTest($reader); 85 | } 86 | 87 | public function commonTest($reader) { 88 | $parameters = $reader->getParameters(); 89 | 90 | $this->assertNotEmpty($parameters); 91 | 92 | $this->assertArrayHasKey('number', $parameters); 93 | $this->assertArrayHasKey('string', $parameters); 94 | $this->assertArrayHasKey('array', $parameters); 95 | $this->assertArrayHasKey('object', $parameters); 96 | $this->assertArrayHasKey('nested', $parameters); 97 | $this->assertArrayHasKey('nestedArray', $parameters); 98 | $this->assertArrayHasKey('trueVar', $parameters); 99 | $this->assertArrayHasKey('null-var', $parameters); 100 | $this->assertArrayHasKey('booleanTrue', $parameters); 101 | $this->assertArrayHasKey('booleanFalse', $parameters); 102 | $this->assertArrayHasKey('booleanNull', $parameters); 103 | $this->assertArrayNotHasKey('non_existent_key', $parameters); 104 | 105 | $this->assertSame(1, $parameters['number']); 106 | $this->assertSame("123", $parameters['string']); 107 | $this->assertSame("abc", $parameters['string2']); 108 | $this->assertSame(array("a", "b"), $parameters['array']); 109 | $this->assertSame(array("x" => "y"), $parameters['object']); 110 | $this->assertSame(array("x" => array("y" => "z")), $parameters['nested']); 111 | $this->assertSame(array("x" => array("y" => array("z", "p"))), $parameters['nestedArray']); 112 | $this->assertSame(TRUE, $parameters['trueVar']); 113 | $this->assertSame(NULL, $parameters['null-var']); 114 | 115 | $this->assertSame(TRUE, $parameters['booleanTrue']); 116 | $this->assertSame("tRuE", $parameters['string3']); 117 | $this->assertSame(FALSE, $parameters['booleanFalse']); 118 | $this->assertSame(NULL, $parameters['booleanNull']); 119 | } 120 | 121 | public function testParserOneFromClass() 122 | { 123 | $reader = new Reader($this); 124 | $parameters = $reader->getParameters(); 125 | 126 | $this->assertNotEmpty($parameters); 127 | 128 | $this->assertArrayHasKey('number', $parameters); 129 | $this->assertArrayHasKey('string', $parameters); 130 | $this->assertArrayHasKey('array', $parameters); 131 | $this->assertArrayHasKey('object', $parameters); 132 | $this->assertArrayHasKey('nested', $parameters); 133 | $this->assertArrayHasKey('nestedArray', $parameters); 134 | $this->assertArrayHasKey('trueVar', $parameters); 135 | $this->assertArrayHasKey('null-var', $parameters); 136 | $this->assertArrayHasKey('booleanTrue', $parameters); 137 | $this->assertArrayHasKey('booleanFalse', $parameters); 138 | $this->assertArrayHasKey('booleanNull', $parameters); 139 | $this->assertArrayNotHasKey('non_existent_key', $parameters); 140 | 141 | $this->assertSame(1, $parameters['number']); 142 | $this->assertSame("123", $parameters['string']); 143 | $this->assertSame("abc", $parameters['string2']); 144 | $this->assertSame(array("a", "b"), $parameters['array']); 145 | $this->assertSame(array("x" => "y"), $parameters['object']); 146 | $this->assertSame(array("x" => array("y" => "z")), $parameters['nested']); 147 | $this->assertSame(array("x" => array("y" => array("z", "p"))), $parameters['nestedArray']); 148 | $this->assertSame(TRUE, $parameters['trueVar']); 149 | $this->assertSame(NULL, $parameters['null-var']); 150 | 151 | $this->assertSame(TRUE, $parameters['booleanTrue']); 152 | $this->assertSame("tRuE", $parameters['string3']); 153 | $this->assertSame(FALSE, $parameters['booleanFalse']); 154 | $this->assertSame(NULL, $parameters['booleanNull']); 155 | } 156 | 157 | public function testParserTwo() 158 | { 159 | $reader = new Reader($this, 'parserFixture'); 160 | 161 | $this->assertSame(1, $reader->getParameter('number')); 162 | $this->assertSame("123", $reader->getParameter('string')); 163 | $this->assertSame(array("x" => array("y" => array("z", "p"))), 164 | $reader->getParameter('nestedArray')); 165 | 166 | $this->assertSame(NULL, $reader->getParameter('nullVar')); 167 | $this->assertSame(NULL, $reader->getParameter('null-var')); 168 | $this->assertSame(NULL, $reader->getParameter('non-existent')); 169 | } 170 | 171 | /** 172 | * @number 1 173 | * @string "123" 174 | * @string2 abc 175 | * @array ["a", "b"] 176 | * @object {"x": "y"} 177 | * @nested {"x": {"y": "z"}} 178 | * @nestedArray {"x": {"y": ["z", "p"]}} 179 | * 180 | * @trueVar 181 | * @null-var null 182 | * 183 | * @booleanTrue true 184 | * @string3 tRuE 185 | * @booleanFalse false 186 | * @booleanNull null 187 | * 188 | */ 189 | private function parserFixture() 190 | { 191 | } 192 | 193 | public function testParserEmpty() 194 | { 195 | $reader = new Reader($this, 'parserEmptyFixture'); 196 | $parameters = $reader->getParameters(); 197 | $this->assertSame(array(), $parameters); 198 | } 199 | 200 | private function parserEmptyFixture() 201 | { 202 | } 203 | 204 | public function testParserMulti() 205 | { 206 | $reader = new Reader($this, 'parserMultiFixture'); 207 | $parameters = $reader->getParameters(); 208 | 209 | $this->assertNotEmpty($parameters); 210 | $this->assertArrayHasKey('param', $parameters); 211 | $this->assertArrayHasKey('var', $parameters); 212 | 213 | $this->assertSame("x",$parameters["var"]); 214 | $this->assertSame(1024,$parameters["var2"]); 215 | 216 | $this->assertSame( 217 | array("string x", "integer y", "array z"), 218 | $parameters["param"]); 219 | 220 | } 221 | 222 | /** 223 | * @var x 224 | * @var2 1024 225 | * @param string x 226 | * @param integer y 227 | * @param array z 228 | */ 229 | private function parserMultiFixture() 230 | { 231 | } 232 | 233 | public function testParserThree() 234 | { 235 | $reader = new Reader($this, 'fixtureThree'); 236 | // $allowedRequest = $reader->getParameter("allowedRequest"); 237 | 238 | $postParam = $reader->getParameter("postParam"); 239 | 240 | $this->assertNotEmpty($postParam); 241 | } 242 | 243 | /** 244 | * @allowedRequest ["ajax", "post"] 245 | * @postParam integer orderId 246 | * @postParam array productIds 247 | * @postParam string newValue 248 | */ 249 | private function fixtureThree() 250 | { 251 | 252 | } 253 | 254 | public function testParserFour() 255 | { 256 | $reader = new Reader($this, 'fixtureFour'); 257 | 258 | $this->assertSame(TRUE, $reader->getParameter('get')); 259 | $this->assertSame(TRUE, $reader->getParameter('post')); 260 | $this->assertSame(TRUE, $reader->getParameter('ajax')); 261 | $this->assertSame(array("x","y","z"), $reader->getParameter('postParam')); 262 | } 263 | 264 | public function testParserFourBis() 265 | { 266 | $reader = new Reader($this, 'fixtureFour'); 267 | 268 | $parameters = $reader->getParameters(); 269 | 270 | $this->assertArrayHasKey('get', $parameters); 271 | $this->assertArrayHasKey('post', $parameters); 272 | $this->assertArrayHasKey('ajax', $parameters); 273 | $this->assertArrayHasKey('postParam', $parameters); 274 | 275 | $this->assertSame(TRUE, $parameters['get']); 276 | $this->assertSame(TRUE, $parameters['post']); 277 | $this->assertSame(TRUE, $parameters['ajax']); 278 | $this->assertSame(array("x","y","z"), $parameters['postParam']); 279 | 280 | } 281 | 282 | /** 283 | * @get @post 284 | * @ajax 285 | * @postParam x 286 | * @postParam y 287 | * @postParam z 288 | */ 289 | private function fixtureFour() 290 | { 291 | } 292 | 293 | public function testFive() 294 | { 295 | $reader1 = new Reader($this, 'fixtureFive'); 296 | $reader2 = new Reader($this, 'fixtureFive'); 297 | 298 | $parameters1 = $reader1->getParameters(); 299 | 300 | $trueVar1 = $parameters1['trueVar1']; 301 | 302 | $this->assertSame(TRUE,$trueVar1); 303 | $this->assertSame(TRUE,$reader2->getParameter("trueVar2")); 304 | 305 | } 306 | 307 | /** 308 | * @trueVar1 309 | * @trueVar2 310 | */ 311 | private function fixtureFive() 312 | { 313 | } 314 | 315 | public function testVariableDeclarations() 316 | { 317 | $reader = new Reader($this, 'fixtureVariableDeclarations'); 318 | $declarations = $reader->getVariableDeclarations("param"); 319 | $this->assertNotEmpty($declarations); 320 | 321 | $this->assertSame(array( 322 | array("type"=>"string", "name" => "var1"), 323 | array("type"=>"integer", "name" => "var2") 324 | ), $declarations); 325 | } 326 | 327 | /** 328 | * @param string var1 329 | * @param integer var2 330 | */ 331 | private function fixtureVariableDeclarations() 332 | { 333 | } 334 | 335 | /** 336 | * @dataProvider badVariableDataProvider 337 | * @expectedException InvalidArgumentException 338 | */ 339 | public function testBadVariableDeclarations($methodName) 340 | { 341 | $reader = new Reader($this, $methodName); 342 | $declarations = $reader->getVariableDeclarations("param"); 343 | } 344 | 345 | /** 346 | * @param false 347 | */ 348 | private function fixtureBadVariableDeclarationsOne() 349 | { 350 | } 351 | 352 | /** 353 | * @param true 354 | */ 355 | private function fixtureBadVariableDeclarationsTwo() 356 | { 357 | } 358 | 359 | public function badVariableDataProvider() 360 | { 361 | return array( 362 | array('fixtureBadVariableDeclarationsOne'), 363 | array('fixtureBadVariableDeclarationsTwo') 364 | ); 365 | } 366 | } 367 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | add('DocBlockReader\\', __DIR__); --------------------------------------------------------------------------------