Skip to content

Commit

Permalink
next review
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Oct 3, 2020
1 parent 9d9b21a commit 87fbb8e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Form/ChoiceList/ModelChoiceLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ final class ModelChoiceLoader implements ChoiceLoaderInterface
private $propertyAccessor;

/**
* @var string|null
* @var string
*
* @phpstan-var class-string|null
* @phpstan-var class-string
*/
private $class;

Expand Down Expand Up @@ -72,7 +72,7 @@ final class ModelChoiceLoader implements ChoiceLoaderInterface
public function __construct(
ModelManagerInterface $modelManager,
PropertyAccessorInterface $propertyAccessor,
?string $class = null,
string $class,
?string $property = null,
?object $query = null,
array $choices = []
Expand Down
2 changes: 1 addition & 1 deletion tests/Form/ChoiceList/ModelChoiceLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testConstructWithUnsupportedQuery(): void
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The model manager does not support the query.');

new ModelChoiceLoader($this->modelManager, $this->propertyAccessor, null, null, new \stdClass());
new ModelChoiceLoader($this->modelManager, $this->propertyAccessor, \stdClass::class, null, new \stdClass());
}

public function testLoadFromEntityWithSamePropertyValues(): void
Expand Down
8 changes: 4 additions & 4 deletions tests/Form/Type/ModelTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public function testGetDefaultOptions(): void

$this->type->configureOptions($optionResolver);

$options = $optionResolver->resolve(['model_manager' => $modelManager, 'choices' => []]);
$options = $optionResolver->resolve(['model_manager' => $modelManager, 'class' => \stdClass::class, 'choices' => []]);

$this->assertFalse($options['compound']);
$this->assertSame('choice', $options['template']);
$this->assertFalse($options['multiple']);
$this->assertFalse($options['expanded']);
$this->assertInstanceOf(ModelManagerInterface::class, $options['model_manager']);
$this->assertNull($options['class']);
$this->assertSame(\stdClass::class, $options['class']);
$this->assertNull($options['property']);
$this->assertNull($options['query']);
$this->assertCount(0, $options['choices']);
Expand All @@ -68,14 +68,14 @@ public function testCompoundOption(bool $expectedCompound, bool $multiple, bool

$this->type->configureOptions($optionResolver);

$options = $optionResolver->resolve(['model_manager' => $modelManager, 'choices' => [], 'multiple' => $multiple, 'expanded' => $expanded]);
$options = $optionResolver->resolve(['model_manager' => $modelManager,'class' => \stdClass::class, 'choices' => [], 'multiple' => $multiple, 'expanded' => $expanded]);

$this->assertSame($expectedCompound, $options['compound']);
$this->assertSame('choice', $options['template']);
$this->assertSame($multiple, $options['multiple']);
$this->assertSame($expanded, $options['expanded']);
$this->assertInstanceOf(ModelManagerInterface::class, $options['model_manager']);
$this->assertNull($options['class']);
$this->assertSame(\stdClass::class, $options['class']);
$this->assertNull($options['property']);
$this->assertNull($options['query']);
$this->assertCount(0, $options['choices']);
Expand Down

0 comments on commit 87fbb8e

Please sign in to comment.