| @@ -236,7 +236,7 @@ | ||
| 236 | 236 | */ | 
| 237 | 237 | public function to_array() | 
| 238 | 238 |  	{ | 
| 239 | - return array_filter(array_merge([ self::GENERIC => [] ], $this->collection)); | |
| 239 | + return array_filter(array_merge([self::GENERIC => []], $this->collection)); | |
| 240 | 240 | } | 
| 241 | 241 | |
| 242 | 242 | /** | 
| @@ -26,10 +26,10 @@ discard block | ||
| 26 | 26 | $attribute = uniqid(); | 
| 27 | 27 | |
| 28 | 28 | $errors = (new ErrorCollection) | 
| 29 | - ->add($attribute, $format, [ 'arg' => $arg3 ]) | |
| 30 | - ->add_generic($format, [ 'arg' => $arg1 ]) | |
| 31 | - ->add($attribute, $format, [ 'arg' => $arg4 ]) | |
| 32 | - ->add_generic($format, [ 'arg' => $arg2 ]) | |
| 29 | + ->add($attribute, $format, ['arg' => $arg3]) | |
| 30 | + ->add_generic($format, ['arg' => $arg1]) | |
| 31 | + ->add($attribute, $format, ['arg' => $arg4]) | |
| 32 | + ->add_generic($format, ['arg' => $arg2]) | |
| 33 | 33 | ; | 
| 34 | 34 | |
| 35 | 35 | $renderer = new ErrorCollectionIterator($errors); | 
| @@ -37,15 +37,15 @@ discard block | ||
| 37 | 37 | |
| 38 | 38 | foreach ($renderer as $a => $r) | 
| 39 | 39 |  		{ | 
| 40 | - $rendered[] = [ $a, $r ]; | |
| 40 | + $rendered[] = [$a, $r]; | |
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | 43 | $this->assertSame([ | 
| 44 | 44 | |
| 45 | -			[ ErrorCollection::GENERIC, "error: {$arg1}" ], | |
| 46 | -			[ ErrorCollection::GENERIC, "error: {$arg2}" ], | |
| 47 | -			[ $attribute, "error: {$arg3}" ], | |
| 48 | -			[ $attribute, "error: {$arg4}" ], | |
| 45 | +			[ErrorCollection::GENERIC, "error: {$arg1}"], | |
| 46 | +			[ErrorCollection::GENERIC, "error: {$arg2}"], | |
| 47 | +			[$attribute, "error: {$arg3}"], | |
| 48 | +			[$attribute, "error: {$arg4}"], | |
| 49 | 49 | |
| 50 | 50 | ], $rendered); | 
| 51 | 51 | } | 
| @@ -60,13 +60,13 @@ discard block | ||
| 60 | 60 | $attribute = uniqid(); | 
| 61 | 61 | |
| 62 | 62 | $errors = (new ErrorCollection) | 
| 63 | - ->add($attribute, $format, [ 'arg' => $arg3 ]) | |
| 64 | - ->add_generic($format, [ 'arg' => $arg1 ]) | |
| 65 | - ->add($attribute, $format, [ 'arg' => $arg4 ]) | |
| 66 | - ->add_generic($format, [ 'arg' => $arg2 ]) | |
| 63 | + ->add($attribute, $format, ['arg' => $arg3]) | |
| 64 | + ->add_generic($format, ['arg' => $arg1]) | |
| 65 | + ->add($attribute, $format, ['arg' => $arg4]) | |
| 66 | + ->add_generic($format, ['arg' => $arg2]) | |
| 67 | 67 | ; | 
| 68 | 68 | |
| 69 | -		$renderer = new ErrorCollectionIterator($errors, function (Error $error, $attribute, ErrorCollection $collection) use ($errors) { | |
| 69 | +		$renderer = new ErrorCollectionIterator($errors, function(Error $error, $attribute, ErrorCollection $collection) use ($errors) { | |
| 70 | 70 | |
| 71 | 71 | $this->assertSame($errors, $collection); | 
| 72 | 72 | |
| @@ -78,15 +78,15 @@ discard block | ||
| 78 | 78 | |
| 79 | 79 | foreach ($renderer as $a => $r) | 
| 80 | 80 |  		{ | 
| 81 | - $rendered[] = [ $a, $r ]; | |
| 81 | + $rendered[] = [$a, $r]; | |
| 82 | 82 | } | 
| 83 | 83 | |
| 84 | 84 | $this->assertSame([ | 
| 85 | 85 | |
| 86 | -			[ ErrorCollection::GENERIC, strrev("error: {$arg1}") ], | |
| 87 | -			[ ErrorCollection::GENERIC, strrev("error: {$arg2}") ], | |
| 88 | -			[ $attribute, strrev("error: {$arg3}") ], | |
| 89 | -			[ $attribute, strrev("error: {$arg4}") ], | |
| 86 | +			[ErrorCollection::GENERIC, strrev("error: {$arg1}")], | |
| 87 | +			[ErrorCollection::GENERIC, strrev("error: {$arg2}")], | |
| 88 | +			[$attribute, strrev("error: {$arg3}")], | |
| 89 | +			[$attribute, strrev("error: {$arg4}")], | |
| 90 | 90 | |
| 91 | 91 | ], $rendered); | 
| 92 | 92 | } | 
| @@ -30,7 +30,7 @@ discard block | ||
| 30 | 30 |  	{ | 
| 31 | 31 | $attribute = uniqid(); | 
| 32 | 32 | $format = uniqid(); | 
| 33 | - $args = [ uniqid() => uniqid() ]; | |
| 33 | + $args = [uniqid() => uniqid()]; | |
| 34 | 34 | $this->errors->add($attribute, $format, $args); | 
| 35 | 35 | $this->assertEquals(1, $this->errors->count()); | 
| 36 | 36 | |
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | public function test_add_with_true() | 
| 46 | 46 |  	{ | 
| 47 | 47 | $attribute = uniqid(); | 
| 48 | - $args = [ uniqid() => uniqid() ]; | |
| 48 | + $args = [uniqid() => uniqid()]; | |
| 49 | 49 | $this->errors->add($attribute, true, $args); | 
| 50 | 50 | $this->assertEquals(1, $this->errors->count()); | 
| 51 | 51 | |
| @@ -59,9 +59,9 @@ discard block | ||
| 59 | 59 | |
| 60 | 60 | public function test_add_with_error() | 
| 61 | 61 |  	{ | 
| 62 | - $error = new Error(uniqid(), [ uniqid() => uniqid() ]); | |
| 62 | + $error = new Error(uniqid(), [uniqid() => uniqid()]); | |
| 63 | 63 | $attribute = uniqid(); | 
| 64 | - $this->errors->add($attribute, $error, [ uniqid() => uniqid() ]); | |
| 64 | + $this->errors->add($attribute, $error, [uniqid() => uniqid()]); | |
| 65 | 65 | $this->assertEquals(1, $this->errors->count()); | 
| 66 | 66 | |
| 67 | 67 | $errors = $this->errors[$attribute]; | 
| @@ -84,12 +84,12 @@ discard block | ||
| 84 | 84 |  	{ | 
| 85 | 85 | return [ | 
| 86 | 86 | |
| 87 | - [ null ], | |
| 88 | - [ false ], | |
| 89 | - [ true ], | |
| 90 | - [ 123 ], | |
| 91 | - [ [] ], | |
| 92 | - [ new \stdClass ] | |
| 87 | + [null], | |
| 88 | + [false], | |
| 89 | + [true], | |
| 90 | + [123], | |
| 91 | + [[]], | |
| 92 | + [new \stdClass] | |
| 93 | 93 | |
| 94 | 94 | ]; | 
| 95 | 95 | } | 
| @@ -109,17 +109,17 @@ discard block | ||
| 109 | 109 |  	{ | 
| 110 | 110 | return [ | 
| 111 | 111 | |
| 112 | - [ false ], | |
| 113 | - [ [ uniqid() => uniqid() ] ], | |
| 114 | - [ 1234 ], | |
| 115 | - [ new \stdClass ] | |
| 112 | + [false], | |
| 113 | + [[uniqid() => uniqid()]], | |
| 114 | + [1234], | |
| 115 | + [new \stdClass] | |
| 116 | 116 | |
| 117 | 117 | ]; | 
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | 120 | public function test_add_generic() | 
| 121 | 121 |  	{ | 
| 122 | - $error = new Error(uniqid(), [ uniqid() => uniqid() ]); | |
| 122 | + $error = new Error(uniqid(), [uniqid() => uniqid()]); | |
| 123 | 123 | $this->errors->add_generic($error); | 
| 124 | 124 | $errors = $this->errors[null]; | 
| 125 | 125 | $this->assertSame($error, reset($errors)); | 
| @@ -128,10 +128,10 @@ discard block | ||
| 128 | 128 | public function test_array_access_interface() | 
| 129 | 129 |  	{ | 
| 130 | 130 | $errors = $this->errors; | 
| 131 | - $err1 = new Error(uniqid(), [ uniqid() => uniqid() ]); | |
| 132 | - $err2 = new Error(uniqid(), [ uniqid() => uniqid() ]); | |
| 133 | - $err3 = new Error(uniqid(), [ uniqid() => uniqid() ]); | |
| 134 | - $err4 = new Error(uniqid(), [ uniqid() => uniqid() ]); | |
| 131 | + $err1 = new Error(uniqid(), [uniqid() => uniqid()]); | |
| 132 | + $err2 = new Error(uniqid(), [uniqid() => uniqid()]); | |
| 133 | + $err3 = new Error(uniqid(), [uniqid() => uniqid()]); | |
| 134 | + $err4 = new Error(uniqid(), [uniqid() => uniqid()]); | |
| 135 | 135 | $attribute = uniqid(); | 
| 136 | 136 | $errors[] = $err1; | 
| 137 | 137 | $errors[] = $err2; | 
| @@ -140,8 +140,8 @@ discard block | ||
| 140 | 140 | |
| 141 | 141 | $this->assertTrue(isset($errors[null])); | 
| 142 | 142 | $this->assertTrue(isset($errors[$attribute])); | 
| 143 | - $this->assertSame([ $err1, $err2 ], $errors[null]); | |
| 144 | - $this->assertSame([ $err3, $err4 ], $errors[$attribute]); | |
| 143 | + $this->assertSame([$err1, $err2], $errors[null]); | |
| 144 | + $this->assertSame([$err3, $err4], $errors[$attribute]); | |
| 145 | 145 | |
| 146 | 146 | unset($errors[null]); | 
| 147 | 147 | $this->assertSame([], $errors[null]); | 
| @@ -152,10 +152,10 @@ discard block | ||
| 152 | 152 | public function test_iterator() | 
| 153 | 153 |  	{ | 
| 154 | 154 | $errors = $this->errors; | 
| 155 | -		$err1 = new Error('err1-' . uniqid()); | |
| 156 | -		$err2 = new Error('err2-' . uniqid()); | |
| 157 | -		$err3 = new Error('err3-' . uniqid()); | |
| 158 | -		$err4 = new Error('err4-' . uniqid()); | |
| 155 | +		$err1 = new Error('err1-'.uniqid()); | |
| 156 | +		$err2 = new Error('err2-'.uniqid()); | |
| 157 | +		$err3 = new Error('err3-'.uniqid()); | |
| 158 | +		$err4 = new Error('err4-'.uniqid()); | |
| 159 | 159 | $attribute = uniqid(); | 
| 160 | 160 | $errors[$attribute] = $err3; | 
| 161 | 161 | $errors[] = $err1; | 
| @@ -166,15 +166,15 @@ discard block | ||
| 166 | 166 | |
| 167 | 167 | foreach ($errors as $a => $e) | 
| 168 | 168 |  		{ | 
| 169 | - $iterator_errors[] = [ $a => $e ]; | |
| 169 | + $iterator_errors[] = [$a => $e]; | |
| 170 | 170 | } | 
| 171 | 171 | |
| 172 | 172 | $this->assertSame([ | 
| 173 | 173 | |
| 174 | - [ ErrorCollection::GENERIC => $err1 ], | |
| 175 | - [ ErrorCollection::GENERIC => $err2 ], | |
| 176 | - [ $attribute => $err3 ], | |
| 177 | - [ $attribute => $err4 ], | |
| 174 | + [ErrorCollection::GENERIC => $err1], | |
| 175 | + [ErrorCollection::GENERIC => $err2], | |
| 176 | + [$attribute => $err3], | |
| 177 | + [$attribute => $err4], | |
| 178 | 178 | |
| 179 | 179 | ], $iterator_errors); | 
| 180 | 180 | } | 
| @@ -182,10 +182,10 @@ discard block | ||
| 182 | 182 | public function test_each() | 
| 183 | 183 |  	{ | 
| 184 | 184 | $errors = $this->errors; | 
| 185 | -		$err1 = new Error('err1-' . uniqid()); | |
| 186 | -		$err2 = new Error('err2-' . uniqid()); | |
| 187 | -		$err3 = new Error('err3-' . uniqid()); | |
| 188 | -		$err4 = new Error('err4-' . uniqid()); | |
| 185 | +		$err1 = new Error('err1-'.uniqid()); | |
| 186 | +		$err2 = new Error('err2-'.uniqid()); | |
| 187 | +		$err3 = new Error('err3-'.uniqid()); | |
| 188 | +		$err4 = new Error('err4-'.uniqid()); | |
| 189 | 189 | $attribute = uniqid(); | 
| 190 | 190 | $errors[$attribute] = $err3; | 
| 191 | 191 | $errors[] = $err1; | 
| @@ -194,19 +194,19 @@ discard block | ||
| 194 | 194 | |
| 195 | 195 | $iterator_errors = []; | 
| 196 | 196 | |
| 197 | -		$errors->each(function ($error, $attribute, $collection) use (&$iterator_errors, $errors) { | |
| 197 | +		$errors->each(function($error, $attribute, $collection) use (&$iterator_errors, $errors) { | |
| 198 | 198 | |
| 199 | 199 | $this->assertSame($errors, $collection); | 
| 200 | - $iterator_errors[] = [ $attribute => $error ]; | |
| 200 | + $iterator_errors[] = [$attribute => $error]; | |
| 201 | 201 | |
| 202 | 202 | }); | 
| 203 | 203 | |
| 204 | 204 | $this->assertSame([ | 
| 205 | 205 | |
| 206 | - [ ErrorCollection::GENERIC => $err1 ], | |
| 207 | - [ ErrorCollection::GENERIC => $err2 ], | |
| 208 | - [ $attribute => $err3 ], | |
| 209 | - [ $attribute => $err4 ], | |
| 206 | + [ErrorCollection::GENERIC => $err1], | |
| 207 | + [ErrorCollection::GENERIC => $err2], | |
| 208 | + [$attribute => $err3], | |
| 209 | + [$attribute => $err4], | |
| 210 | 210 | |
| 211 | 211 | ], $iterator_errors); | 
| 212 | 212 | } | 
| @@ -250,10 +250,10 @@ discard block | ||
| 250 | 250 | $arg4 = uniqid(); | 
| 251 | 251 | $attribute = uniqid(); | 
| 252 | 252 | $errors = $this->errors; | 
| 253 | - $errors->add($attribute, $format, [ 'arg' => $arg3 ]); | |
| 254 | - $errors->add_generic($format, [ 'arg' => $arg1 ]); | |
| 255 | - $errors->add($attribute, $format, [ 'arg' => $arg4 ]); | |
| 256 | - $errors->add_generic($format, [ 'arg' => $arg2 ]); | |
| 253 | + $errors->add($attribute, $format, ['arg' => $arg3]); | |
| 254 | + $errors->add_generic($format, ['arg' => $arg1]); | |
| 255 | + $errors->add($attribute, $format, ['arg' => $arg4]); | |
| 256 | + $errors->add_generic($format, ['arg' => $arg2]); | |
| 257 | 257 | |
| 258 | 258 | $this->assertSame(json_encode([ | 
| 259 | 259 | |
| @@ -11,4 +11,4 @@ | ||
| 11 | 11 | |
| 12 | 12 | namespace ICanBoogie; | 
| 13 | 13 | |
| 14 | -require __DIR__ . '/../vendor/autoload.php'; | |
| 14 | +require __DIR__.'/../vendor/autoload.php'; | |