Skip to content

Commit ae9afde

Browse files
Enable "native_constant_invocation" CS rule
1 parent 19bb275 commit ae9afde

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

Command/DebugCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DebugCommand extends Command
4040
public function __construct($twig = null, $projectDir = null)
4141
{
4242
if (!$twig instanceof Environment) {
43-
@trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
43+
@trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED);
4444

4545
parent::__construct($twig);
4646

@@ -55,7 +55,7 @@ public function __construct($twig = null, $projectDir = null)
5555

5656
public function setTwigEnvironment(Environment $twig)
5757
{
58-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
58+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED);
5959

6060
$this->twig = $twig;
6161
}
@@ -65,7 +65,7 @@ public function setTwigEnvironment(Environment $twig)
6565
*/
6666
protected function getTwigEnvironment()
6767
{
68-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
68+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED);
6969

7070
return $this->twig;
7171
}
@@ -107,7 +107,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
107107
if (__CLASS__ !== static::class) {
108108
$r = new \ReflectionMethod($this, 'getTwigEnvironment');
109109
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
110-
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED);
110+
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), \E_USER_DEPRECATED);
111111

112112
$this->twig = $this->getTwigEnvironment();
113113
}
@@ -134,7 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
134134
}
135135

136136
$data['loader_paths'] = $this->getLoaderPaths();
137-
$data = json_encode($data, JSON_PRETTY_PRINT);
137+
$data = json_encode($data, \JSON_PRETTY_PRINT);
138138
$io->writeln($decorated ? OutputFormatter::escape($data) : $data);
139139

140140
return 0;

Command/LintCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class LintCommand extends Command
4343
public function __construct($twig = null)
4444
{
4545
if (!$twig instanceof Environment) {
46-
@trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), E_USER_DEPRECATED);
46+
@trigger_error(sprintf('Passing a command name as the first argument of "%s()" is deprecated since Symfony 3.4 and support for it will be removed in 4.0. If the command was registered by convention, make it a service instead.', __METHOD__), \E_USER_DEPRECATED);
4747

4848
parent::__construct($twig);
4949

@@ -57,7 +57,7 @@ public function __construct($twig = null)
5757

5858
public function setTwigEnvironment(Environment $twig)
5959
{
60-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
60+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED);
6161

6262
$this->twig = $twig;
6363
}
@@ -67,7 +67,7 @@ public function setTwigEnvironment(Environment $twig)
6767
*/
6868
protected function getTwigEnvironment()
6969
{
70-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
70+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0.', __METHOD__), \E_USER_DEPRECATED);
7171

7272
return $this->twig;
7373
}
@@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
108108
if (__CLASS__ !== static::class) {
109109
$r = new \ReflectionMethod($this, 'getTwigEnvironment');
110110
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
111-
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), E_USER_DEPRECATED);
111+
@trigger_error(sprintf('Usage of method "%s" is deprecated since Symfony 3.4 and will no longer be supported in 4.0. Construct the command with its required arguments instead.', static::class.'::getTwigEnvironment'), \E_USER_DEPRECATED);
112112

113113
$this->twig = $this->getTwigEnvironment();
114114
}
@@ -120,13 +120,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
120120
$filenames = $input->getArgument('filename');
121121

122122
if (0 === \count($filenames)) {
123-
if (0 !== ftell(STDIN)) {
123+
if (0 !== ftell(\STDIN)) {
124124
throw new RuntimeException('Please provide a filename or pipe template content to STDIN.');
125125
}
126126

127127
$template = '';
128-
while (!feof(STDIN)) {
129-
$template .= fread(STDIN, 1024);
128+
while (!feof(\STDIN)) {
129+
$template .= fread(\STDIN, 1024);
130130
}
131131

132132
return $this->display($input, $output, $io, [$this->validate($template, uniqid('sf_', true))]);
@@ -226,7 +226,7 @@ private function displayJson(OutputInterface $output, $filesInfo)
226226
}
227227
});
228228

229-
$output->writeln(json_encode($filesInfo, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
229+
$output->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
230230

231231
return min($errors, 1);
232232
}

Extension/CodeExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function formatArgs($args)
102102
} elseif ('resource' === $item[0]) {
103103
$formattedValue = '<em>resource</em>';
104104
} else {
105-
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), ENT_COMPAT | ENT_SUBSTITUTE, $this->charset));
105+
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset));
106106
}
107107

