Skip to content

Commit d2ea292

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Use ::class keyword when possible
2 parents 23d63ae + 351010a commit d2ea292

File tree

63 files changed

+259
-259
lines changed

Some content is hidden

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

63 files changed

+259
-259
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
@@ -114,7 +114,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
114114
public function configureOptions(OptionsResolver $resolver)
115115
{
116116
$dataClass = null;
117-
if (class_exists('Symfony\Component\HttpFoundation\File\File')) {
117+
if (class_exists(\Symfony\Component\HttpFoundation\File\File::class)) {
118118
$dataClass = function (Options $options) {
119119
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
120120
};

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/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/DefaultChoiceListFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function ($choice) {
247247

248248
public function testCreateFromLoader()
249249
{
250-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
250+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
251251

252252
$list = $this->factory->createListFromLoader($loader);
253253

@@ -256,7 +256,7 @@ public function testCreateFromLoader()
256256

257257
public function testCreateFromLoaderWithValues()
258258
{
259-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
259+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
260260

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

Tests/ChoiceList/Factory/PropertyAccessDecoratorTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PropertyAccessDecoratorTest extends TestCase
3535

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

@@ -110,7 +110,7 @@ public function testCreateFromChoicesFilterPropertyPathInstance()
110110

111111
public function testCreateFromLoaderPropertyPath()
112112
{
113-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
113+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
114114

115115
$this->decoratedFactory->expects($this->once())
116116
->method('createListFromLoader')
@@ -160,7 +160,7 @@ public function testCreateFromChoicesAssumeNullIfValuePropertyPathUnreadable()
160160
// https://github.com/symfony/symfony/issues/5494
161161
public function testCreateFromChoiceLoaderAssumeNullIfValuePropertyPathUnreadable()
162162
{
163-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
163+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
164164

165165
$this->decoratedFactory->expects($this->once())
166166
->method('createListFromLoader')
@@ -174,7 +174,7 @@ public function testCreateFromChoiceLoaderAssumeNullIfValuePropertyPathUnreadabl
174174

175175
public function testCreateFromLoaderPropertyPathInstance()
176176
{
177-
$loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
177+
$loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
178178

179179
$this->decoratedFactory->expects($this->once())
180180
->method('createListFromLoader')
@@ -188,7 +188,7 @@ public function testCreateFromLoaderPropertyPathInstance()
188188

189189
public function testCreateViewPreferredChoicesAsPropertyPath()
190190
{
191-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
191+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
192192

193193
$this->decoratedFactory->expects($this->once())
194194
->method('createView')
@@ -202,7 +202,7 @@ public function testCreateViewPreferredChoicesAsPropertyPath()
202202

203203
public function testCreateViewPreferredChoicesAsPropertyPathInstance()
204204
{
205-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
205+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
206206

207207
$this->decoratedFactory->expects($this->once())
208208
->method('createView')
@@ -217,7 +217,7 @@ public function testCreateViewPreferredChoicesAsPropertyPathInstance()
217217
// https://github.com/symfony/symfony/issues/5494
218218
public function testCreateViewAssumeNullIfPreferredChoicesPropertyPathUnreadable()
219219
{
220-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
220+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
221221

222222
$this->decoratedFactory->expects($this->once())
223223
->method('createView')
@@ -231,7 +231,7 @@ public function testCreateViewAssumeNullIfPreferredChoicesPropertyPathUnreadable
231231

232232
public function testCreateViewLabelsAsPropertyPath()
233233
{
234-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
234+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
235235

236236
$this->decoratedFactory->expects($this->once())
237237
->method('createView')
@@ -245,7 +245,7 @@ public function testCreateViewLabelsAsPropertyPath()
245245

246246
public function testCreateViewLabelsAsPropertyPathInstance()
247247
{
248-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
248+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
249249

250250
$this->decoratedFactory->expects($this->once())
251251
->method('createView')
@@ -259,7 +259,7 @@ public function testCreateViewLabelsAsPropertyPathInstance()
259259

260260
public function testCreateViewIndicesAsPropertyPath()
261261
{
262-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
262+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
263263

264264
$this->decoratedFactory->expects($this->once())
265265
->method('createView')
@@ -273,7 +273,7 @@ public function testCreateViewIndicesAsPropertyPath()
273273

274274
public function testCreateViewIndicesAsPropertyPathInstance()
275275
{
276-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
276+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
277277

278278
$this->decoratedFactory->expects($this->once())
279279
->method('createView')
@@ -287,7 +287,7 @@ public function testCreateViewIndicesAsPropertyPathInstance()
287287

288288
public function testCreateViewGroupsAsPropertyPath()
289289
{
290-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
290+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
291291

292292
$this->decoratedFactory->expects($this->once())
293293
->method('createView')
@@ -301,7 +301,7 @@ public function testCreateViewGroupsAsPropertyPath()
301301

302302
public function testCreateViewGroupsAsPropertyPathInstance()
303303
{
304-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
304+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
305305

306306
$this->decoratedFactory->expects($this->once())
307307
->method('createView')
@@ -316,7 +316,7 @@ public function testCreateViewGroupsAsPropertyPathInstance()
316316
// https://github.com/symfony/symfony/issues/5494
317317
public function testCreateViewAssumeNullIfGroupsPropertyPathUnreadable()
318318
{
319-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
319+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
320320

321321
$this->decoratedFactory->expects($this->once())
322322
->method('createView')
@@ -330,7 +330,7 @@ public function testCreateViewAssumeNullIfGroupsPropertyPathUnreadable()
330330

331331
public function testCreateViewAttrAsPropertyPath()
332332
{
333-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
333+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
334334

335335
$this->decoratedFactory->expects($this->once())
336336
->method('createView')
@@ -344,7 +344,7 @@ public function testCreateViewAttrAsPropertyPath()
344344

345345
public function testCreateViewAttrAsPropertyPathInstance()
346346
{
347-
$list = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
347+
$list = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
348348

349349
$this->decoratedFactory->expects($this->once())
350350
->method('createView')

Tests/ChoiceList/LazyChoiceListTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class LazyChoiceListTest extends TestCase
3939

4040
protected function setUp(): void
4141
{
42-
$this->loadedList = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\ChoiceListInterface')->getMock();
43-
$this->loader = $this->getMockBuilder('Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface')->getMock();
42+
$this->loadedList = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\ChoiceListInterface::class)->getMock();
43+
$this->loader = $this->getMockBuilder(\Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface::class)->getMock();
4444
$this->value = function () {};
4545
$this->list = new LazyChoiceList($this->loader, $this->value);
4646
}

0 commit comments

Comments
 (0)