Skip to content

Commit 0781446

Browse files
Enable "native_constant_invocation" CS rule
1 parent 58a84f6 commit 0781446

27 files changed

+87
-87
lines changed

ChoiceList/Factory/PropertyAccessDecorator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function createListFromChoices($choices, $value = null)
7070
if (\is_string($value) && !\is_callable($value)) {
7171
$value = new PropertyPath($value);
7272
} elseif (\is_string($value) && \is_callable($value)) {
73-
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
73+
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED);
7474
}
7575

7676
if ($value instanceof PropertyPath) {
@@ -101,7 +101,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
101101
if (\is_string($value) && !\is_callable($value)) {
102102
$value = new PropertyPath($value);
103103
} elseif (\is_string($value) && \is_callable($value)) {
104-
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
104+
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED);
105105
}
106106

107107
if ($value instanceof PropertyPath) {
@@ -137,7 +137,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
137137
if (\is_string($label) && !\is_callable($label)) {
138138
$label = new PropertyPath($label);
139139
} elseif (\is_string($label) && \is_callable($label)) {
140-
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
140+
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED);
141141
}
142142

143143
if ($label instanceof PropertyPath) {
@@ -149,7 +149,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
149149
if (\is_string($preferredChoices) && !\is_callable($preferredChoices)) {
150150
$preferredChoices = new PropertyPath($preferredChoices);
151151
} elseif (\is_string($preferredChoices) && \is_callable($preferredChoices)) {
152-
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
152+
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED);
153153
}
154154

155155
if ($preferredChoices instanceof PropertyPath) {
@@ -166,7 +166,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
166166
if (\is_string($index) && !\is_callable($index)) {
167167
$index = new PropertyPath($index);
168168
} elseif (\is_string($index) && \is_callable($index)) {
169-
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
169+
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED);
170170
}
171171

172172
if ($index instanceof PropertyPath) {
@@ -178,7 +178,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
178178
if (\is_string($groupBy) && !\is_callable($groupBy)) {
179179
$groupBy = new PropertyPath($groupBy);
180180
} elseif (\is_string($groupBy) && \is_callable($groupBy)) {
181-
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
181+
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED);
182182
}
183183

184184
if ($groupBy instanceof PropertyPath) {
@@ -195,7 +195,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
195195
if (\is_string($attr) && !\is_callable($attr)) {
196196
$attr = new PropertyPath($attr);
197197
} elseif (\is_string($attr) && \is_callable($attr)) {
198-
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
198+
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', \E_USER_DEPRECATED);
199199
}
200200

201201
if ($attr instanceof PropertyPath) {

ChoiceList/LazyChoiceList.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getChoices()
7777
// We can safely invoke the {@link ChoiceLoaderInterface} assuming it has the list
7878
// in cache when the lazy list is already loaded
7979
if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) {
80-
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED);
80+
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED);
8181
}
8282

8383
return $this->loadedList->getChoices();
@@ -100,7 +100,7 @@ public function getValues()
100100
if ($this->loaded) {
101101
// Check whether the loader has the same cache
102102
if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) {
103-
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED);
103+
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED);
104104
}
105105

106106
return $this->loadedList->getValues();
@@ -123,7 +123,7 @@ public function getStructuredValues()
123123
if ($this->loaded) {
124124
// Check whether the loader has the same cache
125125
if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) {
126-
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED);
126+
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED);
127127
}
128128

129129
return $this->loadedList->getStructuredValues();
@@ -146,7 +146,7 @@ public function getOriginalKeys()
146146
if ($this->loaded) {
147147
// Check whether the loader has the same cache
148148
if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) {
149-
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED);
149+
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED);
150150
}
151151

152152
return $this->loadedList->getOriginalKeys();
@@ -169,7 +169,7 @@ public function getChoicesForValues(array $values)
169169
if ($this->loaded) {
170170
// Check whether the loader has the same cache
171171
if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) {
172-
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED);
172+
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED);
173173
}
174174

175175
return $this->loadedList->getChoicesForValues($values);
@@ -186,7 +186,7 @@ public function getValuesForChoices(array $choices)
186186
if ($this->loaded) {
187187
// Check whether the loader has the same cache
188188
if ($this->loadedList !== $this->loader->loadChoiceList($this->value)) {
189-
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), E_USER_DEPRECATED);
189+
@trigger_error(sprintf('Caching the choice list in %s is deprecated since Symfony 3.1 and will not happen in 4.0. Cache the list in the %s instead.', __CLASS__, ChoiceLoaderInterface::class), \E_USER_DEPRECATED);
190190
}
191191

