Repository: symfony/symfony
File: src/Symfony/Component/Form/Tests/EnumFormTypeGuesserTest.php (PHP)

Code before:
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Form\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\EnumFormTypeGuesser;
use Symfony\Component\Form\Extension\Core\Type\EnumType as FormEnumType;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;
use Symfony\Component\Form\Guess\ValueGuess;
use Symfony\Component\Form\Tests\Fixtures\BackedEnumFormTypeGuesserCaseEnum;
use Symfony\Component\Form\Tests\Fixtures\EnumFormTypeGuesserCase;
use Symfony\Component\Form\Tests\Fixtures\EnumFormTypeGuesserCaseEnum;

final class EnumFormTypeGuesserTest extends TestCase
{
    /**
     * @dataProvider provideGuessTypeCases
     */
    public function testGuessType(?TypeGuess $expectedTypeGuess, string $class, string $property)
    {
        $typeGuesser = new EnumFormTypeGuesser();

        $typeGuess = $typeGuesser->guessType($class, $property);

        self::assertEquals($expectedTypeGuess, $typeGuess);
    }

    /**
     * @dataProvider provideGuessRequiredCases
     */
    public function testGuessRequired(?ValueGuess $expectedValueGuess, string $class, string $property)
    {
        $typeGuesser = new EnumFormTypeGuesser();

        $valueGuess = $typeGuesser->guessRequired($class, $property);

        self::assertEquals($expectedValueGuess, $valueGuess);
    }

    public static function provideGuessTypeCases(): iterable

Review comment (suggestion):
final is pure visual overhead ;)

```suggestion
class EnumFormTypeGuesserTest extends TestCase
```

Code after:
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Form\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\EnumFormTypeGuesser;
use Symfony\Component\Form\Extension\Core\Type\EnumType as FormEnumType;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;
use Symfony\Component\Form\Guess\ValueGuess;
use Symfony\Component\Form\Tests\Fixtures\BackedEnumFormTypeGuesserCaseEnum;
use Symfony\Component\Form\Tests\Fixtures\EnumFormTypeGuesserCase;
use Symfony\Component\Form\Tests\Fixtures\EnumFormTypeGuesserCaseEnum;

class EnumFormTypeGuesserTest extends TestCase
{
    #[DataProvider('provideGuessTypeCases')]
    public function testGuessType(?TypeGuess $expectedTypeGuess, string $class, string $property)
    {
        $typeGuesser = new EnumFormTypeGuesser();

        $typeGuess = $typeGuesser->guessType($class, $property);

        self::assertEquals($expectedTypeGuess, $typeGuess);
    }

    #[DataProvider('provideGuessRequiredCases')]
    public function testGuessRequired(?ValueGuess $expectedValueGuess, string $class, string $property)
    {
        $typeGuesser = new EnumFormTypeGuesser();

        $valueGuess = $typeGuesser->guessRequired($class, $property);

        self::assertEquals($expectedValueGuess, $valueGuess);
    }

    public static function provideGuessTypeCases(): iterable
    {
        yield 'Undefined class' => [
            null,