Skip to content

Commit c36a64a

Browse files
Enable "native_constant_invocation" CS rule
1 parent 38a1b04 commit c36a64a

32 files changed

+87
-87
lines changed

Application.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null
121121

122122
$renderException = function ($e) use ($output) {
123123
if (!$e instanceof \Exception) {
124-
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
124+
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
125125
}
126126
if ($output instanceof ConsoleOutputInterface) {
127127
$this->renderException($e, $output->getErrorOutput());
@@ -139,7 +139,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null
139139
}
140140

141141
if (null !== $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::EXCEPTION)) {
142-
@trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), E_USER_DEPRECATED);
142+
@trigger_error(sprintf('The "ConsoleEvents::EXCEPTION" event is deprecated since Symfony 3.3 and will be removed in 4.0. Listen to the "ConsoleEvents::ERROR" event instead.'), \E_USER_DEPRECATED);
143143
}
144144

145145
$this->configureIO($input, $output);
@@ -784,7 +784,7 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
784784
$len = 0;
785785
}
786786

787-
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
787+
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
788788
// HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327
789789
if (\defined('HHVM_VERSION') && $width > 1 << 31) {
790790
$width = 1 << 31;
@@ -853,7 +853,7 @@ protected function doRenderException(\Exception $e, OutputInterface $output)
853853
*/
854854
protected function getTerminalWidth()
855855
{
856-
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
856+
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED);
857857

858858
return $this->terminal->getWidth();
859859
}
@@ -867,7 +867,7 @@ protected function getTerminalWidth()
867867
*/
868868
protected function getTerminalHeight()
869869
{
870-
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
870+
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED);
871871

872872
return $this->terminal->getHeight();
873873
}
@@ -881,7 +881,7 @@ protected function getTerminalHeight()
881881
*/
882882
public function getTerminalDimensions()
883883
{
884-
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED);
884+
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), \E_USER_DEPRECATED);
885885

886886
return [$this->terminal->getWidth(), $this->terminal->getHeight()];
887887
}
@@ -900,7 +900,7 @@ public function getTerminalDimensions()
900900
*/
901901
public function setTerminalDimensions($width, $height)
902902
{
903-
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), E_USER_DEPRECATED);
903+
@trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), \E_USER_DEPRECATED);
904904

905905
putenv('COLUMNS='.$width);
906906
putenv('LINES='.$height);
@@ -1173,7 +1173,7 @@ private function findAlternatives($name, $collection)
11731173
}
11741174

11751175
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
1176-
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
1176+
ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
11771177

11781178
return array_keys($alternatives);
11791179
}

Command/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function run(InputInterface $input, OutputInterface $output)
223223
if (null !== $this->processTitle) {
224224
if (\function_exists('cli_set_process_title')) {
225225
if (!@cli_set_process_title($this->processTitle)) {
226-
if ('Darwin' === PHP_OS) {
226+
if ('Darwin' === \PHP_OS) {
227227
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
228228
} else {
229229
cli_set_process_title($this->processTitle);

Descriptor/JsonDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private function getInputArgumentData(InputArgument $argument)
110110
'is_required' => $argument->isRequired(),
111111
'is_array' => $argument->isArray(),
112112
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
113-
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
113+
'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
114114
];
115115
}
116116

@@ -126,7 +126,7 @@ private function getInputOptionData(InputOption $option)
126126
'is_value_required' => $option->isValueRequired(),
127127
'is_multiple' => $option->isArray(),
128128
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
129-
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
129+
'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
130130
];
131131
}
132132

Descriptor/TextDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ private function getCommandAliasesText(Command $command)
276276
*/
277277
private function formatDefaultValue($default)
278278
{
279-
if (INF === $default) {
279+
if (\INF === $default) {
280280
return 'INF';
281281
}
282282

@@ -290,7 +290,7 @@ private function formatDefaultValue($default)
290290
}
291291
}
292292

293-
return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
293+
return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
294294
}
295295