108108
$result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
@@ -188,7 +188,7 @@ public function formatFile($file, $line, $text = null)
188188
}
189189

190190
if (false !== $link = $this->getFileLink($file, $line)) {
191-
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset), $text);
191+
return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset), $text);
192192
}
193193

194194
return $text;
@@ -236,7 +236,7 @@ public function formatLogMessage($message, array $context)
236236
}
237237
}
238238

239-
return htmlspecialchars($message, ENT_COMPAT | ENT_SUBSTITUTE, $this->charset);
239+
return htmlspecialchars($message, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset);
240240
}
241241

242242
/**

Extension/FormExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class FormExtension extends AbstractExtension implements InitRuntimeInterface
3838
public function __construct($renderer = null)
3939
{
4040
if ($renderer instanceof TwigRendererInterface) {
41-
@trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED);
41+
@trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0. Pass the Twig\Environment to the TwigRendererEngine constructor instead.', static::class), \E_USER_DEPRECATED);
4242
} elseif (null !== $renderer && !(\is_array($renderer) && isset($renderer[0], $renderer[1]) && $renderer[0] instanceof ContainerInterface)) {
4343
throw new \InvalidArgumentException(sprintf('Passing any arguments to the constructor of "%s" is reserved for internal use.', __CLASS__));
4444
}
@@ -116,7 +116,7 @@ public function getTests()
116116
public function __get($name)
117117
{
118118
if ('renderer' === $name) {
119-
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
119+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED);
120120

121121
if (\is_array($this->renderer)) {
122122
$renderer = $this->renderer[0]->get($this->renderer[1]);
@@ -136,7 +136,7 @@ public function __get($name)
136136
public function __set($name, $value)
137137
{
138138
if ('renderer' === $name) {
139-
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
139+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED);
140140
}
141141

142142
$this->$name = $value;
@@ -148,7 +148,7 @@ public function __set($name, $value)
148148
public function __isset($name)
149149
{
150150
if ('renderer' === $name) {
151-
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
151+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED);
152152
}
153153

154154
return isset($this->$name);
@@ -160,7 +160,7 @@ public function __isset($name)
160160
public function __unset($name)
161161
{
162162
if ('renderer' === $name) {
163-
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
163+
@trigger_error(sprintf('Using the "%s::$renderer" property is deprecated since Symfony 3.2 as it will be removed in 4.0.', __CLASS__), \E_USER_DEPRECATED);
164164
}
165165

166166
unset($this->$name);

Extension/YamlExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function encode($input, $inline = 0, $dumpObjects = 0)
4444

4545
if (\defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) {
4646
if (\is_bool($dumpObjects)) {
47-
@trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', E_USER_DEPRECATED);
47+
@trigger_error('Passing a boolean flag to toggle object support is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Yaml::DUMP_OBJECT flag instead.', \E_USER_DEPRECATED);
4848

4949
$flags = $dumpObjects ? Yaml::DUMP_OBJECT : 0;
5050
} else {

Form/TwigRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
1616
use Twig\Environment;
1717

18-
@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s instead.', TwigRenderer::class, FormRenderer::class), E_USER_DEPRECATED);
18+
@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s instead.', TwigRenderer::class, FormRenderer::class), \E_USER_DEPRECATED);
1919

2020
/**
2121
* @author Bernhard Schussek <[email protected]>

Form/TwigRendererEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE
3434
public function __construct(array $defaultThemes = [], Environment $environment = null)
3535
{
3636
if (null === $environment) {
37-
@trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0.', static::class), E_USER_DEPRECATED);
37+
@trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0.', static::class), \E_USER_DEPRECATED);
3838
}
3939

4040
parent::__construct($defaultThemes);
@@ -49,7 +49,7 @@ public function __construct(array $defaultThemes = [], Environment $environment
4949
public function setEnvironment(Environment $environment)
5050
{
5151
if ($this->environment) {
52-
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED);
52+
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), \E_USER_DEPRECATED);
5353
}
5454

5555
$this->environment = $environment;

Translation/TwigExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function extractTemplate($template, MessageCatalogue $catalogue)
9191
*/
9292
protected function canBeExtracted($file)
9393
{
94-
return $this->isFile($file) && 'twig' === pathinfo($file, PATHINFO_EXTENSION);
94+
return $this->isFile($file) && 'twig' === pathinfo($file, \PATHINFO_EXTENSION);
9595
}
9696

9797
/**

0 commit comments

Comments
 (0)