Merge branch '5.1' into 5.2

* 5.1:
  Update .php_cs.dist
  Apply "visibility_required" CS rule to constants
This commit is contained in:
Nicolas Grekas
2020-12-08 18:03:37 +01:00
42 changed files with 69 additions and 69 deletions

View File

@@ -21,7 +21,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface
/**
* The variable in {@link FormView} used as cache key.
*/
const CACHE_KEY_VAR = 'cache_key';
public const CACHE_KEY_VAR = 'cache_key';
protected $defaultThemes;
protected $themes = [];

View File

@@ -22,13 +22,13 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
*/
class DateIntervalToArrayTransformer implements DataTransformerInterface
{
const YEARS = 'years';
const MONTHS = 'months';
const DAYS = 'days';
const HOURS = 'hours';
const MINUTES = 'minutes';
const SECONDS = 'seconds';
const INVERT = 'invert';
public const YEARS = 'years';
public const MONTHS = 'months';
public const DAYS = 'days';
public const HOURS = 'hours';
public const MINUTES = 'minutes';
public const SECONDS = 'seconds';
public const INVERT = 'invert';
private static $availableFields = [
self::YEARS => 'y',

View File

@@ -20,7 +20,7 @@ use Symfony\Component\Form\Exception\TransformationFailedException;
*/
class DateTimeToHtml5LocalDateTimeTransformer extends BaseDateTimeTransformer
{
const HTML5_FORMAT = 'Y-m-d\\TH:i:s';
public const HTML5_FORMAT = 'Y-m-d\\TH:i:s';
/**
* Transforms a \DateTime into a local date and time string.

View File

@@ -26,37 +26,37 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
/**
* @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_CEILING instead.
*/
const ROUND_CEILING = \NumberFormatter::ROUND_CEILING;
public const ROUND_CEILING = \NumberFormatter::ROUND_CEILING;
/**
* @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_FLOOR instead.
*/
const ROUND_FLOOR = \NumberFormatter::ROUND_FLOOR;
public const ROUND_FLOOR = \NumberFormatter::ROUND_FLOOR;
/**
* @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_UP instead.
*/
const ROUND_UP = \NumberFormatter::ROUND_UP;
public const ROUND_UP = \NumberFormatter::ROUND_UP;
/**
* @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_DOWN instead.
*/
const ROUND_DOWN = \NumberFormatter::ROUND_DOWN;
public const ROUND_DOWN = \NumberFormatter::ROUND_DOWN;
/**
* @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_HALFEVEN instead.
*/
const ROUND_HALF_EVEN = \NumberFormatter::ROUND_HALFEVEN;
public const ROUND_HALF_EVEN = \NumberFormatter::ROUND_HALFEVEN;
/**
* @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_HALFUP instead.
*/
const ROUND_HALF_UP = \NumberFormatter::ROUND_HALFUP;
public const ROUND_HALF_UP = \NumberFormatter::ROUND_HALFUP;
/**
* @deprecated since Symfony 5.1, use \NumberFormatter::ROUND_HALFDOWN instead.
*/
const ROUND_HALF_DOWN = \NumberFormatter::ROUND_HALFDOWN;
public const ROUND_HALF_DOWN = \NumberFormatter::ROUND_HALFDOWN;
protected $grouping;

View File

@@ -23,8 +23,8 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
*/
class PercentToLocalizedStringTransformer implements DataTransformerInterface
{
const FRACTIONAL = 'fractional';
const INTEGER = 'integer';
public const FRACTIONAL = 'fractional';
public const INTEGER = 'integer';
protected static $types = [
self::FRACTIONAL,

View File

@@ -31,14 +31,14 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class DateTimeType extends AbstractType
{
const DEFAULT_DATE_FORMAT = \IntlDateFormatter::MEDIUM;
const DEFAULT_TIME_FORMAT = \IntlDateFormatter::MEDIUM;
public const DEFAULT_DATE_FORMAT = \IntlDateFormatter::MEDIUM;
public const DEFAULT_TIME_FORMAT = \IntlDateFormatter::MEDIUM;
/**
* The HTML5 datetime-local format as defined in
* http://w3c.github.io/html-reference/datatypes.html#form.data.datetime-local.
*/
const HTML5_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
public const HTML5_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
private static $acceptedFormats = [
\IntlDateFormatter::FULL,

View File

@@ -28,8 +28,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class DateType extends AbstractType
{
const DEFAULT_FORMAT = \IntlDateFormatter::MEDIUM;
const HTML5_FORMAT = 'yyyy-MM-dd';
public const DEFAULT_FORMAT = \IntlDateFormatter::MEDIUM;
public const HTML5_FORMAT = 'yyyy-MM-dd';
private static $acceptedFormats = [
\IntlDateFormatter::FULL,

View File

@@ -24,8 +24,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class FileType extends AbstractType
{
const KIB_BYTES = 1024;
const MIB_BYTES = 1048576;
public const KIB_BYTES = 1024;
public const MIB_BYTES = 1048576;
private static $suffixes = [
1 => 'bytes',

View File

@@ -18,8 +18,8 @@ use Symfony\Component\Validator\Constraint;
*/
class Form extends Constraint
{
const NOT_SYNCHRONIZED_ERROR = '1dafa156-89e1-4736-b832-419c2e501fca';
const NO_SUCH_FIELD_ERROR = '6e5212ed-a197-4339-99aa-5654798a4854';
public const NOT_SYNCHRONIZED_ERROR = '1dafa156-89e1-4736-b832-419c2e501fca';
public const NO_SUCH_FIELD_ERROR = '6e5212ed-a197-4339-99aa-5654798a4854';
protected static $errorNames = [
self::NOT_SYNCHRONIZED_ERROR => 'NOT_SYNCHRONIZED_ERROR',

View File

@@ -33,7 +33,7 @@ class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \Array
/**
* The prefix used for indenting nested error messages.
*/
const INDENTATION = ' ';
public const INDENTATION = ' ';
private $form;
private $errors;

View File

@@ -37,7 +37,7 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\Event\PreSubmitEvent")
*/
const PRE_SUBMIT = 'form.pre_submit';
public const PRE_SUBMIT = 'form.pre_submit';
/**
* The SUBMIT event is dispatched after the Form::submit() method
@@ -56,7 +56,7 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\Event\SubmitEvent")
*/
const SUBMIT = 'form.submit';
public const SUBMIT = 'form.submit';
/**
* The FormEvents::POST_SUBMIT event is dispatched at the very end of the Form::submit().
@@ -71,7 +71,7 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\Event\PostSubmitEvent")
*/
const POST_SUBMIT = 'form.post_submit';
public const POST_SUBMIT = 'form.post_submit';
/**
* The FormEvents::PRE_SET_DATA event is dispatched at the beginning of the Form::setData() method.
@@ -82,7 +82,7 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\Event\PreSetDataEvent")
*/
const PRE_SET_DATA = 'form.pre_set_data';
public const PRE_SET_DATA = 'form.pre_set_data';
/**
* The FormEvents::POST_SET_DATA event is dispatched at the end of the Form::setData() method.
@@ -92,14 +92,14 @@ final class FormEvents
*
* @Event("Symfony\Component\Form\Event\PostSetDataEvent")
*/
const POST_SET_DATA = 'form.post_set_data';
public const POST_SET_DATA = 'form.post_set_data';
/**
* Event aliases.
*
* These aliases can be consumed by RegisterListenersPass.
*/
const ALIASES = [
public const ALIASES = [
PreSubmitEvent::class => self::PRE_SUBMIT,
SubmitEvent::class => self::SUBMIT,
PostSubmitEvent::class => self::POST_SUBMIT,

View File

@@ -23,7 +23,7 @@ use Twig\Environment;
*/
class FormRenderer implements FormRendererInterface
{
const CACHE_KEY_VAR = 'unique_block_prefix';
public const CACHE_KEY_VAR = 'unique_block_prefix';
private $engine;
private $csrfTokenManager;

View File

@@ -27,22 +27,22 @@ abstract class Guess
/**
* Marks an instance with a value that is extremely likely to be correct.
*/
const VERY_HIGH_CONFIDENCE = 3;
public const VERY_HIGH_CONFIDENCE = 3;
/**
* Marks an instance with a value that is very likely to be correct.
*/
const HIGH_CONFIDENCE = 2;
public const HIGH_CONFIDENCE = 2;
/**
* Marks an instance with a value that is likely to be correct.
*/
const MEDIUM_CONFIDENCE = 1;
public const MEDIUM_CONFIDENCE = 1;
/**
* Marks an instance with a value that may be correct.
*/
const LOW_CONFIDENCE = 0;
public const LOW_CONFIDENCE = 0;
/**
* The confidence about the correctness of the value.

View File

@@ -21,7 +21,7 @@ abstract class BaseTypeTest extends TypeTestCase
{
use VersionAwareTest;
const TESTED_TYPE = '';
public const TESTED_TYPE = '';
public function testPassDisabledAsOption()
{

View File

@@ -16,7 +16,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
*/
class BirthdayTypeTest extends DateTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\BirthdayType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\BirthdayType';
public function testSetInvalidYearsOption()
{

View File

@@ -16,7 +16,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
*/
class ButtonTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ButtonType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ButtonType';
public function testCreateButtonInstances()
{

View File

@@ -15,7 +15,7 @@ use Symfony\Component\Form\CallbackTransformer;
class CheckboxTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CheckboxType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CheckboxType';
public function testDataIsFalseByDefault()
{

View File

@@ -22,7 +22,7 @@ class ChoiceTypeTest extends BaseTypeTest
{
use ExpectDeprecationTrait;
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
private $choices = [
'Bernhard' => 'a',

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Form\Tests\Fixtures\BlockPrefixedFooTextType;
class CollectionTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CollectionType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CollectionType';
public function testContainsNoChildByDefault()
{

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Form\FormError;
final class ColorTypeTest extends BaseTypeTest
{
const TESTED_TYPE = ColorType::class;
public const TESTED_TYPE = ColorType::class;
/**
* @dataProvider validationShouldPassProvider

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class CountryTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CountryType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CountryType';
protected function setUp(): void
{

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class CurrencyTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CurrencyType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\CurrencyType';
protected function setUp(): void
{

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface;
class DateIntervalTypeTest extends BaseTypeTest
{
const TESTED_TYPE = DateIntervalType::class;
public const TESTED_TYPE = DateIntervalType::class;
public function testSubmitDateInterval()
{

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Form\FormInterface;
class DateTimeTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateTimeType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateTimeType';
protected function setUp(): void
{

View File

@@ -18,7 +18,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class DateTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\DateType';
private $defaultTimezone;
private $defaultLocale;

View File

@@ -21,7 +21,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class FileTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FileType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FileType';
protected function getExtensions()
{

View File

@@ -59,7 +59,7 @@ class FormTest_AuthorWithoutRefSetter
class FormTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FormType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FormType';
public function testCreateFormInstances()
{

View File

@@ -15,7 +15,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class IntegerTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\IntegerType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\IntegerType';
protected function setUp(): void
{

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class LanguageTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LanguageType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LanguageType';
protected function setUp(): void
{

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class LocaleTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LocaleType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\LocaleType';
protected function setUp(): void
{

View File

@@ -15,7 +15,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class MoneyTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\MoneyType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\MoneyType';
private $defaultLocale;

View File

@@ -15,7 +15,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class NumberTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\NumberType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\NumberType';
private $defaultLocale;

View File

@@ -13,7 +13,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
class PasswordTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\PasswordType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\PasswordType';
public function testEmptyIfNotSubmitted()
{

View File

@@ -20,7 +20,7 @@ class PercentTypeTest extends TypeTestCase
{
use ExpectDeprecationTrait;
const TESTED_TYPE = PercentType::class;
public const TESTED_TYPE = PercentType::class;
private $defaultLocale;

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Form\Tests\Fixtures\NotMappedType;
class RepeatedTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\RepeatedType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\RepeatedType';
/**
* @var Form

View File

@@ -16,7 +16,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
*/
class SubmitTypeTest extends ButtonTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\SubmitType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\SubmitType';
public function testCreateSubmitButtonInstances()
{

View File

@@ -13,7 +13,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
class TextTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TextType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TextType';
public function testSubmitNull($expected = null, $norm = null, $view = null)
{

View File

@@ -17,7 +17,7 @@ use Symfony\Component\Form\FormInterface;
class TimeTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TimeType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TimeType';
public function testSubmitDateTime()
{

View File

@@ -16,7 +16,7 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
class TimezoneTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TimezoneType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TimezoneType';
public function testTimezonesAreSelectable()
{

View File

@@ -13,7 +13,7 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
class UrlTypeTest extends TextTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\UrlType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\UrlType';
public function testSubmitAddsDefaultProtocolIfNoneIsIncluded()
{

View File

@@ -15,7 +15,7 @@ use Symfony\Component\Form\FormError;
class WeekTypeTest extends BaseTypeTest
{
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\WeekType';
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\WeekType';
public function testSubmitArray()
{

View File

@@ -41,9 +41,9 @@ use Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory;
*/
class ValidatorTypeGuesserTest extends TestCase
{
const TEST_CLASS = 'Symfony\Component\Form\Tests\Extension\Validator\ValidatorTypeGuesserTest_TestClass';
public const TEST_CLASS = 'Symfony\Component\Form\Tests\Extension\Validator\ValidatorTypeGuesserTest_TestClass';
const TEST_PROPERTY = 'property';
public const TEST_PROPERTY = 'property';
/**
* @var ValidatorTypeGuesser