Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 3.4:
  Enable "native_constant_invocation" CS rule
  Make AbstractPhpFileCacheWarmer public
  • Loading branch information
nicolas-grekas committed Sep 2, 2020
2 parents 6407cd3 + 0781446 commit 82e315e
Show file tree
Hide file tree
Showing 29 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion AbstractExtension.php
Expand Up @@ -183,7 +183,7 @@ private function initTypeExtensions()
$extendedTypes[] = $extendedType;
}
} else {
@trigger_error(sprintf('Not implementing the "%s::getExtendedTypes()" method in "%s" is deprecated since Symfony 4.2.', FormTypeExtensionInterface::class, \get_class($extension)), E_USER_DEPRECATED);
@trigger_error(sprintf('Not implementing the "%s::getExtendedTypes()" method in "%s" is deprecated since Symfony 4.2.', FormTypeExtensionInterface::class, \get_class($extension)), \E_USER_DEPRECATED);

$extendedTypes = [$extension->getExtendedType()];
}
Expand Down
2 changes: 1 addition & 1 deletion AbstractTypeExtension.php
Expand Up @@ -58,7 +58,7 @@ public function getExtendedType()
throw new LogicException(sprintf('You need to implement the static getExtendedTypes() method when implementing the "%s" in "%s".', FormTypeExtensionInterface::class, static::class));
}

@trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', static::class), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s::getExtendedType() method is deprecated since Symfony 4.2 and will be removed in 5.0. Use getExtendedTypes() instead.', static::class), \E_USER_DEPRECATED);