296296
/**

Event/ConsoleExceptionEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Console\Event;
1313

14-
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ConsoleErrorEvent instead.', ConsoleExceptionEvent::class), E_USER_DEPRECATED);
14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ConsoleErrorEvent instead.', ConsoleExceptionEvent::class), \E_USER_DEPRECATED);
1515

1616
use Symfony\Component\Console\Command\Command;
1717
use Symfony\Component\Console\Input\InputInterface;

Formatter/OutputFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function format($message)
134134
$offset = 0;
135135
$output = '';
136136
$tagRegex = '[a-z][a-z0-9,_=;-]*+';
137-
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
137+
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
138138
foreach ($matches[0] as $i => $match) {
139139
$pos = $match[1];
140140
$text = $match[0];
@@ -196,7 +196,7 @@ private function createStyleFromString($string)
196196
return $this->styles[$string];
197197
}
198198

199-
if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) {
199+
if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
200200
return false;
201201
}
202202

@@ -216,7 +216,7 @@ private function createStyleFromString($string)
216216
try {
217217
$style->setOption($option);
218218
} catch (\InvalidArgumentException $e) {
219-
@trigger_error(sprintf('Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), E_USER_DEPRECATED);
219+
@trigger_error(sprintf('Unknown style options are deprecated since Symfony 3.2 and will be removed in 4.0. Exception "%s".', $e->getMessage()), \E_USER_DEPRECATED);
220220

221221
return false;
222222
}

Helper/ProgressBar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ private function overwrite($message)
475475
$message = "\x0D\x1B[2K$message";
476476
}
477477
} elseif ($this->step > 0) {
478-
$message = PHP_EOL.$message;
478+
$message = \PHP_EOL.$message;
479479
}
480480

481481
$this->firstRun = false;
@@ -544,7 +544,7 @@ private static function initPlaceholderFormatters()
544544
return Helper::formatMemory(memory_get_usage(true));
545545
},
546546
'current' => function (self $bar) {
547-
return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
547+
return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
548548
},
549549
'max' => function (self $bar) {
550550
return $bar->getMaxSteps();

Helper/QuestionHelper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu
102102
*/
103103
public function setInputStream($stream)
104104
{
105-
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED);
105+
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), \E_USER_DEPRECATED);
106106

107107
if (!\is_resource($stream)) {
108108
throw new InvalidArgumentException('Input stream must be a valid resource.');
@@ -122,7 +122,7 @@ public function setInputStream($stream)
122122
public function getInputStream()
123123
{
124124
if (0 === \func_num_args() || func_get_arg(0)) {
125-
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED);
125+
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), \E_USER_DEPRECATED);
126126
}
127127

128128
return $this->inputStream;
@@ -155,7 +155,7 @@ private function doAsk(OutputInterface $output, Question $question)
155155
{
156156
$this->writePrompt($output, $question);
157157

158-
$inputStream = $this->inputStream ?: STDIN;
158+
$inputStream = $this->inputStream ?: \STDIN;
159159
$autocomplete = $question->getAutocompleterValues();
160160

161161
if (\function_exists('sapi_windows_cp_set')) {

Helper/SymfonyQuestionHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu
4141
} else {
4242
// make required
4343
if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
44-
@trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', E_USER_DEPRECATED);
44+
@trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', \E_USER_DEPRECATED);
4545

4646
throw new LogicException('A value is required.');
4747
}

Helper/TableStyle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TableStyle
3030
private $cellRowFormat = '%s';
3131
private $cellRowContentFormat = ' %s ';
3232
private $borderFormat = '%s';
33-
private $padType = STR_PAD_RIGHT;
33+
private $padType = \STR_PAD_RIGHT;
3434

3535
/**
3636
* Sets padding character, used for cell padding.
@@ -237,7 +237,7 @@ public function getBorderFormat()
237237
*/
238238
public function setPadType($padType)
239239
{
240-
if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) {
240+
if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
241241
throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
242242
}
243243

0 commit comments

Comments
 (0)