Skip to content

Commit 98ba9d2

Browse files
minor #57961 [Form] Replace class-string by ::class for BaseTypeTestCase::TESTED_TYPE (alexandre-daubois)
This PR was merged into the 7.2 branch. Discussion ---------- [Form] Replace class-string by `::class` for `BaseTypeTestCase::TESTED_TYPE` | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT This change seems to be already operated on the most recent types (Color, Uuid, Ulid, Enum, ...). I propose to put it all together and use `::class` notation for `BaseTypeTestCase::TESTED_TYPE` overriders. Commits ------- ba006c120e [Form] Replace class-string by `::class` for `BaseTypeTestCase::TESTED_TYPE`
2 parents a9dbd19 + e6f7254 commit 98ba9d2

25 files changed

+51
-25
lines changed

Tests/Extension/Core/Type/BirthdayTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

14+
use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
1415
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
1516

1617
/**
1718
* @author Stepan Anchugov <[email protected]>
1819
*/
1920
class BirthdayTypeTest extends DateTypeTest
2021
{
21-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\BirthdayType';
22+
public const TESTED_TYPE = BirthdayType::class;
2223

2324
public function testSetInvalidYearsOption()
2425
{

Tests/Extension/Core/Type/ButtonTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
use Symfony\Component\Form\Button;
1515
use Symfony\Component\Form\Exception\BadMethodCallException;
1616
use Symfony\Component\Form\Exception\LogicException;
17+
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
1718
use Symfony\Component\Form\Extension\Core\Type\FormType;
1819

1920
/**
2021
* @author Bernhard Schussek <[email protected]>
2122
*/
2223
class ButtonTypeTest extends BaseTypeTestCase
2324
{
24-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ButtonType';
25+
public const TESTED_TYPE = ButtonType::class;
2526

2627
public function testCreateButtonInstances()
2728
{

Tests/Extension/Core/Type/CheckboxTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\CallbackTransformer;
15+
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
1516
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
1617

1718
class CheckboxTypeTest extends BaseTypeTestCase
1819
{
19-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CheckboxType';
20+
public const TESTED_TYPE = CheckboxType::class;
2021

2122
public function testDataIsFalseByDefault()
2223
{

Tests/Extension/Core/Type/ChoiceTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
1616
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
1717
use Symfony\Component\Form\Exception\TransformationFailedException;
18+
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
1819
use Symfony\Component\Form\FormInterface;
1920
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
2021

2122
class ChoiceTypeTest extends BaseTypeTestCase
2223
{
23-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
24+
public const TESTED_TYPE = ChoiceType::class;
2425

2526
private array $choices = [
2627
'Bernhard' => 'a',

Tests/Extension/Core/Type/ChoiceTypeTranslationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Extension\Core\CoreExtension;
15+
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
1516
use Symfony\Component\Form\Test\TypeTestCase;
1617
use Symfony\Contracts\Translation\TranslatorInterface;
1718

1819
class ChoiceTypeTranslationTest extends TypeTestCase
1920
{
20-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
21+
public const TESTED_TYPE = ChoiceType::class;
2122

2223
private array $choices = [
2324
'Bernhard' => 'a',

Tests/Extension/Core/Type/CollectionTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313

1414
use Symfony\Component\Form\Exception\UnexpectedTypeException;
1515
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
16+
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
1617
use Symfony\Component\Form\Form;
1718
use Symfony\Component\Form\Tests\Fixtures\Author;
1819
use Symfony\Component\Form\Tests\Fixtures\AuthorType;
1920
use Symfony\Component\Form\Tests\Fixtures\BlockPrefixedFooTextType;
2021

2122
class CollectionTypeTest extends BaseTypeTestCase
2223
{
23-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CollectionType';
24+
public const TESTED_TYPE = CollectionType::class;
2425

2526
public function testContainsNoChildByDefault()
2627
{

Tests/Extension/Core/Type/CountryTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
15+
use Symfony\Component\Form\Extension\Core\Type\CountryType;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
class CountryTypeTest extends BaseTypeTestCase
1819
{
19-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CountryType';
20+
public const TESTED_TYPE = CountryType::class;
2021

2122
protected function setUp(): void
2223
{

Tests/Extension/Core/Type/CurrencyTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
15+
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

1718
class CurrencyTypeTest extends BaseTypeTestCase
1819
{
19-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CurrencyType';
20+
public const TESTED_TYPE = CurrencyType::class;
2021

2122
protected function setUp(): void
2223
{

Tests/Extension/Core/Type/DateTimeTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Exception\LogicException;
15+
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
1516
use Symfony\Component\Form\FormError;
1617
use Symfony\Component\Form\FormInterface;
1718

1819
class DateTimeTypeTest extends BaseTypeTestCase
1920
{
20-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateTimeType';
21+
public const TESTED_TYPE = DateTimeType::class;
2122

2223
private string $defaultLocale;
2324

Tests/Extension/Core/Type/DateTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
1515
use Symfony\Component\Form\Exception\LogicException;
16+
use Symfony\Component\Form\Extension\Core\Type\DateType;
1617
use Symfony\Component\Form\FormError;
1718
use Symfony\Component\Form\FormInterface;
1819
use Symfony\Component\Intl\Intl;
@@ -21,7 +22,7 @@
2122

2223
class DateTypeTest extends BaseTypeTestCase
2324
{
24-
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateType';
25+
public const TESTED_TYPE = DateType::class;
2526

2627
private string $defaultTimezone;
2728
private string $defaultLocale;

0 commit comments

Comments
 (0)