@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | - * @param $class |
|
104 | + * @param null|string $class |
|
105 | 105 | * |
106 | 106 | * @return EntityInterface |
107 | 107 | */ |
@@ -192,6 +192,9 @@ discard block |
||
192 | 192 | return $entity; |
193 | 193 | } |
194 | 194 | |
195 | + /** |
|
196 | + * @param string $default |
|
197 | + */ |
|
195 | 198 | protected function ask($text, $default = null) |
196 | 199 | { |
197 | 200 | $helper = $this->getQuestionHelper(); |
@@ -202,6 +205,9 @@ discard block |
||
202 | 205 | return $res; |
203 | 206 | } |
204 | 207 | |
208 | + /** |
|
209 | + * @param string $field |
|
210 | + */ |
|
205 | 211 | protected function askForField($field, $tName) |
206 | 212 | { |
207 | 213 | $question = "$field ($tName): "; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
195 | - * @return \Smartbox\CoreBundle\Type\IntegerType[] |
|
195 | + * @return integer[] |
|
196 | 196 | */ |
197 | 197 | public function getArrayOfIntegers() |
198 | 198 | { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
211 | - * @return \Smartbox\CoreBundle\Type\StringType[] |
|
211 | + * @return string[] |
|
212 | 212 | */ |
213 | 213 | public function getArrayOfStrings() |
214 | 214 | { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
227 | - * @return \Smartbox\CoreBundle\Type\DoubleType[] |
|
227 | + * @return double[] |
|
228 | 228 | */ |
229 | 229 | public function getArrayOfDoubles() |
230 | 230 | { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | - * @return \Smartbox\CoreBundle\Type\Date[] |
|
243 | + * @return \DateTime[] |
|
244 | 244 | */ |
245 | 245 | public function getArrayOfDates() |
246 | 246 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | - * @return \Smartbox\CoreBundle\Tests\Fixtures\Entity\TestEntity[] |
|
100 | + * @return TestEntity |
|
101 | 101 | */ |
102 | 102 | public function getAssocItems() |
103 | 103 | { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
116 | - * @return Entity[] |
|
116 | + * @return Entity |
|
117 | 117 | */ |
118 | 118 | public function getGenericItems() |
119 | 119 | { |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Smartbox\CoreBundle\Tests\Fixtures\Entity; |
4 | 4 | |
5 | 5 | use JMS\Serializer\Annotation as JMS; |
6 | -use Symfony\Component\Validator\Constraints as Assert; |
|
7 | 6 | use Smartbox\CoreBundle\Type\Entity; |
8 | 7 | |
9 | 8 | class TestNestedEntity extends Entity |
@@ -29,6 +29,9 @@ |
||
29 | 29 | return $kernel; |
30 | 30 | } |
31 | 31 | |
32 | + /** |
|
33 | + * @param string $title |
|
34 | + */ |
|
32 | 35 | protected function createCacheableEntity($title) |
33 | 36 | { |
34 | 37 | $testEntity = new CacheableEntity(); |
@@ -55,6 +55,9 @@ |
||
55 | 55 | $this->validator = $this->createValidator($this->metadataFactory); |
56 | 56 | } |
57 | 57 | |
58 | + /** |
|
59 | + * @param string $groups |
|
60 | + */ |
|
58 | 61 | protected function validate($value, $constraints = null, $groups = null) |
59 | 62 | { |
60 | 63 | return $this->validator->validate($value, $constraints, $groups); |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | { |
88 | 88 | $entity = new Entity(); |
89 | 89 | |
90 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
90 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
91 | 91 | $context->addViolation('Message 1'); |
92 | 92 | }; |
93 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
93 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
94 | 94 | $context->addViolation('Message 2'); |
95 | 95 | }; |
96 | 96 | |
97 | 97 | $this->metadata->addConstraint(new Callback([ |
98 | - 'callback' => function () {}, |
|
98 | + 'callback' => function() {}, |
|
99 | 99 | 'groups' => 'Group 1', |
100 | 100 | ])); |
101 | 101 | $this->metadata->addConstraint(new Callback([ |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | $entity = new Entity(); |
121 | 121 | $entity->reference = new Reference(); |
122 | 122 | |
123 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
123 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
124 | 124 | $context->addViolation('Reference violation 1'); |
125 | 125 | }; |
126 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
126 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
127 | 127 | $context->addViolation('Reference violation 2'); |
128 | 128 | }; |
129 | 129 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $entity = new Entity(); |
152 | 152 | $entity->reference = new Reference(); |
153 | 153 | |
154 | - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
154 | + $callback1 = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
155 | 155 | $violations = $context |
156 | 156 | ->getValidator() |
157 | 157 | // Since the validator is not context aware, the group must |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $context->addViolation('Separate violation'); |
176 | 176 | }; |
177 | 177 | |
178 | - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
178 | + $callback2 = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
179 | 179 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
180 | 180 | $test->assertNull($context->getPropertyName()); |
181 | 181 | $test->assertSame('', $context->getPropertyPath()); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $entity = new Entity(); |
211 | 211 | $entity->reference = new Reference(); |
212 | 212 | |
213 | - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { |
|
213 | + $callback1 = function($value, ExecutionContextInterface $context) use ($test) { |
|
214 | 214 | $previousValue = $context->getValue(); |
215 | 215 | $previousObject = $context->getObject(); |
216 | 216 | $previousMetadata = $context->getMetadata(); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $test->assertSame($previousGroup, $context->getGroup()); |
233 | 233 | }; |
234 | 234 | |
235 | - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
235 | + $callback2 = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
236 | 236 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
237 | 237 | $test->assertNull($context->getPropertyName()); |
238 | 238 | $test->assertSame('subpath', $context->getPropertyPath()); |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $entity = new Entity(); |
275 | 275 | $entity->reference = new Reference(); |
276 | 276 | |
277 | - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { |
|
277 | + $callback1 = function($value, ExecutionContextInterface $context) use ($test) { |
|
278 | 278 | $previousValue = $context->getValue(); |
279 | 279 | $previousObject = $context->getObject(); |
280 | 280 | $previousMetadata = $context->getMetadata(); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $test->assertSame($previousGroup, $context->getGroup()); |
297 | 297 | }; |
298 | 298 | |
299 | - $callback2 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
299 | + $callback2 = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
300 | 300 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
301 | 301 | $test->assertNull($context->getPropertyName()); |
302 | 302 | $test->assertSame('subpath[key]', $context->getPropertyPath()); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $entity = new Entity(); |
339 | 339 | $traversable = new \ArrayIterator(['key' => $entity]); |
340 | 340 | |
341 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { |
|
341 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { |
|
342 | 342 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
343 | 343 | $test->assertNull($context->getPropertyName()); |
344 | 344 | $test->assertSame('[key]', $context->getPropertyPath()); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $entity = new Entity(); |
377 | 377 | $traversable = new \ArrayIterator(['key' => $entity]); |
378 | 378 | |
379 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
379 | + $callback = function($value, ExecutionContextInterface $context) { |
|
380 | 380 | $context->addViolation('Message'); |
381 | 381 | }; |
382 | 382 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $entity = new Entity(); |
402 | 402 | $traversable = new \ArrayIterator(['key' => $entity]); |
403 | 403 | |
404 | - $callback = function ($value, ExecutionContextInterface $context) use ($test) { |
|
404 | + $callback = function($value, ExecutionContextInterface $context) use ($test) { |
|
405 | 405 | $test->fail('Should not be called'); |
406 | 406 | }; |
407 | 407 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $entity = new Entity(); |
439 | 439 | $entity->reference = new \ArrayIterator(['key' => new Reference()]); |
440 | 440 | |
441 | - $callback = function ($value, ExecutionContextInterface $context) use ($test) { |
|
441 | + $callback = function($value, ExecutionContextInterface $context) use ($test) { |
|
442 | 442 | $test->fail('Should not be called'); |
443 | 443 | }; |
444 | 444 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $entity = new Entity(); |
465 | 465 | $entity->reference = new \ArrayIterator(['key' => new Reference()]); |
466 | 466 | |
467 | - $callback = function ($value, ExecutionContextInterface $context) use ($test) { |
|
467 | + $callback = function($value, ExecutionContextInterface $context) use ($test) { |
|
468 | 468 | $test->fail('Should not be called'); |
469 | 469 | }; |
470 | 470 | |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $entity = new Entity(); |
493 | 493 | $entity->reference = new \ArrayIterator(['key' => new Reference()]); |
494 | 494 | |
495 | - $callback = function ($value, ExecutionContextInterface $context) use ($test) { |
|
495 | + $callback = function($value, ExecutionContextInterface $context) use ($test) { |
|
496 | 496 | $test->fail('Should not be called'); |
497 | 497 | }; |
498 | 498 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | { |
519 | 519 | $entity = new Entity(); |
520 | 520 | |
521 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
521 | + $callback = function($value, ExecutionContextInterface $context) { |
|
522 | 522 | $context->buildViolation('Message %param%') |
523 | 523 | ->setParameter('%param%', 'value') |
524 | 524 | ->setInvalidValue('Invalid value') |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | { |
605 | 605 | $entity = new Entity(); |
606 | 606 | |
607 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
607 | + $callback = function($value, ExecutionContextInterface $context) { |
|
608 | 608 | $context->addViolation('Message'); |
609 | 609 | }; |
610 | 610 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | { |
624 | 624 | $entity = new Entity(); |
625 | 625 | |
626 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
626 | + $callback = function($value, ExecutionContextInterface $context) { |
|
627 | 627 | $context->addViolation('Message'); |
628 | 628 | }; |
629 | 629 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | $entity = new Entity(); |
654 | 654 | $entity->firstName = 'Bernhard'; |
655 | 655 | |
656 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, &$called) { |
|
656 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity, &$called) { |
|
657 | 657 | $called = true; |
658 | 658 | $test->assertSame($entity, $context->getObject()); |
659 | 659 | }; |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $initializer1->expects($this->once()) |
680 | 680 | ->method('initialize') |
681 | 681 | ->with($entity) |
682 | - ->will($this->returnCallback(function ($object) { |
|
682 | + ->will($this->returnCallback(function($object) { |
|
683 | 683 | $object->initialized = true; |
684 | 684 | })); |
685 | 685 | |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | // prepare constraint which |
696 | 696 | // * checks that "initialized" is set to true |
697 | 697 | // * validates the object again |
698 | - $callback = function ($object, ExecutionContextInterface $context) use ($test) { |
|
698 | + $callback = function($object, ExecutionContextInterface $context) use ($test) { |
|
699 | 699 | $test->assertTrue($object->initialized); |
700 | 700 | |
701 | 701 | // validate again in same group |
@@ -65,10 +65,22 @@ |
||
65 | 65 | $this->referenceMetadata = null; |
66 | 66 | } |
67 | 67 | |
68 | + /** |
|
69 | + * @param Callback $constraints |
|
70 | + */ |
|
68 | 71 | abstract protected function validate($value, $constraints = null, $groups = null); |
69 | 72 | |
73 | + /** |
|
74 | + * @param string $propertyName |
|
75 | + * @param string $groups |
|
76 | + */ |
|
70 | 77 | abstract protected function validateProperty($object, $propertyName, $groups = null); |
71 | 78 | |
79 | + /** |
|
80 | + * @param string $propertyName |
|
81 | + * @param string $value |
|
82 | + * @param string $groups |
|
83 | + */ |
|
72 | 84 | abstract protected function validatePropertyValue($object, $propertyName, $value, $groups = null); |
73 | 85 | |
74 | 86 | public function testValidate() |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | { |
76 | 76 | $test = $this; |
77 | 77 | |
78 | - $callback = function ($value, ExecutionContextInterface $context) use ($test) { |
|
78 | + $callback = function($value, ExecutionContextInterface $context) use ($test) { |
|
79 | 79 | $test->assertNull($context->getClassName()); |
80 | 80 | $test->assertNull($context->getPropertyName()); |
81 | 81 | $test->assertSame('', $context->getPropertyPath()); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $test = $this; |
112 | 112 | $entity = new Entity(); |
113 | 113 | |
114 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
114 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
115 | 115 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
116 | 116 | $test->assertNull($context->getPropertyName()); |
117 | 117 | $test->assertSame('', $context->getPropertyPath()); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $entity = new Entity(); |
150 | 150 | $entity->firstName = 'Bernhard'; |
151 | 151 | |
152 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
152 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
153 | 153 | $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); |
154 | 154 | |
155 | 155 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $entity = new Entity(); |
190 | 190 | $entity->setLastName('Schussek'); |
191 | 191 | |
192 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
192 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
193 | 193 | $propertyMetadatas = $test->metadata->getPropertyMetadata('lastName'); |
194 | 194 | |
195 | 195 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $entity = new Entity(); |
230 | 230 | $array = ['key' => $entity]; |
231 | 231 | |
232 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { |
|
232 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity, $array) { |
|
233 | 233 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
234 | 234 | $test->assertNull($context->getPropertyName()); |
235 | 235 | $test->assertSame('[key]', $context->getPropertyPath()); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $entity = new Entity(); |
268 | 268 | $array = [2 => ['key' => $entity]]; |
269 | 269 | |
270 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $array) { |
|
270 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity, $array) { |
|
271 | 271 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
272 | 272 | $test->assertNull($context->getPropertyName()); |
273 | 273 | $test->assertSame('[2][key]', $context->getPropertyPath()); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $entity = new Entity(); |
306 | 306 | $traversable = new \ArrayIterator(['key' => $entity]); |
307 | 307 | |
308 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { |
|
308 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { |
|
309 | 309 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
310 | 310 | $test->assertNull($context->getPropertyName()); |
311 | 311 | $test->assertSame('[key]', $context->getPropertyPath()); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | 2 => new \ArrayIterator(['key' => $entity]), |
346 | 346 | ]); |
347 | 347 | |
348 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { |
|
348 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { |
|
349 | 349 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
350 | 350 | $test->assertNull($context->getPropertyName()); |
351 | 351 | $test->assertSame('[2][key]', $context->getPropertyPath()); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $entity = new Entity(); |
384 | 384 | $entity->reference = new Reference(); |
385 | 385 | |
386 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
386 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
387 | 387 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
388 | 388 | $test->assertNull($context->getPropertyName()); |
389 | 389 | $test->assertSame('reference', $context->getPropertyPath()); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $entity->reference = new Reference(); |
424 | 424 | $entity->reference->value = 'Foobar'; |
425 | 425 | |
426 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
426 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
427 | 427 | $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('value'); |
428 | 428 | |
429 | 429 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | $entity->reference = new Reference(); |
466 | 466 | $entity->reference->setPrivateValue('Bamboo'); |
467 | 467 | |
468 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
468 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
469 | 469 | $propertyMetadatas = $test->referenceMetadata->getPropertyMetadata('privateValue'); |
470 | 470 | |
471 | 471 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $entity = new Entity(); |
533 | 533 | $entity->reference = ['key' => new Reference()]; |
534 | 534 | |
535 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
535 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
536 | 536 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
537 | 537 | $test->assertNull($context->getPropertyName()); |
538 | 538 | $test->assertSame('reference[key]', $context->getPropertyPath()); |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $entity = new Entity(); |
573 | 573 | $entity->reference = [2 => ['key' => new Reference()]]; |
574 | 574 | |
575 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
575 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
576 | 576 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
577 | 577 | $test->assertNull($context->getPropertyName()); |
578 | 578 | $test->assertSame('reference[2][key]', $context->getPropertyPath()); |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $entity = new Entity(); |
611 | 611 | $entity->reference = ['key' => new Reference()]; |
612 | 612 | |
613 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
613 | + $callback = function($value, ExecutionContextInterface $context) { |
|
614 | 614 | $context->addViolation('Message %param%', ['%param%' => 'value']); |
615 | 615 | }; |
616 | 616 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | $entity = new Entity(); |
631 | 631 | $entity->reference = [2 => ['key' => new Reference()]]; |
632 | 632 | |
633 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
633 | + $callback = function($value, ExecutionContextInterface $context) { |
|
634 | 634 | $context->addViolation('Message %param%', ['%param%' => 'value']); |
635 | 635 | }; |
636 | 636 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $entity = new Entity(); |
678 | 678 | $entity->reference = new \ArrayIterator(['key' => new Reference()]); |
679 | 679 | |
680 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
680 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
681 | 681 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
682 | 682 | $test->assertNull($context->getPropertyName()); |
683 | 683 | $test->assertSame('reference[key]', $context->getPropertyPath()); |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | $entity = new Entity(); |
716 | 716 | $entity->reference = new \ArrayIterator(['key' => new Reference()]); |
717 | 717 | |
718 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
718 | + $callback = function($value, ExecutionContextInterface $context) { |
|
719 | 719 | $context->addViolation('Message %param%', ['%param%' => 'value']); |
720 | 720 | }; |
721 | 721 | |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | 2 => new \ArrayIterator(['key' => new Reference()]), |
755 | 755 | ]); |
756 | 756 | |
757 | - $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
757 | + $callback = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
758 | 758 | $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); |
759 | 759 | $test->assertNull($context->getPropertyName()); |
760 | 760 | $test->assertSame('reference[2][key]', $context->getPropertyPath()); |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | $entity->firstName = 'Bernhard'; |
797 | 797 | $entity->setLastName('Schussek'); |
798 | 798 | |
799 | - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
799 | + $callback1 = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
800 | 800 | $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); |
801 | 801 | |
802 | 802 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | $context->addViolation('Message %param%', ['%param%' => 'value']); |
812 | 812 | }; |
813 | 813 | |
814 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
814 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
815 | 815 | $context->addViolation('Other violation'); |
816 | 816 | }; |
817 | 817 | |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | $entity = new Entity(); |
872 | 872 | $entity->setLastName('Schussek'); |
873 | 873 | |
874 | - $callback1 = function ($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
874 | + $callback1 = function($value, ExecutionContextInterface $context) use ($test, $entity) { |
|
875 | 875 | $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); |
876 | 876 | |
877 | 877 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | $context->addViolation('Message %param%', ['%param%' => 'value']); |
887 | 887 | }; |
888 | 888 | |
889 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
889 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
890 | 890 | $context->addViolation('Other violation'); |
891 | 891 | }; |
892 | 892 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | { |
923 | 923 | $test = $this; |
924 | 924 | |
925 | - $callback1 = function ($value, ExecutionContextInterface $context) use ($test) { |
|
925 | + $callback1 = function($value, ExecutionContextInterface $context) use ($test) { |
|
926 | 926 | $propertyMetadatas = $test->metadata->getPropertyMetadata('firstName'); |
927 | 927 | |
928 | 928 | $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | $context->addViolation('Message %param%', ['%param%' => 'value']); |
938 | 938 | }; |
939 | 939 | |
940 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
940 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
941 | 941 | $context->addViolation('Other violation'); |
942 | 942 | }; |
943 | 943 | |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | $entity->reference = new Reference(); |
1003 | 1003 | $entity->reference2 = $entity->reference; |
1004 | 1004 | |
1005 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
1005 | + $callback = function($value, ExecutionContextInterface $context) { |
|
1006 | 1006 | $context->addViolation('Message'); |
1007 | 1007 | }; |
1008 | 1008 | |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | $entity->reference = new Reference(); |
1023 | 1023 | $entity->reference2 = new Reference(); |
1024 | 1024 | |
1025 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
1025 | + $callback = function($value, ExecutionContextInterface $context) { |
|
1026 | 1026 | $context->addViolation('Message'); |
1027 | 1027 | }; |
1028 | 1028 | |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | { |
1041 | 1041 | $entity = new Entity(); |
1042 | 1042 | |
1043 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
1043 | + $callback = function($value, ExecutionContextInterface $context) { |
|
1044 | 1044 | $context->addViolation('Message'); |
1045 | 1045 | }; |
1046 | 1046 | |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | { |
1064 | 1064 | $entity = new Entity(); |
1065 | 1065 | |
1066 | - $callback = function ($value, ExecutionContextInterface $context) { |
|
1066 | + $callback = function($value, ExecutionContextInterface $context) { |
|
1067 | 1067 | $context->addViolation('Message'); |
1068 | 1068 | }; |
1069 | 1069 | |
@@ -1086,15 +1086,15 @@ discard block |
||
1086 | 1086 | { |
1087 | 1087 | $entity = new Entity(); |
1088 | 1088 | |
1089 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
1089 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
1090 | 1090 | $context->addViolation('Violation in Group 2'); |
1091 | 1091 | }; |
1092 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
1092 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
1093 | 1093 | $context->addViolation('Violation in Group 3'); |
1094 | 1094 | }; |
1095 | 1095 | |
1096 | 1096 | $this->metadata->addConstraint(new Callback([ |
1097 | - 'callback' => function () {}, |
|
1097 | + 'callback' => function() {}, |
|
1098 | 1098 | 'groups' => 'Group 1', |
1099 | 1099 | ])); |
1100 | 1100 | $this->metadata->addConstraint(new Callback([ |
@@ -1120,15 +1120,15 @@ discard block |
||
1120 | 1120 | { |
1121 | 1121 | $entity = new Entity(); |
1122 | 1122 | |
1123 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
1123 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
1124 | 1124 | $context->addViolation('Violation in Group 2'); |
1125 | 1125 | }; |
1126 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
1126 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
1127 | 1127 | $context->addViolation('Violation in Group 3'); |
1128 | 1128 | }; |
1129 | 1129 | |
1130 | 1130 | $this->metadata->addConstraint(new Callback([ |
1131 | - 'callback' => function () {}, |
|
1131 | + 'callback' => function() {}, |
|
1132 | 1132 | 'groups' => 'Group 1', |
1133 | 1133 | ])); |
1134 | 1134 | $this->metadata->addConstraint(new Callback([ |
@@ -1155,10 +1155,10 @@ discard block |
||
1155 | 1155 | $entity = new Entity(); |
1156 | 1156 | $entity->reference = new Reference(); |
1157 | 1157 | |
1158 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
1158 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
1159 | 1159 | $context->addViolation('Violation in Default group'); |
1160 | 1160 | }; |
1161 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
1161 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
1162 | 1162 | $context->addViolation('Violation in group sequence'); |
1163 | 1163 | }; |
1164 | 1164 | |
@@ -1186,10 +1186,10 @@ discard block |
||
1186 | 1186 | { |
1187 | 1187 | $entity = new Entity(); |
1188 | 1188 | |
1189 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
1189 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
1190 | 1190 | $context->addViolation('Violation in other group'); |
1191 | 1191 | }; |
1192 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
1192 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
1193 | 1193 | $context->addViolation('Violation in group sequence'); |
1194 | 1194 | }; |
1195 | 1195 | |
@@ -1217,16 +1217,16 @@ discard block |
||
1217 | 1217 | $sequence = new GroupSequence(['Group 1', 'Group 2', 'Group 3', 'Entity']); |
1218 | 1218 | $entity = new GroupSequenceProviderEntity($sequence); |
1219 | 1219 | |
1220 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
1220 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
1221 | 1221 | $context->addViolation('Violation in Group 2'); |
1222 | 1222 | }; |
1223 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
1223 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
1224 | 1224 | $context->addViolation('Violation in Group 3'); |
1225 | 1225 | }; |
1226 | 1226 | |
1227 | 1227 | $metadata = new ClassMetadata(get_class($entity)); |
1228 | 1228 | $metadata->addConstraint(new Callback([ |
1229 | - 'callback' => function () {}, |
|
1229 | + 'callback' => function() {}, |
|
1230 | 1230 | 'groups' => 'Group 1', |
1231 | 1231 | ])); |
1232 | 1232 | $metadata->addConstraint(new Callback([ |
@@ -1253,16 +1253,16 @@ discard block |
||
1253 | 1253 | $sequence = ['Group 1', 'Group 2', 'Group 3', 'Entity']; |
1254 | 1254 | $entity = new GroupSequenceProviderEntity($sequence); |
1255 | 1255 | |
1256 | - $callback1 = function ($value, ExecutionContextInterface $context) { |
|
1256 | + $callback1 = function($value, ExecutionContextInterface $context) { |
|
1257 | 1257 | $context->addViolation('Violation in Group 2'); |
1258 | 1258 | }; |
1259 | - $callback2 = function ($value, ExecutionContextInterface $context) { |
|
1259 | + $callback2 = function($value, ExecutionContextInterface $context) { |
|
1260 | 1260 | $context->addViolation('Violation in Group 3'); |
1261 | 1261 | }; |
1262 | 1262 | |
1263 | 1263 | $metadata = new ClassMetadata(get_class($entity)); |
1264 | 1264 | $metadata->addConstraint(new Callback([ |
1265 | - 'callback' => function () {}, |
|
1265 | + 'callback' => function() {}, |
|
1266 | 1266 | 'groups' => 'Group 1', |
1267 | 1267 | ])); |
1268 | 1268 | $metadata->addConstraint(new Callback([ |
@@ -20,7 +20,7 @@ |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
23 | - * @param $method |
|
23 | + * @param string $method |
|
24 | 24 | * @param array $arguments |
25 | 25 | * @param null $result |
26 | 26 | */ |
@@ -93,8 +93,8 @@ |
||
93 | 93 | /** |
94 | 94 | * @param $typeName |
95 | 95 | * @param array|null $typeParams |
96 | - * @param null $group |
|
97 | - * @param null $version |
|
96 | + * @param string $group |
|
97 | + * @param string $version |
|
98 | 98 | * |
99 | 99 | * @return float|int|string|array|\DateTime|EntityInterface |
100 | 100 | */ |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | $types = ['DateTime', 'DateInterval']; |
33 | 33 | |
34 | - $newFormats = ['array']; // Add here any new format you wish to support |
|
34 | + $newFormats = ['array']; // Add here any new format you wish to support |
|
35 | 35 | |
36 | 36 | foreach ($newFormats as $format) { |
37 | 37 | $methods[] = [ |