Skip to content

Commit 23d63ae

Browse files
committed
Use ::class keyword when possible
1 parent f3b24e8 commit 23d63ae

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public function configureOptions(OptionsResolver $resolver)
352352
$resolver->setAllowedTypes('choice_name', ['null', 'callable', 'string', PropertyPath::class, ChoiceFieldName::class]);
353353
$resolver->setAllowedTypes('choice_value', ['null', 'callable', 'string', PropertyPath::class, ChoiceValue::class]);
354354
$resolver->setAllowedTypes('choice_attr', ['null', 'array', 'callable', 'string', PropertyPath::class, ChoiceAttr::class]);
355-
$resolver->setAllowedTypes('preferred_choices', ['array', '\Traversable', 'callable', 'string', PropertyPath::class, PreferredChoice::class]);
355+
$resolver->setAllowedTypes('preferred_choices', ['array', \Traversable::class, 'callable', 'string', PropertyPath::class, PreferredChoice::class]);
356356
$resolver->setAllowedTypes('group_by', ['null', 'callable', 'string', PropertyPath::class, GroupBy::class]);
357357
}
358358

Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testCreateFromChoicesFilterPropertyPath()
7878

7979
$this->decoratedFactory->expects($this->once())
8080
->method('createListFromChoices')
81-
->with($choices, $this->isInstanceOf('\Closure'), $this->isInstanceOf('\Closure'))
81+
->with($choices, $this->isInstanceOf(\Closure::class), $this->isInstanceOf(\Closure::class))
8282
->willReturnCallback(function ($choices, $value, $callback) {
8383
return new ArrayChoiceList(array_map($value, array_filter($choices, $callback)));
8484
});
@@ -97,7 +97,7 @@ public function testCreateFromChoicesFilterPropertyPathInstance()
9797

9898
$this->decoratedFactory->expects($this->once())
9999
->method('createListFromChoices')
100-
->with($choices, $this->isInstanceOf('\Closure'), $this->isInstanceOf('\Closure'))
100+
->with($choices, $this->isInstanceOf(\Closure::class), $this->isInstanceOf(\Closure::class))
101101
->willReturnCallback(function ($choices, $value, $callback) {
102102
return new ArrayChoiceList(array_map($value, array_filter($choices, $callback)));
103103
});
@@ -134,7 +134,7 @@ public function testCreateFromLoaderFilterPropertyPath()
134134

135135
$this->decoratedFactory->expects($this->once())
136136
->method('createListFromLoader')
137-
->with($loader, $this->isInstanceOf('\Closure'), $this->isInstanceOf('\Closure'))
137+
->with($loader, $this->isInstanceOf(\Closure::class), $this->isInstanceOf(\Closure::class))
138138
->willReturnCallback(function ($loader, $value, $callback) use ($choices) {
139139
return new ArrayChoiceList(array_map($value, array_filter($choices, $callback)));
140140
});

Tests/CompoundFormTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Form\FormView;
2323
use Symfony\Component\Form\SubmitButtonBuilder;
2424
use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer;
25+
use Symfony\Component\Form\Util\InheritDataAwareIterator;
2526
use Symfony\Component\HttpFoundation\File\UploadedFile;
2627
use Symfony\Component\HttpFoundation\Request;
2728

@@ -513,9 +514,9 @@ public function testSubmitMapsSubmittedChildrenOntoExistingViewData()
513514

514515
$mapper->expects($this->once())
515516
->method('mapFormsToData')
516-
->with($this->isInstanceOf('\RecursiveIteratorIterator'), 'bar')
517+
->with($this->isInstanceOf(\RecursiveIteratorIterator::class), 'bar')
517518
->willReturnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2) {
518-
$this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
519+
$this->assertInstanceOf(InheritDataAwareIterator::class, $iterator->getInnerIterator());
519520
$this->assertSame(['firstName' => $child1, 'lastName' => $child2], iterator_to_array($iterator));
520521
$this->assertEquals('Bernhard', $child1->getData());
521522
$this->assertEquals('Schussek', $child2->getData());
@@ -585,9 +586,9 @@ public function testSubmitMapsSubmittedChildrenOntoEmptyData()
585586

586587
$mapper->expects($this->once())
587588
->method('mapFormsToData')
588-
->with($this->isInstanceOf('\RecursiveIteratorIterator'), $object)
589+
->with($this->isInstanceOf(\RecursiveIteratorIterator::class), $object)
589590
->willReturnCallback(function (\RecursiveIteratorIterator $iterator) use ($child) {
590-
$this->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
591+
$this->assertInstanceOf(InheritDataAwareIterator::class, $iterator->getInnerIterator());
591592
$this->assertSame(['name' => $child], iterator_to_array($iterator));
592593
});
593594

Tests/SimpleFormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ public function testViewDataMayBeObjectIfDataClassIsNull()
882882

883883
public function testViewDataMayBeArrayAccessIfDataClassIsNull()
884884
{
885-
$arrayAccess = $this->getMockBuilder('\ArrayAccess')->getMock();
885+
$arrayAccess = $this->getMockBuilder(\ArrayAccess::class)->getMock();
886886
$config = new FormConfigBuilder('name', null, $this->dispatcher);
887887
$config->addViewTransformer(new FixedDataTransformer([
888888
'' => '',

0 commit comments

Comments
 (0)