for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the humbug/php-scoper package.
*
* Copyright (c) 2017 Théo FIDRY <[email protected]>,
* Pádraic Brady <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Humbug\PhpScoper\Patcher;
use function Safe\preg_replace;
use function Safe\sprintf;
use function strpos;
final class SymfonyPatcher implements Patcher
{
private const PATHS = [
'src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php',
'symfony/dependency-injection/Dumper/PhpDumper.php',
];
public function __invoke(string $filePath, string $prefix, string $contents): string
if (!self::isSupportedFile($filePath)) {
return $contents;
}
return (string) preg_replace(
'/use (Symfony(\\\\(?:\\\\)?)Component\\\\.+?;)/',
sprintf(
Safe\sprintf()
If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated annotation
ignore-deprecated
/** @scrutinizer ignore-deprecated */ sprintf(
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
'use %s$2$1',
$prefix,
),
$contents,
);
private static function isSupportedFile(string $filePath): bool
foreach (self::PATHS as $path) {
if (false !== strpos($filePath, $path)) {
return true;
return false;
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.