@@ -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): "; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if ($result) { |
| 235 | - $result = (int)$result; |
|
| 235 | + $result = (int) $result; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | break; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if ($result) { |
| 248 | - $result = (float)$result; |
|
| 248 | + $result = (float) $result; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | break; |
@@ -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 |
@@ -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 | */ |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $arrayData = $this->serializer->serialize($data, 'array'); |
| 46 | 46 | $this->assertEquals( |
| 47 | 47 | [ |
| 48 | - 'internalType' => TestEntity::class, // We are using the IdenticalPropertyNamingStrategy |
|
| 48 | + 'internalType' => TestEntity::class, // We are using the IdenticalPropertyNamingStrategy |
|
| 49 | 49 | 'title' => 'some title', |
| 50 | 50 | 'description' => 'some description', |
| 51 | 51 | 'note' => 'some note', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $arrayData = $this->serializer->serialize($data, 'array', $context); |
| 71 | 71 | $this->assertEquals( |
| 72 | 72 | [ |
| 73 | - 'internalType' => TestEntity::class, // We are using the IdenticalPropertyNamingStrategy |
|
| 73 | + 'internalType' => TestEntity::class, // We are using the IdenticalPropertyNamingStrategy |
|
| 74 | 74 | 'title' => 'some title', |
| 75 | 75 | 'note' => 'some note', |
| 76 | 76 | ], |
@@ -95,8 +95,8 @@ |
||
| 95 | 95 | /** |
| 96 | 96 | * @param $typeName |
| 97 | 97 | * @param array|null $typeParams |
| 98 | - * @param null $group |
|
| 99 | - * @param null $version |
|
| 98 | + * @param string $group |
|
| 99 | + * @param string $version |
|
| 100 | 100 | * |
| 101 | 101 | * @return float|int|string|array|\DateTime|EntityInterface |
| 102 | 102 | * |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $testNames = $this->getTestNames(); |
| 119 | 119 | $smokeTests = \array_filter( |
| 120 | 120 | $smokeTests, |
| 121 | - function ($key) use ($test) { |
|
| 121 | + function($key) use ($test) { |
|
| 122 | 122 | return $key === $test; |
| 123 | 123 | }, |
| 124 | 124 | ARRAY_FILTER_USE_KEY |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if (!empty($skipTests)) { |
| 152 | 152 | $smokeTests = \array_filter( |
| 153 | 153 | $smokeTests, |
| 154 | - function ($smokeTestInfo) use ($skipTests, &$skipped) { |
|
| 154 | + function($smokeTestInfo) use ($skipTests, &$skipped) { |
|
| 155 | 155 | $key = $smokeTestInfo['id']; |
| 156 | 156 | $skipping = \in_array($key, $skipTests); |
| 157 | 157 | if ($skipping) { |