192192
return $this->loadedList->getValuesForChoices($choices);

Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private function findAlternatives($name, array $collection)
196196

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

201201
return array_keys($alternatives);
202202
}

Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function writeData(array $data, array $options)
8383
{
8484
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
8585

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

8989
private function sortOptions(array &$options)

Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function reverseTransform($value)
182182
throw new TransformationFailedException($formatter->getErrorMessage());
183183
}
184184

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

@@ -272,13 +272,13 @@ private function round($number)
272272
$number = $number > 0 ? floor($number) : ceil($number);
273273
break;
274274
case self::ROUND_HALF_EVEN:
275-
$number = round($number, 0, PHP_ROUND_HALF_EVEN);
275+
$number = round($number, 0, \PHP_ROUND_HALF_EVEN);
276276
break;
277277
case self::ROUND_HALF_UP:
278-
$number = round($number, 0, PHP_ROUND_HALF_UP);
278+
$number = round($number, 0, \PHP_ROUND_HALF_UP);
279279
break;
280280
case self::ROUND_HALF_DOWN:
281-
$number = round($number, 0, PHP_ROUND_HALF_DOWN);
281+
$number = round($number, 0, \PHP_ROUND_HALF_DOWN);
282282
break;
283283
}
284284

Extension/Core/EventListener/ResizeFormListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function preSubmit(FormEvent $event)
8888
$data = $event->getData();
8989

9090
if ($data instanceof \Traversable && $data instanceof \ArrayAccess) {
91-
@trigger_error('Support for objects implementing both \Traversable and \ArrayAccess is deprecated since Symfony 3.1 and will be removed in 4.0. Use an array instead.', E_USER_DEPRECATED);
91+
@trigger_error('Support for objects implementing both \Traversable and \ArrayAccess is deprecated since Symfony 3.1 and will be removed in 4.0. Use an array instead.', \E_USER_DEPRECATED);
9292
}
9393

9494
if (!\is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {

Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function configureOptions(OptionsResolver $resolver)
276276
throw new \RuntimeException(sprintf('The "choices_as_values" option of the "%s" should not be used. Remove it and flip the contents of the "choices" option instead.', static::class));
277277
}
278278

279-
@trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', E_USER_DEPRECATED);
279+
@trigger_error('The "choices_as_values" option is deprecated since Symfony 3.1 and will be removed in 4.0. You should not use it anymore.', \E_USER_DEPRECATED);
280280

281281
return true;
282282
};

Extension/Core/Type/CountryType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function configureOptions(OptionsResolver $resolver)
3939
$resolver->setDefaults([
4040
'choice_loader' => function (Options $options) {
4141
if ($options['choices']) {
42-
@trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED);
42+
@trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), \E_USER_DEPRECATED);
4343

4444
return null;
4545
}

Extension/Core/Type/CurrencyType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function configureOptions(OptionsResolver $resolver)
3939
$resolver->setDefaults([
4040
'choice_loader' => function (Options $options) {
4141
if ($options['choices']) {
42-
@trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED);
42+
@trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), \E_USER_DEPRECATED);
4343

4444
return null;
4545
}

Extension/Core/Type/FileType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ private function getFileUploadError($errorCode)
145145
{
146146
$messageParameters = [];
147147

148-
if (UPLOAD_ERR_INI_SIZE === $errorCode) {
148+
if (\UPLOAD_ERR_INI_SIZE === $errorCode) {
149149
list($limitAsString, $suffix) = $this->factorizeSizes(0, self::getMaxFilesize());
150150
$messageTemplate = 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.';
151151
$messageParameters = [
152152
'{{ limit }}' => $limitAsString,
153153
'{{ suffix }}' => $suffix,
154154
];
155-
} elseif (UPLOAD_ERR_FORM_SIZE === $errorCode) {
155+
} elseif (\UPLOAD_ERR_FORM_SIZE === $errorCode) {
156156
$messageTemplate = 'The file is too large.';
157157
} else {
158158
$messageTemplate = 'The file could not be uploaded.';
@@ -179,7 +179,7 @@ private static function getMaxFilesize()
179179
$iniMax = strtolower(ini_get('upload_max_filesize'));
180180

181181
if ('' === $iniMax) {
182-
return PHP_INT_MAX;
182+
return \PHP_INT_MAX;
183183
}
184184

185185
$max = ltrim($iniMax, '+');

0 commit comments

Comments
 (0)