foreach (static::getExtendedTypes() as $extendedType) {
return $extendedType;
Expand Down
4 changes: 2 additions & 2 deletions ButtonBuilder.php
Expand Up @@ -63,10 +63,10 @@ public function __construct(?string $name, array $options = [])

if (preg_match('/^([^a-zA-Z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
if (isset($matches[1])) {
@trigger_error(sprintf('Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("%s" given).', $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("%s" given).', $name), \E_USER_DEPRECATED);
}
if (isset($matches[2])) {
@trigger_error(sprintf('Using names for buttons that do not contain only letters, digits, underscores ("_"), hyphens ("-") and colons (":") ("%s" given) is deprecated since Symfony 4.3 and will throw an exception in 5.0.', $name), E_USER_DEPRECATED);
@trigger_error(sprintf('Using names for buttons that do not contain only letters, digits, underscores ("_"), hyphens ("-") and colons (":") ("%s" given) is deprecated since Symfony 4.3 and will throw an exception in 5.0.', $name), \E_USER_DEPRECATED);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Command/DebugCommand.php
Expand Up @@ -237,7 +237,7 @@ private function findAlternatives(string $name, array $collection): array

$threshold = 1e3;
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);

return array_keys($alternatives);
}
Expand Down
2 changes: 1 addition & 1 deletion Console/Descriptor/JsonDescriptor.php
Expand Up @@ -96,7 +96,7 @@ private function writeData(array $data, array $options)
{
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;

$this->output->write(json_encode($data, $flags | JSON_PRETTY_PRINT)."\n");
$this->output->write(json_encode($data, $flags | \JSON_PRETTY_PRINT)."\n");
}

private function sortOptions(array &$options)
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/FormPass.php
Expand Up @@ -97,7 +97,7 @@ private function processFormTypeExtensions(ContainerBuilder $container): array

if (isset($tag[0]['extended_type'])) {
if (!method_exists($typeExtensionClass, 'getExtendedTypes')) {
@trigger_error(sprintf('Not implementing the "%s::getExtendedTypes()" method in "%s" is deprecated since Symfony 4.2.', FormTypeExtensionInterface::class, $typeExtensionClass), E_USER_DEPRECATED);
@trigger_error(sprintf('Not implementing the "%s::getExtendedTypes()" method in "%s" is deprecated since Symfony 4.2.', FormTypeExtensionInterface::class, $typeExtensionClass), \E_USER_DEPRECATED);
}

$typeExtensions[$tag[0]['extended_type']][] = new Reference($serviceId);
Expand Down
Expand Up @@ -30,7 +30,7 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
public function __construct($grouping = false, $roundingMode = self::ROUND_DOWN)
{
if (\is_int($grouping) || \is_bool($roundingMode) || 2 < \func_num_args()) {
@trigger_error(sprintf('Passing a precision as the first value to %s::__construct() is deprecated since Symfony 4.2 and support for it will be dropped in 5.0.', __CLASS__), E_USER_DEPRECATED);
@trigger_error(sprintf('Passing a precision as the first value to %s::__construct() is deprecated since Symfony 4.2 and support for it will be dropped in 5.0.', __CLASS__), \E_USER_DEPRECATED);

$grouping = $roundingMode;
$roundingMode = 2 < \func_num_args() ? func_get_arg(2) : self::ROUND_DOWN;
Expand Down
Expand Up @@ -179,7 +179,7 @@ public function reverseTransform($value)
throw new TransformationFailedException($formatter->getErrorMessage());
}

if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) {
if ($result >= \PHP_INT_MAX || $result <= -\PHP_INT_MAX) {
throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like.');
}

Expand Down Expand Up @@ -269,13 +269,13 @@ private function round($number)
$number = $number > 0 ? floor($number) : ceil($number);
break;
case self::ROUND_HALF_EVEN:
$number = round($number, 0, PHP_ROUND_HALF_EVEN);
$number = round($number, 0, \PHP_ROUND_HALF_EVEN);
break;
case self::ROUND_HALF_UP:
$number = round($number, 0, PHP_ROUND_HALF_UP);
$number = round($number, 0, \PHP_ROUND_HALF_UP);
break;
case self::ROUND_HALF_DOWN:
$number = round($number, 0, PHP_ROUND_HALF_DOWN);
$number = round($number, 0, \PHP_ROUND_HALF_DOWN);
break;
}

Expand Down
6 changes: 3 additions & 3 deletions Extension/Core/Type/CountryType.php
Expand Up @@ -80,7 +80,7 @@ public function getBlockPrefix()
*/
public function loadChoiceList($value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

if (null !== $this->choiceList) {
return $this->choiceList;
Expand All @@ -96,7 +96,7 @@ public function loadChoiceList($value = null)
*/
public function loadChoicesForValues(array $values, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$values = array_filter($values);
Expand All @@ -114,7 +114,7 @@ public function loadChoicesForValues(array $values, $value = null)
*/
public function loadValuesForChoices(array $choices, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$choices = array_filter($choices);
Expand Down
6 changes: 3 additions & 3 deletions Extension/Core/Type/CurrencyType.php
Expand Up @@ -77,7 +77,7 @@ public function getBlockPrefix()
*/
public function loadChoiceList($value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

if (null !== $this->choiceList) {
return $this->choiceList;
Expand All @@ -93,7 +93,7 @@ public function loadChoiceList($value = null)
*/
public function loadChoicesForValues(array $values, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$values = array_filter($values);
Expand All @@ -111,7 +111,7 @@ public function loadChoicesForValues(array $values, $value = null)
*/
public function loadValuesForChoices(array $choices, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$choices = array_filter($choices);
Expand Down
6 changes: 3 additions & 3 deletions Extension/Core/Type/FileType.php
Expand Up @@ -152,14 +152,14 @@ private function getFileUploadError(int $errorCode)
{
$messageParameters = [];

if (UPLOAD_ERR_INI_SIZE === $errorCode) {
if (\UPLOAD_ERR_INI_SIZE === $errorCode) {
list($limitAsString, $suffix) = $this->factorizeSizes(0, self::getMaxFilesize());
$messageTemplate = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.';
$messageParameters = [
'{{ limit }}' => $limitAsString,
'{{ suffix }}' => $suffix,
];
} elseif (UPLOAD_ERR_FORM_SIZE === $errorCode) {
} elseif (\UPLOAD_ERR_FORM_SIZE === $errorCode) {
$messageTemplate = 'The file is too large.';
} else {
$messageTemplate = 'The file could not be uploaded.';
Expand All @@ -184,7 +184,7 @@ private static function getMaxFilesize(): int
$iniMax = strtolower(ini_get('upload_max_filesize'));

if ('' === $iniMax) {
return PHP_INT_MAX;
return \PHP_INT_MAX;
}

$max = ltrim($iniMax, '+');
Expand Down
6 changes: 3 additions & 3 deletions Extension/Core/Type/LanguageType.php
Expand Up @@ -80,7 +80,7 @@ public function getBlockPrefix()
*/
public function loadChoiceList($value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

if (null !== $this->choiceList) {
return $this->choiceList;
Expand All @@ -96,7 +96,7 @@ public function loadChoiceList($value = null)
*/
public function loadChoicesForValues(array $values, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$values = array_filter($values);
Expand All @@ -114,7 +114,7 @@ public function loadChoicesForValues(array $values, $value = null)
*/
public function loadValuesForChoices(array $choices, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$choices = array_filter($choices);
Expand Down
6 changes: 3 additions & 3 deletions Extension/Core/Type/LocaleType.php
Expand Up @@ -77,7 +77,7 @@ public function getBlockPrefix()
*/
public function loadChoiceList($value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

if (null !== $this->choiceList) {
return $this->choiceList;
Expand All @@ -93,7 +93,7 @@ public function loadChoiceList($value = null)
*/
public function loadChoicesForValues(array $values, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$values = array_filter($values);
Expand All @@ -111,7 +111,7 @@ public function loadChoicesForValues(array $values, $value = null)
*/
public function loadValuesForChoices(array $choices, $value = null)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), E_USER_DEPRECATED);
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use the "choice_loader" option instead.', __METHOD__), \E_USER_DEPRECATED);

// Optimize
$choices = array_filter($choices);
Expand Down
2 changes: 1 addition & 1 deletion Extension/Core/Type/NumberType.php
Expand Up @@ -41,7 +41,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->addModelTransformer(new CallbackTransformer(
function ($value) {
if (\is_float($value) || \is_int($value)) {
@trigger_error(sprintf('Using the %s with float or int data when the "input" option is set to "string" is deprecated since Symfony 4.4 and will throw an exception in 5.0.', self::class), E_USER_DEPRECATED);
@trigger_error(sprintf('Using the %s with float or int data when the "input" option is set to "string" is deprecated since Symfony 4.4 and will throw an exception in 5.0.', self::class), \E_USER_DEPRECATED);
$value = (string) $value;
}

Expand Down
6 changes: 3 additions & 3 deletions Extension/Core/Type/TimeType.php
Expand Up @@ -125,7 +125,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$hours = $minutes = [];

foreach ($options['hours'] as $hour) {
$hours[str_pad($hour, 2, '0', STR_PAD_LEFT)] = $hour;
$hours[str_pad($hour, 2, '0', \STR_PAD_LEFT)] = $hour;
}

// Only pass a subset of the options to children
Expand All @@ -135,7 +135,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)

if ($options['with_minutes']) {
foreach ($options['minutes'] as $minute) {
$minutes[str_pad($minute, 2, '0', STR_PAD_LEFT)] = $minute;
$minutes[str_pad($minute, 2, '0', \STR_PAD_LEFT)] = $minute;
}

$minuteOptions['choices'] = $minutes;
Expand All @@ -147,7 +147,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$seconds = [];

foreach ($options['seconds'] as $second) {
$seconds[str_pad($second, 2, '0', STR_PAD_LEFT)] = $second;
$seconds[str_pad($second, 2, '0', \STR_PAD_LEFT)] = $second;
}

$secondOptions['choices'] = $seconds;
Expand Down
2 changes: 1 addition & 1 deletion Extension/Templating/TemplatingExtension.php
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Component\Form\Extension\Templating;

@trigger_error('The '.TemplatingExtension::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
@trigger_error('The '.TemplatingExtension::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);

use Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper;
use Symfony\Component\Form\AbstractExtension;
Expand Down
2 changes: 1 addition & 1 deletion Extension/Templating/TemplatingRendererEngine.php
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Component\Form\Extension\Templating;

@trigger_error('The '.TemplatingRendererEngine::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
@trigger_error('The '.TemplatingRendererEngine::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);

use Symfony\Component\Form\AbstractRendererEngine;
use Symfony\Component\Form\FormView;
Expand Down
2 changes: 1 addition & 1 deletion FormError.php
Expand Up @@ -50,7 +50,7 @@ class FormError
public function __construct(?string $message, string $messageTemplate = null, array $messageParameters = [], int $messagePluralization = null, $cause = null)
{
if (null === $message) {
@trigger_error(sprintf('Passing a null message when instantiating a "%s" is deprecated since Symfony 4.4.', __CLASS__), E_USER_DEPRECATED);
@trigger_error(sprintf('Passing a null message when instantiating a "%s" is deprecated since Symfony 4.4.', __CLASS__), \E_USER_DEPRECATED);
$message = '';
}

Expand Down
6 changes: 3 additions & 3 deletions FormRenderer.php
Expand Up @@ -133,7 +133,7 @@ public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $va

if ($renderOnlyOnce && $view->isRendered()) {
// This is not allowed, because it would result in rendering same IDs multiple times, which is not valid.
@trigger_error(sprintf('You are calling "form_%s" for field "%s" which has already been rendered before, trying to render fields which were already rendered is deprecated since Symfony 4.2 and will throw an exception in 5.0.', $blockNameSuffix, $view->vars['name']), E_USER_DEPRECATED);
@trigger_error(sprintf('You are calling "form_%s" for field "%s" which has already been rendered before, trying to render fields which were already rendered is deprecated since Symfony 4.2 and will throw an exception in 5.0.', $blockNameSuffix, $view->vars['name']), \E_USER_DEPRECATED);
// throw new BadMethodCallException(sprintf('Field "%s" has already been rendered. Save result of previous render call to variable and output that instead.', $view->vars['name']));
return '';
}
Expand Down Expand Up @@ -293,9 +293,9 @@ public function humanize($text)
public function encodeCurrency(Environment $environment, string $text, string $widget = ''): string
{
if ('UTF-8' === $charset = $environment->getCharset()) {
$text = htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
$text = htmlspecialchars($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8');
} else {
$text = htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
$text = htmlentities($text, \ENT_QUOTES | \ENT_SUBSTITUTE, 'UTF-8');
$text = iconv('UTF-8', $charset, $text);
$widget = iconv('UTF-8', $charset, $widget);
}
Expand Down
4 changes: 2 additions & 2 deletions NativeRequestHandler.php
Expand Up @@ -152,7 +152,7 @@ public function getUploadFileError($data)
return null;
}

if (UPLOAD_ERR_OK === $data['error']) {
if (\UPLOAD_ERR_OK === $data['error']) {
return null;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ private static function stripEmptyFiles($data)
sort($keys);

if (self::$fileKeys === $keys) {
if (UPLOAD_ERR_NO_FILE === $data['error']) {
if (\UPLOAD_ERR_NO_FILE === $data['error']) {
return null;
}

Expand Down

0 comments on commit 82e315e

Please sign in to comment.