Skip to content

Commit 351010a

Browse files
committed
Use ::class keyword when possible
1 parent b224c5b commit 351010a

File tree

72 files changed

+347
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+347
-347
lines changed

Extension/Core/Type/DateType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
124124
$dateFormat,
125125
$timeFormat,
126126
// see https://bugs.php.net/66323
127-
class_exists('IntlTimeZone', false) ? \IntlTimeZone::createDefault() : null,
127+
class_exists(\IntlTimeZone::class, false) ? \IntlTimeZone::createDefault() : null,
128128
$calendar,
129129
$pattern
130130
);

Extension/Core/Type/FileType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
121121
public function configureOptions(OptionsResolver $resolver)
122122
{
123123
$dataClass = null;
124-
if (class_exists('Symfony\Component\HttpFoundation\File\File')) {
124+
if (class_exists(\Symfony\Component\HttpFoundation\File\File::class)) {
125125
$dataClass = function (Options $options) {
126126
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
127127
};

Tests/AbstractExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testHasType()
2828
public function testGetType()
2929
{
3030
$loader = new ConcreteExtension();
31-
$this->assertInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType', $loader->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
31+
$this->assertInstanceOf(FooType::class, $loader->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
3232
}
3333
}
3434

Tests/AbstractFormTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ abstract class AbstractFormTest extends TestCase
3838
protected function setUp(): void
3939
{
4040
$this->dispatcher = new EventDispatcher();
41-
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
41+
$this->factory = $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock();
4242
$this->form = $this->createForm();
4343
}
4444

@@ -58,16 +58,16 @@ protected function getBuilder(?string $name = 'name', EventDispatcherInterface $
5858

5959
protected function getDataMapper(): MockObject
6060
{
61-
return $this->getMockBuilder('Symfony\Component\Form\DataMapperInterface')->getMock();
61+
return $this->getMockBuilder(\Symfony\Component\Form\DataMapperInterface::class)->getMock();
6262
}
6363

6464
protected function getDataTransformer(): MockObject
6565
{
66-
return $this->getMockBuilder('Symfony\Component\Form\DataTransformerInterface')->getMock();
66+
return $this->getMockBuilder(\Symfony\Component\Form\DataTransformerInterface::class)->getMock();
6767
}
6868

6969
protected function getFormValidator(): MockObject
7070
{
71-
return $this->getMockBuilder('Symfony\Component\Form\FormValidatorInterface')->getMock();
71+
return $this->getMockBuilder(\Symfony\Component\Form\FormValidatorInterface::class)->getMock();
7272
}
7373
}

Tests/AbstractLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function setUp(): void
3434

3535
\Locale::setDefault('en');
3636

37-
$this->csrfTokenManager = $this->getMockBuilder('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface')->getMock();
37+
$this->csrfTokenManager = $this->getMockBuilder(\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface::class)->getMock();
3838

3939
parent::setUp();
4040
}

Tests/AbstractRequestHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class AbstractRequestHandlerTest extends TestCase
4242

4343
protected function setUp(): void
4444
{
45-
$this->serverParams = $this->getMockBuilder('Symfony\Component\Form\Util\ServerParams')->setMethods(['getNormalizedIniPostMaxSize', 'getContentLength'])->getMock();
45+
$this->serverParams = $this->getMockBuilder(\Symfony\Component\Form\Util\ServerParams::class)->setMethods(['getNormalizedIniPostMaxSize', 'getContentLength'])->getMock();
4646
$this->requestHandler = $this->getRequestHandler();
4747
$this->factory = Forms::createFormFactoryBuilder()->getFormFactory();
4848
$this->request = null;
@@ -405,7 +405,7 @@ protected function createForm($name, $method = null, $compound = false)
405405

406406
protected function createBuilder($name, $compound = false, array $options = [])
407407
{
408-
$builder = new FormBuilder($name, null, new EventDispatcher(), $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock(), $options);
408+
$builder = new FormBuilder($name, null, new EventDispatcher(), $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock(), $options);
409409
$builder->setCompound($compound);
410410

411411
if ($compound) {

Tests/AbstractTypeExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AbstractTypeExtensionTest extends TestCase
2121
*/
2222
public function testImplementingNeitherGetExtendedTypeNorExtendsTypeThrowsException()
2323
{
24-
$this->expectException('Symfony\Component\Form\Exception\LogicException');
24+
$this->expectException(\Symfony\Component\Form\Exception\LogicException::class);
2525
$this->expectExceptionMessage('You need to implement the static getExtendedTypes() method when implementing the "Symfony\Component\Form\FormTypeExtensionInterface" in "Symfony\Component\Form\Tests\TypeExtensionWithoutExtendedTypes".');
2626
$extension = new TypeExtensionWithoutExtendedTypes();
2727
$extension->getExtendedType();

Tests/ButtonTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ class ButtonTest extends TestCase
2626

2727
protected function setUp(): void
2828
{
29-
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')->getMock();
30-
$this->factory = $this->getMockBuilder('Symfony\Component\Form\FormFactoryInterface')->getMock();
29+
$this->dispatcher = $this->getMockBuilder(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class)->getMock();
30+
$this->factory = $this->getMockBuilder(\Symfony\Component\Form\FormFactoryInterface::class)->getMock();
3131
}
3232

3333
public function testSetParentOnSubmittedButton()
3434
{
35-
$this->expectException('Symfony\Component\Form\Exception\AlreadySubmittedException');
35+
$this->expectException(\Symfony\Component\Form\Exception\AlreadySubmittedException::class);
3636
$button = $this->getButtonBuilder('button')
3737
->getForm()
3838
;

Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CachingFactoryDecoratorTest extends TestCase
3434

3535
protected function setUp(): void
3636
{
37-
$this->decoratedFactory = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface')->getMock();
37+
$this->decoratedFactory = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface::class)->getMock();
3838
$this->factory = new CachingFactoryDecorator($this->decoratedFactory);
3939
}
4040

@@ -163,7 +163,7 @@ public function testCreateFromChoicesDifferentValueClosure()
163163

164164
public function testCreateFromLoaderSameLoader()
165165
{
166-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
166+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
167167
$list = new ArrayChoiceList([]);
168168

169169
$this->decoratedFactory->expects($this->once())
@@ -177,8 +177,8 @@ public function testCreateFromLoaderSameLoader()
177177

178178
public function testCreateFromLoaderDifferentLoader()
179179
{
180-
$loader1 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
181-
$loader2 = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
180+
$loader1 = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
181+
$loader2 = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
182182
$list1 = new ArrayChoiceList([]);
183183
$list2 = new ArrayChoiceList([]);
184184

@@ -196,7 +196,7 @@ public function testCreateFromLoaderDifferentLoader()
196196

197197
public function testCreateFromLoaderSameValueClosure()
198198
{
199-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
199+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
200200
$list = new ArrayChoiceList([]);
201201
$closure = function () {};
202202

@@ -211,7 +211,7 @@ public function testCreateFromLoaderSameValueClosure()
211211

212212
public function testCreateFromLoaderDifferentValueClosure()
213213
{
214-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
214+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
215215
$list1 = new ArrayChoiceList([]);
216216
$list2 = new ArrayChoiceList([]);
217217
$closure1 = function () {};
@@ -232,7 +232,7 @@ public function testCreateFromLoaderDifferentValueClosure()
232232
public function testCreateViewSamePreferredChoices()
233233
{
234234
$preferred = ['a'];
235-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
235+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
236236
$view = new ChoiceListView();
237237

238238
$this->decoratedFactory->expects($this->once())
@@ -248,7 +248,7 @@ public function testCreateViewDifferentPreferredChoices()
248248
{
249249
$preferred1 = ['a'];
250250
$preferred2 = ['b'];
251-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
251+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
252252
$view1 = new ChoiceListView();
253253
$view2 = new ChoiceListView();
254254

@@ -267,7 +267,7 @@ public function testCreateViewDifferentPreferredChoices()
267267
public function testCreateViewSamePreferredChoicesClosure()
268268
{
269269
$preferred = function () {};
270-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
270+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
271271
$view = new ChoiceListView();
272272

273273
$this->decoratedFactory->expects($this->once())
@@ -283,7 +283,7 @@ public function testCreateViewDifferentPreferredChoicesClosure()
283283
{
284284
$preferred1 = function () {};
285285
$preferred2 = function () {};
286-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
286+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
287287
$view1 = new ChoiceListView();
288288
$view2 = new ChoiceListView();
289289

@@ -302,7 +302,7 @@ public function testCreateViewDifferentPreferredChoicesClosure()
302302
public function testCreateViewSameLabelClosure()
303303
{
304304
$labels = function () {};
305-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
305+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
306306
$view = new ChoiceListView();
307307

308308
$this->decoratedFactory->expects($this->once())
@@ -318,7 +318,7 @@ public function testCreateViewDifferentLabelClosure()
318318
{
319319
$labels1 = function () {};
320320
$labels2 = function () {};
321-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
321+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
322322
$view1 = new ChoiceListView();
323323
$view2 = new ChoiceListView();
324324

@@ -337,7 +337,7 @@ public function testCreateViewDifferentLabelClosure()
337337
public function testCreateViewSameIndexClosure()
338338
{
339339
$index = function () {};
340-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
340+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
341341
$view = new ChoiceListView();
342342

343343
$this->decoratedFactory->expects($this->once())
@@ -353,7 +353,7 @@ public function testCreateViewDifferentIndexClosure()
353353
{
354354
$index1 = function () {};
355355
$index2 = function () {};
356-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
356+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
357357
$view1 = new ChoiceListView();
358358
$view2 = new ChoiceListView();
359359

@@ -372,7 +372,7 @@ public function testCreateViewDifferentIndexClosure()
372372
public function testCreateViewSameGroupByClosure()
373373
{
374374
$groupBy = function () {};
375-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
375+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
376376
$view = new ChoiceListView();
377377

378378
$this->decoratedFactory->expects($this->once())
@@ -388,7 +388,7 @@ public function testCreateViewDifferentGroupByClosure()
388388
{
389389
$groupBy1 = function () {};
390390
$groupBy2 = function () {};
391-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
391+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
392392
$view1 = new ChoiceListView();
393393
$view2 = new ChoiceListView();
394394

@@ -407,7 +407,7 @@ public function testCreateViewDifferentGroupByClosure()
407407
public function testCreateViewSameAttributes()
408408
{
409409
$attr = ['class' => 'foobar'];
410-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
410+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
411411
$view = new ChoiceListView();
412412

413413
$this->decoratedFactory->expects($this->once())
@@ -423,7 +423,7 @@ public function testCreateViewDifferentAttributes()
423423
{
424424
$attr1 = ['class' => 'foobar1'];
425425
$attr2 = ['class' => 'foobar2'];
426-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
426+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
427427
$view1 = new ChoiceListView();
428428
$view2 = new ChoiceListView();
429429

@@ -442,7 +442,7 @@ public function testCreateViewDifferentAttributes()
442442
public function testCreateViewSameAttributesClosure()
443443
{
444444
$attr = function () {};
445-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
445+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
446446
$view = new ChoiceListView();
447447

448448
$this->decoratedFactory->expects($this->once())
@@ -458,7 +458,7 @@ public function testCreateViewDifferentAttributesClosure()
458458
{
459459
$attr1 = function () {};
460460
$attr2 = function () {};
461-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
461+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
462462
$view1 = new ChoiceListView();
463463
$view2 = new ChoiceListView();
464464

Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function ($object) { return $object->value; }
193193

194194
public function testCreateFromLoader()
195195
{
196-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
196+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
197197

198198
$list = $this->factory->createListFromLoader($loader);
199199

@@ -202,7 +202,7 @@ public function testCreateFromLoader()
202202

203203
public function testCreateFromLoaderWithValues()
204204
{
205-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
205+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
206206

207207
$value = function () {};
208208
$list = $this->factory->createListFromLoader($loader, $value);

0 commit comments

Comments
 (0)