Skip to content

Commit d4c5787

Browse files
committed
Prefix all sprintf() calls
1 parent 3e1cb8c commit d4c5787

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Diff for: DeprecationErrorHandler.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,15 @@ private function displayDeprecations(array $groups, Configuration $configuration
300300

301301
if ($configuration->shouldWriteToLogFile()) {
302302
if (false === $handle = @fopen($file = $configuration->getLogFile(), 'a')) {
303-
throw new \InvalidArgumentException(sprintf('The configured log file "%s" is not writeable.', $file));
303+
throw new \InvalidArgumentException(\sprintf('The configured log file "%s" is not writeable.', $file));
304304
}
305305
} else {
306306
$handle = fopen('php://output', 'w');
307307
}
308308

309309
foreach ($groups as $group) {
310310
if ($this->deprecationGroups[$group]->count()) {
311-
$deprecationGroupMessage = sprintf(
311+
$deprecationGroupMessage = \sprintf(
312312
'%s deprecation notices (%d)',
313313
\in_array($group, ['direct', 'indirect', 'self'], true) ? "Remaining $group" : ucfirst($group),
314314
$this->deprecationGroups[$group]->count()
@@ -327,7 +327,7 @@ private function displayDeprecations(array $groups, Configuration $configuration
327327
uasort($notices, $cmp);
328328

329329
foreach ($notices as $msg => $notice) {
330-
fwrite($handle, sprintf("\n %sx: %s\n", $notice->count(), $msg));
330+
fwrite($handle, \sprintf("\n %sx: %s\n", $notice->count(), $msg));
331331

332332
$countsByCaller = $notice->getCountsByCaller();
333333
arsort($countsByCaller);
@@ -339,7 +339,7 @@ private function displayDeprecations(array $groups, Configuration $configuration
339339
fwrite($handle, " ...\n");
340340
break;
341341
}
342-
fwrite($handle, sprintf(" %dx in %s\n", $count, preg_replace('/(.*)\\\\(.*?::.*?)$/', '$2 from $1', $method)));
342+
fwrite($handle, \sprintf(" %dx in %s\n", $count, preg_replace('/(.*)\\\\(.*?::.*?)$/', '$2 from $1', $method)));
343343
}
344344
}
345345
}

Diff for: DeprecationErrorHandler/Configuration.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ private function __construct(array $thresholds = [], string $regex = '', array $
7676

7777
foreach ($thresholds as $group => $threshold) {
7878
if (!\in_array($group, $groups, true)) {
79-
throw new \InvalidArgumentException(sprintf('Unrecognized threshold "%s", expected one of "%s".', $group, implode('", "', $groups)));
79+
throw new \InvalidArgumentException(\sprintf('Unrecognized threshold "%s", expected one of "%s".', $group, implode('", "', $groups)));
8080
}
8181
if (!is_numeric($threshold)) {
82-
throw new \InvalidArgumentException(sprintf('Threshold for group "%s" has invalid value "%s".', $group, $threshold));
82+
throw new \InvalidArgumentException(\sprintf('Threshold for group "%s" has invalid value "%s".', $group, $threshold));
8383
}
8484
$this->thresholds[$group] = (int) $threshold;
8585
}
@@ -111,17 +111,17 @@ private function __construct(array $thresholds = [], string $regex = '', array $
111111

112112
foreach ($verboseOutput as $group => $status) {
113113
if (!isset($this->verboseOutput[$group])) {
114-
throw new \InvalidArgumentException(sprintf('Unsupported verbosity group "%s", expected one of "%s".', $group, implode('", "', array_keys($this->verboseOutput))));
114+
throw new \InvalidArgumentException(\sprintf('Unsupported verbosity group "%s", expected one of "%s".', $group, implode('", "', array_keys($this->verboseOutput))));
115115
}
116116
$this->verboseOutput[$group] = $status;
117117
}
118118

119119
if ($ignoreFile) {
120120
if (!is_file($ignoreFile)) {
121-
throw new \InvalidArgumentException(sprintf('The ignoreFile "%s" does not exist.', $ignoreFile));
121+
throw new \InvalidArgumentException(\sprintf('The ignoreFile "%s" does not exist.', $ignoreFile));
122122
}
123123
set_error_handler(static function ($t, $m) use ($ignoreFile, &$line) {
124-
throw new \RuntimeException(sprintf('Invalid pattern found in "%s" on line "%d"', $ignoreFile, 1 + $line).substr($m, 12));
124+
throw new \RuntimeException(\sprintf('Invalid pattern found in "%s" on line "%d"', $ignoreFile, 1 + $line).substr($m, 12));
125125
});
126126
try {
127127
foreach (file($ignoreFile) as $line => $pattern) {
@@ -147,7 +147,7 @@ private function __construct(array $thresholds = [], string $regex = '', array $
147147
$this->baselineDeprecations[$baseline_deprecation->location][$baseline_deprecation->message] = $baseline_deprecation->count;
148148
}
149149
} else {
150-
throw new \InvalidArgumentException(sprintf('The baselineFile "%s" does not exist.', $this->baselineFile));
150+
throw new \InvalidArgumentException(\sprintf('The baselineFile "%s" does not exist.', $this->baselineFile));
151151
}
152152
}
153153

@@ -312,7 +312,7 @@ public static function fromUrlEncodedString(string $serializedConfiguration): se
312312
parse_str($serializedConfiguration, $normalizedConfiguration);
313313
foreach (array_keys($normalizedConfiguration) as $key) {
314314
if (!\in_array($key, ['max', 'disabled', 'verbose', 'quiet', 'ignoreFile', 'generateBaseline', 'baselineFile', 'logFile'], true)) {
315-
throw new \InvalidArgumentException(sprintf('Unknown configuration option "%s".', $key));
315+
throw new \InvalidArgumentException(\sprintf('Unknown configuration option "%s".', $key));
316316
}
317317
}
318318

Diff for: DeprecationErrorHandler/Deprecation.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private function getPackage(string $path): string
313313
}
314314
}
315315

316-
throw new \RuntimeException(sprintf('No vendors found for path "%s".', $path));
316+
throw new \RuntimeException(\sprintf('No vendors found for path "%s".', $path));
317317
}
318318

319319
/**

0 commit comments

Comments
 (0)