PHP configuration should not be changed dynamically 9

More information: https://insight.symfony.com/what-we-analyse/php.dynamically_change_configuration

  1. if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
  2. ini_set('display_errors', 0);
  3. ExceptionHandler::register();
  4. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  5. // CLI - display errors only if they're not already logged to STDERR
  6. ini_set('display_errors', 1);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Fabien Potencier
  7. }
  8. if ($displayErrors) {
  9. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  10. } else {
  11. ErrorHandler::register()->throwAt(0, true);
  1. } else {
  2. error_reporting(E_ALL);
  3. }
  4. if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
  5. ini_set('display_errors', 0);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  6. ExceptionHandler::register();
  7. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  8. // CLI - display errors only if they're not already logged to STDERR
  9. ini_set('display_errors', 1);
  10. }
  1. {
  2. if (!static::isSupported()) {
  3. throw new CacheException('APCu is not enabled');
  4. }
  5. if ('cli' === \PHP_SAPI) {
  6. ini_set('apc.use_request_time', 0);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  7. }
  8. parent::__construct($namespace, $defaultLifetime);
  9. if (null !== $version) {
  10. CacheItem::validateKey($version);
  1. return $values;
  2. } catch (\Error $e) {
  3. throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
  4. } finally {
  5. ini_set('unserialize_callback_func', $unserializeCallbackHandler);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  6. }
  7. }
  8. /**
  9. * {@inheritdoc}
  1. /**
  2. * {@inheritdoc}
  3. */
  4. protected function doFetch(array $ids)
  5. {
  6. $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  7. try {
  8. $values = [];
  9. foreach (apcu_fetch($ids, $ok) ?: [] as $k => $v) {
  10. if (null !== $v || $ok) {
  11. $values[$k] = $v;
  1. }
  2. }
  3. throw $e;
  4. } finally {
  5. ini_set('unserialize_callback_func', $unserializeCallbackHandler);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  6. }
  7. }
  8. /**
  9. * {@inheritdoc}
  1. /**
  2. * {@inheritdoc}
  3. */
  4. protected function doFetch(array $ids)
  5. {
  6. $unserializeCallbackHandler = ini_set('unserialize_callback_func', parent::class.'::handleUnserializeCallback');

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  7. try {
  8. return $this->provider->fetchMultiple($ids);
  9. } catch (\Error $e) {
  10. $trace = $e->getTrace();
  1. @trigger_error(sprintf('The "%s::unserialize()" method is deprecated since Symfony 4.2, use DefaultMarshaller instead.', __CLASS__), E_USER_DEPRECATED);
  2. if ('b:0;' === $value) {
  3. return false;
  4. }
  5. $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback');

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  6. try {
  7. if (false !== $value = unserialize($value)) {
  8. return $value;
  9. }
  10. throw new \DomainException('Failed to unserialize cached value');
  1. }
  2. throw new \DomainException('Failed to unserialize cached value');
  3. } catch (\Error $e) {
  4. throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
  5. } finally {
  6. ini_set('unserialize_callback_func', $unserializeCallbackHandler);

    Changing PHP configuration dynamically through ini_set() may create hard to debug errors.

    Time to fix: about 2 hours
    Permalink
    Last edited by Nicolas Grekas
  7. }
  8. }
  9. private function getId($key): string
  10. {

Missing use statement should be avoided 4

More information: https://insight.symfony.com/what-we-analyse/php.missing_use_statement

  1. namespace Symfony\Component\Cache\Simple;
  2. use Symfony\Component\Cache\Traits\ApcuTrait;
  3. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', ApcuCache::class, ApcuAdapter::class, CacheInterface::class), E_USER_DEPRECATED);

    The CacheInterface class resolves to the following classes: Psr\SimpleCache\CacheInterface or Symfony\Component\Validator\Mapping\Cache\CacheInterface or Symfony\Contracts\Cache\CacheInterface or Twig\Cache\CacheInterface.
    Did you forget to add a corresponding use statement for one of them?

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  4. /**
  5. * @deprecated since Symfony 4.3, use ApcuAdapter and type-hint for CacheInterface instead.
  6. */
  7. class ApcuCache extends AbstractCache
  1. namespace Symfony\Component\Cache\Simple;
  2. use Symfony\Component\Cache\Traits\ApcuTrait;
  3. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', ApcuCache::class, ApcuAdapter::class, CacheInterface::class), E_USER_DEPRECATED);

    The ApcuAdapter class resolves to the following class: Symfony\Component\Cache\Adapter\ApcuAdapter.
    Did you forget to add a corresponding use statement?

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  4. /**
  5. * @deprecated since Symfony 4.3, use ApcuAdapter and type-hint for CacheInterface instead.
  6. */
  7. class ApcuCache extends AbstractCache
  1. * file that was distributed with this source code.
  2. */
  3. namespace Symfony\Component\Security\Core\User;
  4. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', LdapUserProvider::class, BaseLdapUserProvider::class), E_USER_DEPRECATED);

    The BaseLdapUserProvider class resolves to the Symfony\Component\Security\Core\User\BaseLdapUserProvider class which PHP does not seem to be able to autoload.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Robin Chalas
  5. use Symfony\Component\Ldap\Entry;
  6. use Symfony\Component\Ldap\Security\LdapUserProvider as BaseLdapUserProvider;
  7. use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
  1. use Symfony\Component\Cache\PruneableInterface;
  2. use Symfony\Component\Cache\ResettableInterface;
  3. use Symfony\Contracts\Cache\CacheInterface;
  4. use Symfony\Contracts\Service\ResetInterface;
  5. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', TraceableCache::class, TraceableAdapter::class, CacheInterface::class), E_USER_DEPRECATED);

    The TraceableAdapter class resolves to the following class: Symfony\Component\Cache\Adapter\TraceableAdapter.
    Did you forget to add a corresponding use statement?

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. /**
  7. * @deprecated since Symfony 4.3, use TraceableAdapter and type-hint for CacheInterface instead.
  8. */
  9. class TraceableCache implements Psr16CacheInterface, PruneableInterface, ResettableInterface

exit() and die() functions should be avoided

More information: https://insight.symfony.com/what-we-analyse/php.use_exit_function

  1. // Ignore this re-throw
  2. }
  3. if ($exit && self::$exitCode) {
  4. $exitCode = self::$exitCode;
  5. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });

    This line stops the execution flow, without explanation. If this is for debug, you should remove it. If this is to deal with an error, use exceptions instead.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  6. }
  7. }
  8. /**
  9. * Gets the fatal error handlers.

sleep() should not be used

More information: https://insight.symfony.com/what-we-analyse/php.use_php_sleep_function

  1. while ($process->isRunning()) {
  2. if (!file_exists($pidFile)) {
  3. $process->stop();
  4. }
  5. sleep(1);

    sleep() may create timeouts without even protecting your application.

    Time to fix: about 4 hours
    Permalink
    Last edited by Fabien Potencier
  6. }
  7. return self::STOPPED;
  8. }

Code should not be duplicated 29

More information: https://insight.symfony.com/what-we-analyse/php.duplicated_code

  1. unset($frame['args'], $frame['this'], $frame);
  2. }
  3. }
  4. $this->setTrace($trace);
  5. } elseif (null !== $traceOffset) {

    The next 32 lines appear both in src/Symfony/Component/Debug/Exception/FatalErrorException.php:37 and src/Symfony/Component/ErrorHandler/Error/FatalError.php:35.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  6. if (\function_exists('xdebug_get_function_stack')) {
  7. $trace = xdebug_get_function_stack();
  8. if (0 < $traceOffset) {
  9. array_splice($trace, -$traceOffset);
  10. }
  1. $deprecations[] = sprintf('The "%s" %s %s "%s" that is deprecated%s.', $class, $type, $verb, $use, self::$deprecated[$use]);
  2. }
  3. if (isset(self::$internal[$use]) && strncmp($ns, str_replace('_', '\\', $use), $len)) {
  4. $deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class);
  5. }
  6. if (isset(self::$method[$use])) {

    The next 18 lines appear both in src/Symfony/Component/Debug/DebugClassLoader.php:292 and src/Symfony/Component/ErrorHandler/DebugClassLoader.php:476.

    Time to fix: about 4 hours
    Permalink
    Last edited by Roland Franssen
  7. if ($refl->isAbstract()) {
  8. if (isset(self::$method[$class])) {
  9. self::$method[$class] = array_merge(self::$method[$class], self::$method[$use]);
  10. } else {
  11. self::$method[$class] = self::$method[$use];
  1. } else {
  2. $ns = str_replace('_', '\\', substr($class, 0, $len));
  3. }
  4. // Detect annotations on the class
  5. if (false !== $doc = $refl->getDocComment()) {

    The next 27 lines appear both in src/Symfony/Component/Debug/DebugClassLoader.php:238 and src/Symfony/Component/ErrorHandler/DebugClassLoader.php:422.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  6. foreach (['final', 'deprecated', 'internal'] as $annotation) {
  7. if (false !== strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
  8. self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
  9. }
  10. }
  1. *
  2. * @return array|null
  3. */
  4. public function checkCase(\ReflectionClass $refl, $file, $class)
  5. {
  6. $real = explode('\\', $class.strrchr($file, '.'));

    The next 123 lines appear both in src/Symfony/Component/Debug/DebugClassLoader.php:410 and src/Symfony/Component/ErrorHandler/DebugClassLoader.php:675.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  7. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  8. $i = \count($tail) - 1;
  9. $j = \count($real) - 1;
  1. $this->checkClass($class, $file);
  2. }
  3. private function checkClass(string $class, string $file = null)
  4. {
  5. $exists = null === $file || class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);

    The next 47 lines appear both in src/Symfony/Component/Debug/DebugClassLoader.php:179 and src/Symfony/Component/ErrorHandler/DebugClassLoader.php:351.

    Time to fix: about 4 hours
    Permalink
    Last edited by Fabien Potencier
  6. if (null !== $file && $class && '\\' === $class[0]) {
  7. $class = substr($class, 1);
  8. }
  1. }
  2. }
  3. }
  4. if (!$doc) {
  5. continue;

    The next 29 lines appear both in src/Symfony/Component/Debug/DebugClassLoader.php:366 and src/Symfony/Component/ErrorHandler/DebugClassLoader.php:637.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  6. }
  7. $finalOrInternal = false;
  8. foreach (['final', 'internal'] as $annotation) {
  1. public function __construct(callable $classLoader)
  2. {
  3. $this->classLoader = $classLoader;
  4. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  5. if (!isset(self::$caseCheck)) {

    The next 30 lines appear both in src/Symfony/Component/Debug/DebugClassLoader.php:53 and src/Symfony/Component/ErrorHandler/DebugClassLoader.php:186.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  6. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  7. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  8. $dir = substr($file, 0, 1 + $i);
  9. $file = substr($file, 1 + $i);
  10. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  1. * @author Grégoire Pineau <lyrixx@lyrixx.info>
  2. * @author Charles Sarrazin <charles@sarraz.in>
  3. */
  4. class FormLoginLdapFactory extends FormLoginFactory
  5. {
  6. protected function createAuthProvider(ContainerBuilder $container, $id, $config, $userProviderId)

    The next 36 lines appear both in src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/FormLoginLdapFactory.php:27 and src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php:29.

    Time to fix: about 4 hours
    Permalink
    Last edited by Grégoire Pineau
  7. {
  8. $provider = 'security.authentication.provider.ldap_bind.'.$id;
  9. $definition = $container
  10. ->setDefinition($provider, new ChildDefinition('security.authentication.provider.ldap_bind'))
  11. ->replaceArgument(0, new Reference($userProviderId))
  1. case 'hy':
  2. case 'ln':
  3. case 'mg':
  4. case 'nso':
  5. case 'xbr':
  6. case 'ti':

    The next 49 lines appear both in src/Symfony/Component/Translation/PluralizationRules.php:145 and src/Symfony/Contracts/Translation/TranslatorTrait.php:206.

    Time to fix: about 4 hours
    Permalink
    Last edited by Fabien Potencier
  7. case 'wa':
  8. return ((0 == $number) || (1 == $number)) ? 0 : 1;
  9. case 'be':
  10. case 'bs':
  1. case 'tr':
  2. case 'vi':
  3. case 'zh':
  4. return 0;
  5. case 'af':

    The next 64 lines appear both in src/Symfony/Component/Translation/PluralizationRules.php:81 and src/Symfony/Contracts/Translation/TranslatorTrait.php:142.

    Time to fix: about 4 hours
    Permalink
    Last edited by Fabien Potencier
  6. case 'bn':
  7. case 'bg':
  8. case 'ca':
  9. case 'da':
  10. case 'de':
  1. /**
  2. * @return $this
  3. */
  4. public function setTrace($trace, $file, $line)
  5. {
  6. $this->trace = [];

    The next 105 lines appear both in src/Symfony/Component/Debug/Exception/FlattenException.php:255 and src/Symfony/Component/ErrorRenderer/Exception/FlattenException.php:276.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  7. $this->trace[] = [
  8. 'namespace' => '',
  9. 'short_class' => '',
  10. 'class' => '',
  11. 'type' => '',
  1. /**
  2. * @return $this
  3. */
  4. public function setPrevious(self $previous)
  5. {
  6. $this->previous = $previous;

    The next 42 lines appear both in src/Symfony/Component/Debug/Exception/FlattenException.php:212 and src/Symfony/Component/ErrorRenderer/Exception/FlattenException.php:233.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  7. return $this;
  8. }
  9. public function getAllPrevious()
  1. }
  2. $e->setStatusCode($statusCode);
  3. $e->setHeaders($headers);
  4. $e->setTraceFromThrowable($exception);
  5. $e->setClass($exception instanceof FatalThrowableError ? $exception->getOriginalClassName() : \get_class($exception));

    The next 36 lines appear both in src/Symfony/Component/Debug/Exception/FlattenException.php:64 and src/Symfony/Component/ErrorRenderer/Exception/FlattenException.php:73.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  6. $e->setFile($exception->getFile());
  7. $e->setLine($exception->getLine());
  8. $previous = $exception->getPrevious();
  1. *
  2. * @return self The registered error handler
  3. */
  4. public static function register(self $handler = null, $replace = true)
  5. {
  6. if (null === self::$reservedMemory) {

    The next 35 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:121 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:110.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  7. self::$reservedMemory = str_repeat('x', 10240);
  8. register_shutdown_function(__CLASS__.'::handleFatalError');
  9. }
  10. if ($handlerIsNew = null === $handler) {
  1. *
  2. * @internal
  3. */
  4. public function handleError($type, $message, $file, $line)
  5. {
  6. if (\PHP_VERSION_ID >= 70300 && E_WARNING === $type && '"' === $message[0] && false !== strpos($message, '" targeting switch is equivalent to "break')) {

    The next 32 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:388 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:401.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  7. $type = E_DEPRECATED;
  8. }
  9. // Level is the current error reporting level to manage silent error.
  10. $level = error_reporting();
  1. }
  2. /**
  3. * Cleans the trace by removing function arguments and the frames added by the error handler and DebugClassLoader.
  4. */
  5. private function cleanTrace(array $backtrace, int $type, string $file, int $line, bool $throw): array

    The next 24 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:694 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:734.

    Time to fix: about 4 hours
    Permalink
    Last edited by Alexander M. Turek
  6. {
  7. $lightTrace = $backtrace;
  8. for ($i = 0; isset($backtrace[$i]); ++$i) {
  9. if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) {
  1. * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
  2. * @param bool $replace Whether to replace or not any existing logger
  3. */
  4. public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false)
  5. {
  6. $loggers = [];

    The next 33 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:184 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:202.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  7. if (\is_array($levels)) {
  8. foreach ($levels as $type => $logLevel) {
  9. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  10. $loggers[$type] = [$logger, $logLevel];
  1. *
  2. * @throws \InvalidArgumentException
  3. */
  4. public function setLoggers(array $loggers)
  5. {
  6. $prevLogged = $this->loggedErrors;

    The next 31 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:218 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:236.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  7. $prev = $this->loggers;
  8. $flush = [];
  9. foreach ($loggers as $type => $log) {
  10. if (!isset($prev[$type])) {
  1. *
  2. * @final since Symfony 4.3
  3. *
  4. * @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\ErrorHandler instead.
  5. */
  6. class ErrorHandler

    The next 52 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:55 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:49.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  7. {
  8. private $levels = [
  9. E_DEPRECATED => 'Deprecated',
  10. E_USER_DEPRECATED => 'User Deprecated',
  11. E_NOTICE => 'Notice',
  1. $context = $e;
  2. }
  3. if (false !== strpos($message, "class@anonymous\0")) {
  4. $logMessage = $this->levels[$type].': '.(new FlattenException())->setMessage($message)->getMessage();
  5. } else {

    The next 109 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:420 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:433.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  6. $logMessage = $this->levels[$type].': '.$message;
  7. }
  8. if (null !== self::$toStringException) {
  9. $errorAsException = self::$toStringException;
  1. *
  2. * @internal
  3. */
  4. public static function handleFatalError(array $error = null)
  5. {
  6. if (null === self::$reservedMemory) {

    The next 48 lines appear both in src/Symfony/Component/Debug/ErrorHandler.php:604 and src/Symfony/Component/ErrorHandler/ErrorHandler.php:613.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  7. return;
  8. }
  9. $handler = self::$reservedMemory = null;
  10. $handlers = [];
  1. $io = new SymfonyStyle($input, $output);
  2. $locale = $input->getArgument('locale');
  3. $domain = $input->getOption('domain');
  4. /** @var KernelInterface $kernel */
  5. $kernel = $this->getApplication()->getKernel();

    The next 19 lines appear both in src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php:134 and src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php:138.

    Time to fix: about 4 hours
    Permalink
    Last edited by Roland Franssen
  6. $rootDir = $kernel->getContainer()->getParameter('kernel.root_dir');
  7. // Define Root Paths
  8. $transPaths = $this->transPaths;
  9. if (is_dir($dir = $rootDir.'/Resources/translations')) {
  1. $this->dsn = $connOrDsn;
  2. } else {
  3. throw new InvalidArgumentException(sprintf('"%s" requires PDO or Doctrine\DBAL\Connection instance or DSN string as first argument, "%s" given.', __CLASS__, \is_object($connOrDsn) ? \get_class($connOrDsn) : \gettype($connOrDsn)));
  4. }
  5. $this->table = isset($options['db_table']) ? $options['db_table'] : $this->table;

    The next 9 lines appear both in src/Symfony/Component/Cache/Traits/PdoTrait.php:63 and src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php:188.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  6. $this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol;
  7. $this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol;
  8. $this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol;
  9. $this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol;
  10. $this->username = isset($options['db_username']) ? $options['db_username'] : $this->username;
  1. }
  2. /**
  3. * {@inheritdoc}
  4. */
  5. protected function requiresAuthentication(Request $request)

    The next 41 lines appear both in src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php:70 and src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php:58.

    Time to fix: about 4 hours
    Permalink
    Last edited by Jordi Boggiano
  6. {
  7. if ($this->options['post_only'] && !$request->isMethod('POST')) {
  8. return false;
  9. }
  1. $message .= "\nDid you forget a \"use\" statement".$tail;
  2. return new ClassNotFoundException($message, $exception);
  3. }
  4. return null;

    The next 119 lines appear both in src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php:79 and src/Symfony/Component/ErrorHandler/ErrorEnhancer/ClassNotFoundErrorEnhancer.php:75.

    Time to fix: about 4 hours
    Permalink
    Last edited by Alexander M. Turek
  5. }
  6. /**
  7. * Tries to guess the full namespace for a given class name.
  8. *
  1. 'application/vnd.kodak-descriptor' => 'sse',
  2. 'application/vnd.las.las+xml' => 'lasxml',
  3. 'application/vnd.llamagraphics.life-balance.desktop' => 'lbd',
  4. 'application/vnd.llamagraphics.life-balance.exchange+xml' => 'lbe',
  5. 'application/vnd.lotus-1-2-3' => '123',
  6. 'application/vnd.lotus-approach' => 'apr',

    The next 25 lines appear both in src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php:306 and src/Symfony/Component/Mime/MimeTypes.php:490.

    Time to fix: about 4 hours
    Permalink
    Last edited by Fabien Potencier
  7. 'application/vnd.lotus-freelance' => 'pre',
  8. 'application/vnd.lotus-notes' => 'nsf',
  9. 'application/vnd.lotus-organizer' => 'org',
  10. 'application/vnd.lotus-screencam' => 'scm',
  11. 'application/vnd.lotus-wordpro' => 'lwp',
  1. *
  2. * @return string An HTML string
  3. */
  4. public function fileExcerpt($file, $line, $srcContext = 3)
  5. {
  6. if (is_file($file) && is_readable($file)) {

    The next 19 lines appear both in src/Symfony/Bridge/Twig/Extension/CodeExtension.php:142 and src/Symfony/Component/ErrorRenderer/ErrorRenderer/HtmlErrorRenderer.php:240.

    Time to fix: about 4 hours
    Permalink
    Last edited by Roland Franssen
  7. // highlight_file could throw warnings
  8. // see https://bugs.php.net/25725
  9. $code = @highlight_file($file, true);
  10. // remove main code/span tags
  11. $code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
  1. $prefixLen = \strlen($prefix);
  2. if (0 !== strpos($error['message'], $prefix)) {
  3. return null;
  4. }
  5. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);

    The next 37 lines appear both in src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php:50 and src/Symfony/Component/ErrorHandler/ErrorEnhancer/UndefinedFunctionErrorEnhancer.php:49.

    Time to fix: about 4 hours
    Permalink
    Last edited by Yonel Ceruto
  6. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  7. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  8. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  9. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  10. } else {
  1. return $result;
  2. }
  3. private function getVariables(TokenInterface $token, $subject): array
  4. {
  5. if (method_exists($token, 'getRoleNames')) {

    The next 21 lines appear both in src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php:98 and src/Symfony/Component/Workflow/EventListener/GuardListener.php:89.

    Time to fix: about 4 hours
    Permalink
    Last edited by Christian Flothmann
  6. $roleNames = $token->getRoleNames();
  7. $roles = array_map(function (string $role) { return new Role($role, false); }, $roleNames);
  8. } else {
  9. @trigger_error(sprintf('Not implementing the "%s::getRoleNames()" method in "%s" is deprecated since Symfony 4.3.', TokenInterface::class, \get_class($token)), E_USER_DEPRECATED);

Error silenced by the at sign (@) 9

More information: https://insight.symfony.com/what-we-analyse/php.silenced_error

  1. try {
  2. if ($this->isFinder && !isset($this->loaded[$class])) {
  3. $this->loaded[$class] = true;
  4. if (!$file = $this->classLoader[0]->findFile($class) ?: false) {
  5. // no-op
  6. } elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {

    Adding "@" before opcache_is_script_cached($file) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  7. include $file;
  8. return;
  9. } elseif (false === include $file) {
  10. return;
  1. // Since OPcache only compiles files older than the script execution start, set the file's mtime in the past
  2. $ok = $this->write($file, "<?php //{$encodedKey}\n\n{$value}\n", self::$startTime - 10) && $ok;
  3. if ($allowCompile) {
  4. @opcache_invalidate($file, true);
  5. @opcache_compile_file($file);

    Adding "@" before opcache_compile_file($file) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  6. }
  7. }
  8. if (!$ok && !is_writable($this->directory)) {
  9. throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory));
  1. }
  2. protected function doUnlink($file)
  3. {
  4. if (self::isSupported()) {
  5. @opcache_invalidate($file, true);

    Adding "@" before opcache_invalidate($file, true) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  6. }
  7. return @unlink($file);
  8. }
  1. $file = $this->files[$key] = $this->getFile($key, true);
  2. // Since OPcache only compiles files older than the script execution start, set the file's mtime in the past
  3. $ok = $this->write($file, "<?php //{$encodedKey}\n\n{$value}\n", self::$startTime - 10) && $ok;
  4. if ($allowCompile) {
  5. @opcache_invalidate($file, true);

    Adding "@" before opcache_invalidate($file, true) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by Fabien Potencier
  6. @opcache_compile_file($file);
  7. }
  8. }
  9. if (!$ok && !is_writable($this->directory)) {
  1. if (\function_exists('posix_isatty')) {
  2. return @posix_isatty($this->stream);
  3. }
  4. $stat = @fstat($this->stream);

    Adding "@" before fstat($this->stream) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by johnstevenson
  5. // Check if formatted mode is S_IFCHR
  6. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  7. }
  8. }
  1. || 'ON' === getenv('ConEmuANSI')
  2. || 'xterm' === getenv('TERM');
  3. }
  4. if (\function_exists('stream_isatty')) {
  5. return @stream_isatty($this->stream);

    Adding "@" before stream_isatty($this->stream) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by johnstevenson
  6. }
  7. if (\function_exists('posix_isatty')) {
  8. return @posix_isatty($this->stream);
  9. }
  1. public function __construct(string $path, string $originalName, string $mimeType = null, int $error = null, $test = false)
  2. {
  3. $this->originalName = $this->getName($originalName);
  4. $this->mimeType = $mimeType ?: 'application/octet-stream';
  5. if (4 < \func_num_args() ? !\is_bool($test) : null !== $error && @filesize($path) === $error) {

    Adding "@" before filesize($path) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by Nicolas Grekas
  6. @trigger_error(sprintf('Passing a size as 4th argument to the constructor of "%s" is deprecated since Symfony 4.1.', __CLASS__), E_USER_DEPRECATED);
  7. $error = $test;
  8. $test = 5 < \func_num_args() ? func_get_arg(5) : false;
  9. }
  1. if (\function_exists('posix_isatty')) {
  2. return @posix_isatty($stream);
  3. }
  4. $stat = @fstat($stream);

    Adding "@" before fstat($stream) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by johnstevenson
  5. // Check if formatted mode is S_IFCHR
  6. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  7. }
  8. /**
  1. || 'ON' === getenv('ConEmuANSI')
  2. || 'xterm' === getenv('TERM');
  3. }
  4. if (\function_exists('stream_isatty')) {
  5. return @stream_isatty($stream);

    Adding "@" before stream_isatty($stream) prevents warning and errors during this function execution from being displayed.
    If you need to do that, you should probably implement a better way to qualify and recover from errors, using Exceptions.

    Time to fix: about 4 hours
    Permalink
    Last edited by johnstevenson
  6. }
  7. if (\function_exists('posix_isatty')) {
  8. return @posix_isatty($stream);
  9. }

Booleans and null should be compared strictly

More information: https://insight.symfony.com/what-we-analyse/php.strict_boolean_comparison_should_be_used

  1. if ($static ? $hasStaticCall : $hasCall) {
  2. continue;
  3. }
  4. $realName = substr($name, 0, strpos($name, '('));
  5. if (!$refl->hasMethod($realName) || !($methodRefl = $refl->getMethod($realName))->isPublic() || ($static && !$methodRefl->isStatic()) || (!$static && $methodRefl->isStatic())) {
  6. $deprecations[] = sprintf('Class "%s" should implement method "%s::%s"%s', $class, ($static ? 'static ' : '').$interface, $name, null == $description ? '.' : ': '.$description);

    With booleans and null, only strict comparison (with === operator) should be used to lower bug risks and to improve performances.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Roland Franssen
  7. }
  8. }
  9. }
  10. }
  11. }

Object parameters should be type hinted 18

More information: https://insight.symfony.com/what-we-analyse/php.object_parameter_not_type_hinted

  1. ];
  2. return self::castError($c, $a);
  3. }
  4. private static function castError($c, array $a): array

    The parameter c, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. if ($errorCode = $c->getErrorCode()) {
  7. $a += [
  8. Caster::PREFIX_VIRTUAL.'error_code' => $errorCode,
  9. Caster::PREFIX_VIRTUAL.'error_message' => $c->getErrorMessage(),
  1. }
  2. return $a;
  3. }
  4. public static function castLength($dom, array $a, Stub $stub, $isNested)

    The parameter dom, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'length' => $dom->length,
  8. ];
  1. }
  2. return $a;
  3. }
  4. public static function castHttpClientResponse($response, array $a, Stub $stub, $isNested)

    The parameter response, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $stub->cut += \count($a);
  7. $a = [];
  8. foreach ($response->getInfo() as $k => $v) {
  1. /**
  2. * @param WorkflowSupportStrategyInterface $supportStrategy
  3. * @param object $subject
  4. */
  5. private function supports(WorkflowInterface $workflow, $supportStrategy, $subject, ?string $workflowName): bool

    The parameter supportStrategy, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Alexander M. Turek
  6. {
  7. if (null !== $workflowName && $workflowName !== $workflow->getName()) {
  8. return false;
  9. }
  1. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * ($a->getATime() - $b->getATime());
  4. };
  5. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter b, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. return $order * ($a->getCTime() - $b->getCTime());
  8. };
  9. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  10. $this->sort = static function ($a, $b) use ($order) {
  11. return $order * ($a->getMTime() - $b->getMTime());
  1. }
  2. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  3. };
  4. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  5. $this->sort = static function ($a, $b) use ($order) {

    The parameter b, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  6. return $order * ($a->getATime() - $b->getATime());
  7. };
  8. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  9. $this->sort = static function ($a, $b) use ($order) {
  10. return $order * ($a->getCTime() - $b->getCTime());
  1. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  4. };
  5. } elseif (self::SORT_BY_TYPE === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter a, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. if ($a->isDir() && $b->isFile()) {
  8. return -$order;
  9. } elseif ($a->isFile() && $b->isDir()) {
  10. return $order;
  11. }
  1. if (self::SORT_BY_NAME === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  4. };
  5. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter a, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  8. };
  9. } elseif (self::SORT_BY_TYPE === $sort) {
  10. $this->sort = static function ($a, $b) use ($order) {
  11. if ($a->isDir() && $b->isFile()) {
  1. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * ($a->getCTime() - $b->getCTime());
  4. };
  5. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter a, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. return $order * ($a->getMTime() - $b->getMTime());
  8. };
  9. } elseif (self::SORT_BY_NONE === $sort) {
  10. $this->sort = $order;
  11. } elseif (\is_callable($sort)) {
  1. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * ($a->getATime() - $b->getATime());
  4. };
  5. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter a, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. return $order * ($a->getCTime() - $b->getCTime());
  8. };
  9. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  10. $this->sort = static function ($a, $b) use ($order) {
  11. return $order * ($a->getMTime() - $b->getMTime());
  1. }
  2. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  3. };
  4. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  5. $this->sort = static function ($a, $b) use ($order) {

    The parameter a, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  6. return $order * ($a->getATime() - $b->getATime());
  7. };
  8. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  9. $this->sort = static function ($a, $b) use ($order) {
  10. return $order * ($a->getCTime() - $b->getCTime());
  1. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * ($a->getCTime() - $b->getCTime());
  4. };
  5. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter b, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. return $order * ($a->getMTime() - $b->getMTime());
  8. };
  9. } elseif (self::SORT_BY_NONE === $sort) {
  10. $this->sort = $order;
  11. } elseif (\is_callable($sort)) {
  1. if (self::SORT_BY_NAME === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  4. };
  5. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter b, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  8. };
  9. } elseif (self::SORT_BY_TYPE === $sort) {
  10. $this->sort = static function ($a, $b) use ($order) {
  11. if ($a->isDir() && $b->isFile()) {
  1. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  2. $this->sort = static function ($a, $b) use ($order) {
  3. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  4. };
  5. } elseif (self::SORT_BY_TYPE === $sort) {
  6. $this->sort = static function ($a, $b) use ($order) {

    The parameter b, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  7. if ($a->isDir() && $b->isFile()) {
  8. return -$order;
  9. } elseif ($a->isFile() && $b->isDir()) {
  10. return $order;
  11. }
  1. {
  2. $this->iterator = $iterator;
  3. $order = $reverseOrder ? -1 : 1;
  4. if (self::SORT_BY_NAME === $sort) {
  5. $this->sort = static function ($a, $b) use ($order) {

    The parameter b, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  6. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  7. };
  8. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  9. $this->sort = static function ($a, $b) use ($order) {
  10. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  1. {
  2. $this->iterator = $iterator;
  3. $order = $reverseOrder ? -1 : 1;
  4. if (self::SORT_BY_NAME === $sort) {
  5. $this->sort = static function ($a, $b) use ($order) {

    The parameter a, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Nicolas Grekas
  6. return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  7. };
  8. } elseif (self::SORT_BY_NAME_NATURAL === $sort) {
  9. $this->sort = static function ($a, $b) use ($order) {
  10. return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
  1. *
  2. * @return string An absolute URL
  3. *
  4. * @throws \LogicException
  5. */
  6. public function generateUri($request, $path)

    The parameter request, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Fabien Potencier
  7. {
  8. if (0 === strpos($path, 'http') || !$path) {
  9. return $path;
  10. }
  1. $records['extra']['token'] = null;
  2. if (null !== $token = $this->tokenStorage->getToken()) {
  3. if (method_exists($token, 'getRoleNames')) {
  4. $roles = $token->getRoleNames();
  5. } else {
  6. $roles = array_map(function ($role) { return $role->getRole(); }, $token->getRoles(false));

    The parameter role, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Permalink
    Last edited by Christian Flothmann
  7. }
  8. $records['extra']['token'] = [
  9. 'username' => $token->getUsername(),
  10. 'authenticated' => $token->isAuthenticated(),

Templates should not be too long

More information: https://insight.symfony.com/what-we-analyse/twig.template_too_long

14% of all your templates have more than 200 lines, the threshold is 5%.

Time to fix: about 6.9 days
Permalink
Collective

Unused method, property, variable or parameter 166

More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. ];
  2. return $a;
  3. }
  4. public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, $isNested, $filter = 0)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode());
  1. ];
  2. return $a;
  3. }
  4. public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'flags' => self::extractFlags($c->getFlags()),
  1. ];
  2. return $a;
  3. }
  4. public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'is_connected' => $c->isConnected(),
  1. ];
  2. return $a;
  3. }
  4. public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'flags' => self::extractFlags($c->getFlags()),
  1. ];
  2. return $a;
  3. }
  4. public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'is_connected' => $c->isConnected(),
  1. ];
  2. return $a;
  3. }
  4. public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'flags' => self::extractFlags($c->getFlags()),
  1. AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT',
  2. AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC',
  3. AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS',
  4. ];
  5. public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. $a += [
  9. $prefix.'is_connected' => $c->isConnected(),
  1. ];
  2. return $a;
  3. }
  4. public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, $isNested, $filter = 0)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode());
  1. ];
  2. return $a;
  3. }
  4. public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'flags' => self::extractFlags($c->getFlags()),
  1. AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT',
  2. AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC',
  3. AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS',
  4. ];
  5. public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. $a += [
  9. $prefix.'is_connected' => $c->isConnected(),
  1. $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId();
  2. return $a;
  3. }
  4. public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. self::addMap($a, $c, [
  7. 'version' => 'getVersion',
  8. 'dependencies' => 'getDependencies',
  9. 'iniEntries' => 'getIniEntries',
  1. self::addExtra($a, $c);
  2. return $a;
  3. }
  4. public static function castReference(\ReflectionReference $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId();
  7. return $a;
  8. }
  1. $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
  2. return $a;
  3. }
  4. public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. self::addMap($a, $c, [
  8. 'position' => 'getPosition',
  1. }
  2. return $a;
  3. }
  4. public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
  7. self::addExtra($a, $c);
  8. return $a;
  1. }
  2. return $a;
  3. }
  4. public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
  7. return $a;
  8. }
  1. }
  2. return $a;
  3. }
  4. public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
  7. return $a;
  8. }
  1. $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId();
  2. return $a;
  3. }
  4. public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. self::addMap($a, $c, [
  7. 'version' => 'getVersion',
  8. 'dependencies' => 'getDependencies',
  9. 'iniEntries' => 'getIniEntries',
  1. ];
  2. return $a;
  3. }
  4. public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. if ($c->getThis()) {
  8. $a[$prefix.'this'] = new CutStub($c->getThis());
  1. }
  2. return $a;
  3. }
  4. public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, $isNested, $filter = 0)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. self::addMap($a, $c, [
  8. 'returnsReference' => 'returnsReference',
  1. ];
  2. return $a;
  3. }
  4. public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. if ($c->getThis()) {
  8. $a[$prefix.'this'] = new CutStub($c->getThis());
  1. self::addExtra($a, $c);
  2. return $a;
  3. }
  4. public static function castReference(\ReflectionReference $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId();
  7. return $a;
  8. }
  1. ]);
  2. return $a;
  3. }
  4. public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. self::addMap($a, $c, [
  7. 'version' => 'getVersion',
  8. 'author' => 'getAuthor',
  9. 'copyright' => 'getCopyright',
  1. }
  2. return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
  3. }
  4. public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'name' => $c->getName(),
  1. }
  2. return $a;
  3. }
  4. public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
  7. self::addExtra($a, $c);
  8. return $a;
  1. $a[Caster::PREFIX_VIRTUAL.'closed'] = false;
  2. return $a;
  3. }
  4. public static function castClass(\ReflectionClass $c, array $a, Stub $stub, $isNested, $filter = 0)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. if ($n = \Reflection::getModifierNames($c->getModifiers())) {
  8. $a[$prefix.'modifiers'] = implode(' ', $n);
  1. ]);
  2. return $a;
  3. }
  4. public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. self::addMap($a, $c, [
  7. 'version' => 'getVersion',
  8. 'author' => 'getAuthor',
  9. 'copyright' => 'getCopyright',
  1. }
  2. return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
  3. }
  4. public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a += [
  8. $prefix.'name' => $c->getName(),
  1. $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
  2. return $a;
  3. }
  4. public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. self::addMap($a, $c, [
  8. 'position' => 'getPosition',
  1. }
  2. return self::castError($c, $a);
  3. }
  4. public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, $isNested, $filter = 0)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'type' => $c->getType(),
  8. Caster::PREFIX_VIRTUAL.'first_day_of_week' => $c->getFirstDayOfWeek(),
  9. Caster::PREFIX_VIRTUAL.'minimal_days_in_first_week' => $c->getMinimalDaysInFirstWeek(),
  1. }
  2. return self::castError($c, $a);
  3. }
  4. public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, $isNested, $filter = 0)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'type' => $c->getType(),
  8. Caster::PREFIX_VIRTUAL.'first_day_of_week' => $c->getFirstDayOfWeek(),
  9. Caster::PREFIX_VIRTUAL.'minimal_days_in_first_week' => $c->getMinimalDaysInFirstWeek(),
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class IntlCaster
  5. {
  6. public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  7. {
  8. $a += [
  9. Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
  10. Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
  11. ];
  1. ];
  2. return self::castError($c, $a);
  3. }
  4. public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'display_name' => $c->getDisplayName(),
  8. Caster::PREFIX_VIRTUAL.'id' => $c->getID(),
  9. Caster::PREFIX_VIRTUAL.'raw_offset' => $c->getRawOffset(),
  1. ];
  2. return self::castError($c, $a);
  3. }
  4. public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $stub, $isNested, $filter = 0)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
  8. Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
  9. ];
  1. ];
  2. return self::castError($c, $a);
  3. }
  4. public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, $isNested, $filter = 0)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
  8. Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
  9. Caster::PREFIX_VIRTUAL.'calendar' => $c->getCalendar(),
  1. ];
  2. return self::castError($c, $a);
  3. }
  4. public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'display_name' => $c->getDisplayName(),
  8. Caster::PREFIX_VIRTUAL.'id' => $c->getID(),
  9. Caster::PREFIX_VIRTUAL.'raw_offset' => $c->getRawOffset(),
  1. ];
  2. return self::castError($c, $a);
  3. }
  4. public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, $isNested, $filter = 0)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
  8. Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
  9. Caster::PREFIX_VIRTUAL.'calendar' => $c->getCalendar(),
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class IntlCaster
  5. {
  6. public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  7. {
  8. $a += [
  9. Caster::PREFIX_VIRTUAL.'locale' => $c->getLocale(),
  10. Caster::PREFIX_VIRTUAL.'pattern' => $c->getPattern(),
  11. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'document' => $dom->document,
  8. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'document' => $dom->document,
  8. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'typeName' => $dom->typeName,
  8. 'typeNamespace' => $dom->typeNamespace,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  9. 'notationName' => $dom->notationName,
  1. ];
  2. return $a;
  3. }
  4. public static function castText(\DOMText $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'wholeText' => $dom->wholeText,
  8. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'lineNumber' => $dom->lineNumber,
  8. 'columnNumber' => $dom->columnNumber,
  9. 'offset' => $dom->offset,
  1. ];
  2. return $a;
  3. }
  4. public static function castElement(\DOMElement $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'tagName' => $dom->tagName,
  8. 'schemaTypeInfo' => $dom->schemaTypeInfo,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, $isNested, $filter = 0)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'doctype' => $dom->doctype,
  8. 'implementation' => $dom->implementation,
  9. 'documentElement' => new CutStub($dom->documentElement),
  1. ];
  2. return $a;
  3. }
  4. public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, $isNested, $filter = 0)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'doctype' => $dom->doctype,
  8. 'implementation' => $dom->implementation,
  9. 'documentElement' => new CutStub($dom->documentElement),
  1. ];
  2. return $a;
  3. }
  4. public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'target' => $dom->target,
  8. 'data' => $dom->data,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castImplementation($dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'Core' => '1.0',
  8. Caster::PREFIX_VIRTUAL.'XML' => '2.0',
  9. ];
  1. }
  2. return $a;
  3. }
  4. public static function castLength($dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'length' => $dom->length,
  8. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  9. 'notationName' => $dom->notationName,
  1. ];
  2. return $a;
  3. }
  4. public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'nodeName' => $dom->nodeName,
  8. 'nodeValue' => new CutStub($dom->nodeValue),
  9. 'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
  1. ];
  2. return $a;
  3. }
  4. public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'target' => $dom->target,
  8. 'data' => $dom->data,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'severity' => $dom->severity,
  8. 'message' => $dom->message,
  9. 'type' => $dom->type,
  1. }
  2. return $a;
  3. }
  4. public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'data' => $dom->data,
  8. 'length' => $dom->length,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'name' => $dom->name,
  8. 'specified' => $dom->specified,
  9. 'value' => $dom->value,
  1. ];
  2. return $a;
  3. }
  4. public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'typeName' => $dom->typeName,
  8. 'typeNamespace' => $dom->typeNamespace,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castNode(\DOMNode $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'nodeName' => $dom->nodeName,
  8. 'nodeValue' => new CutStub($dom->nodeValue),
  9. 'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
  1. ];
  2. return $a;
  3. }
  4. public static function castElement(\DOMElement $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'tagName' => $dom->tagName,
  8. 'schemaTypeInfo' => $dom->schemaTypeInfo,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'name' => $dom->name,
  8. 'entities' => $dom->entities,
  9. 'notations' => $dom->notations,
  1. ];
  2. return $a;
  3. }
  4. public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'severity' => $dom->severity,
  8. 'message' => $dom->message,
  9. 'type' => $dom->type,
  1. }
  2. return $a;
  3. }
  4. public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'data' => $dom->data,
  8. 'length' => $dom->length,
  9. ];
  1. XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
  2. XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
  3. XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
  4. ];
  5. public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $k = Caster::PREFIX_PROTECTED.'code';
  8. if (isset($a[$k], self::$errorCodes[$a[$k]])) {
  9. $a[$k] = new ConstStub(self::$errorCodes[$a[$k]], $a[$k]);
  10. }
  1. ];
  2. return $a;
  3. }
  4. public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'name' => $dom->name,
  8. 'entities' => $dom->entities,
  9. 'notations' => $dom->notations,
  1. ];
  2. return $a;
  3. }
  4. public static function castImplementation($dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'Core' => '1.0',
  8. Caster::PREFIX_VIRTUAL.'XML' => '2.0',
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'nodeName' => $dom->nodeName,
  8. 'nodeValue' => new CutStub($dom->nodeValue),
  9. 'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
  1. }
  2. return $a;
  3. }
  4. public static function castLength($dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'length' => $dom->length,
  8. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castNode(\DOMNode $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'nodeName' => $dom->nodeName,
  8. 'nodeValue' => new CutStub($dom->nodeValue),
  9. 'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
  1. ];
  2. return $a;
  3. }
  4. public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'name' => $dom->name,
  8. 'specified' => $dom->specified,
  9. 'value' => $dom->value,
  1. ];
  2. return $a;
  3. }
  4. public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'lineNumber' => $dom->lineNumber,
  8. 'columnNumber' => $dom->columnNumber,
  9. 'offset' => $dom->offset,
  1. XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
  2. XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
  3. XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
  4. ];
  5. public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)

    This e argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $k = Caster::PREFIX_PROTECTED.'code';
  8. if (isset($a[$k], self::$errorCodes[$a[$k]])) {
  9. $a[$k] = new ConstStub(self::$errorCodes[$a[$k]], $a[$k]);
  10. }
  1. XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
  2. XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
  3. XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
  4. ];
  5. public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $k = Caster::PREFIX_PROTECTED.'code';
  8. if (isset($a[$k], self::$errorCodes[$a[$k]])) {
  9. $a[$k] = new ConstStub(self::$errorCodes[$a[$k]], $a[$k]);
  10. }
  1. ];
  2. return $a;
  3. }
  4. public static function castImplementation($dom, array $a, Stub $stub, $isNested)

    This dom argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'Core' => '1.0',
  8. Caster::PREFIX_VIRTUAL.'XML' => '2.0',
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  9. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castText(\DOMText $dom, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. 'wholeText' => $dom->wholeText,
  8. ];
  1. $format = '%R ' === $format ? '0s' : $format;
  2. return $i->format(rtrim($format));
  3. }
  4. public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, $isNested, $filter)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  5. {
  6. $location = $timeZone->getLocation();
  7. $formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
  8. $title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
  1. */
  2. class DateCaster
  3. {
  4. private const PERIOD_LIMIT = 3;
  5. public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, $isNested, $filter)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. $location = $d->getTimezone()->getLocation();
  9. $fromNow = (new \DateTime())->diff($d);
  1. */
  2. class DateCaster
  3. {
  4. private const PERIOD_LIMIT = 3;
  5. public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, $isNested, $filter)

    This filter argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. $location = $d->getTimezone()->getLocation();
  9. $fromNow = (new \DateTime())->diff($d);
  1. $stub->class .= $d->format(' @U');
  2. return $a;
  3. }
  4. public static function castInterval(\DateInterval $interval, array $a, Stub $stub, $isNested, $filter)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  5. {
  6. $now = new \DateTimeImmutable();
  7. $numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
  8. $title = number_format($numberOfSeconds, 0, '.', ' ').'s';
  1. $format = '%R ' === $format ? '0s' : $format;
  2. return $i->format(rtrim($format));
  3. }
  4. public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, $isNested, $filter)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  5. {
  6. $location = $timeZone->getLocation();
  7. $formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
  8. $title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
  1. $z = [Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)];
  2. return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a;
  3. }
  4. public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  5. {
  6. $dates = [];
  7. if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/74639
  8. foreach (clone $p as $i => $d) {
  9. if (self::PERIOD_LIMIT === $i) {
  1. $z = [Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)];
  2. return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a;
  3. }
  4. public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  5. {
  6. $dates = [];
  7. if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/74639
  8. foreach (clone $p as $i => $d) {
  9. if (self::PERIOD_LIMIT === $i) {
  1. $stub->class .= $d->format(' @U');
  2. return $a;
  3. }
  4. public static function castInterval(\DateInterval $interval, array $a, Stub $stub, $isNested, $filter)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Dany Maillard
  5. {
  6. $now = new \DateTimeImmutable();
  7. $numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
  8. $title = number_format($numberOfSeconds, 0, '.', ' ').'s';
  1. }
  2. return $a;
  3. }
  4. public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. static $map = [
  7. 'csvControl' => 'getCsvControl',
  8. 'flags' => 'getFlags',
  9. 'maxLineLen' => 'getMaxLineLen',
  1. $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
  2. return $a;
  3. }
  4. public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get();
  7. return $a;
  8. }
  1. ];
  2. return $a;
  3. }
  4. public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $storage = [];
  7. unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
  8. $clone = clone $c;
  1. }
  2. return $a;
  3. }
  4. public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. static $map = [
  7. 'csvControl' => 'getCsvControl',
  8. 'flags' => 'getFlags',
  9. 'maxLineLen' => 'getMaxLineLen',
  1. }
  2. return $a;
  3. }
  4. public static function castFixedArray(\SplFixedArray $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'storage' => $c->toArray(),
  8. ];
  1. ];
  2. return $a;
  3. }
  4. public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $mode = $c->getIteratorMode();
  8. $c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
  1. ];
  2. return $a;
  3. }
  4. public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
  7. return $a;
  8. }
  1. ];
  2. return $a;
  3. }
  4. public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $storage = [];
  7. unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
  8. $clone = clone $c;
  1. $c->setIteratorMode($mode);
  2. return $a;
  3. }
  4. public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. static $map = [
  7. 'path' => 'getPath',
  8. 'filename' => 'getFilename',
  9. 'basename' => 'getBasename',
  1. $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
  2. return $a;
  3. }
  4. public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get();
  7. return $a;
  8. }
  1. $c->setIteratorMode($mode);
  2. return $a;
  3. }
  4. public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Grégoire Pineau
  5. {
  6. static $map = [
  7. 'path' => 'getPath',
  8. 'filename' => 'getFilename',
  9. 'basename' => 'getBasename',
  1. $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get();
  2. return $a;
  3. }
  4. private static function castSplArray($c, array $a, Stub $stub, bool $isNested): array

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Alexander M. Turek
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $class = $stub->class;
  8. $flags = $c->getFlags();
  1. ];
  2. return $a;
  3. }
  4. public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $mode = $c->getIteratorMode();
  8. $c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
  1. ];
  2. return $a;
  3. }
  4. public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
  7. return $a;
  8. }
  1. }
  2. return $a;
  3. }
  4. public static function castFixedArray(\SplFixedArray $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += [
  7. Caster::PREFIX_VIRTUAL.'storage' => $c->toArray(),
  8. ];
  1. 'basePath' => 'getBasePath',
  2. 'method' => 'getMethod',
  3. 'format' => 'getRequestFormat',
  4. ];
  5. public static function castRequest(Request $request, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $clone = null;
  8. foreach (self::$requestGetters as $prop => $getter) {
  9. $key = Caster::PREFIX_PROTECTED.$prop;
  1. }
  2. return $a;
  3. }
  4. public static function castHttpClient($client, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $multiKey = sprintf("\0%s\0multi", \get_class($client));
  7. if (isset($a[$multiKey])) {
  8. $a[$multiKey] = new CutStub($a[$multiKey]);
  9. }
  1. 'basePath' => 'getBasePath',
  2. 'method' => 'getMethod',
  3. 'format' => 'getRequestFormat',
  4. ];
  5. public static function castRequest(Request $request, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $clone = null;
  8. foreach (self::$requestGetters as $prop => $getter) {
  9. $key = Caster::PREFIX_PROTECTED.$prop;
  1. }
  2. return $a;
  3. }
  4. public static function castHttpClient($client, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $multiKey = sprintf("\0%s\0multi", \get_class($client));
  7. if (isset($a[$multiKey])) {
  8. $a[$multiKey] = new CutStub($a[$multiKey]);
  9. }
  1. }
  2. return $a;
  3. }
  4. public static function castHttpClientResponse($response, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $stub->cut += \count($a);
  7. $a = [];
  8. foreach ($response->getInfo() as $k => $v) {
  1. $a['seek position'] = pg_lo_tell($lo);
  2. return $a;
  3. }
  4. public static function castLink($link, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a['status'] = pg_connection_status($link);
  7. $a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
  8. $a['busy'] = pg_connection_busy($link);
  1. $a['param'] = new EnumStub($a['param']);
  2. return $a;
  3. }
  4. public static function castResult($result, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a['num rows'] = pg_num_rows($result);
  7. $a['status'] = pg_result_status($result);
  8. if (isset(self::$resultStatus[$a['status']])) {
  9. $a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']);
  1. 'file' => PGSQL_DIAG_SOURCE_FILE,
  2. 'line' => PGSQL_DIAG_SOURCE_LINE,
  3. 'function' => PGSQL_DIAG_SOURCE_FUNCTION,
  4. ];
  5. public static function castLargeObject($lo, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $a['seek position'] = pg_lo_tell($lo);
  8. return $a;
  9. }
  1. $a['seek position'] = pg_lo_tell($lo);
  2. return $a;
  3. }
  4. public static function castLink($link, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a['status'] = pg_connection_status($link);
  7. $a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
  8. $a['busy'] = pg_connection_busy($link);
  1. $a['param'] = new EnumStub($a['param']);
  2. return $a;
  3. }
  4. public static function castResult($result, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a['num rows'] = pg_num_rows($result);
  7. $a['status'] = pg_result_status($result);
  8. if (isset(self::$resultStatus[$a['status']])) {
  9. $a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']);
  1. 'file' => PGSQL_DIAG_SOURCE_FILE,
  2. 'line' => PGSQL_DIAG_SOURCE_LINE,
  3. 'function' => PGSQL_DIAG_SOURCE_FUNCTION,
  4. ];
  5. public static function castLargeObject($lo, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $a['seek position'] = pg_lo_tell($lo);
  8. return $a;
  9. }
  1. /**
  2. * Gets the stylesheet associated with the given exception.
  3. *
  4. * @return string The stylesheet as a string
  5. */
  6. public function getStylesheet(FlattenException $exception)

    This exception argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Yonel Ceruto
  7. {
  8. if (!$this->debug) {
  9. return <<<'EOF'
  10. body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
  11. .container { margin: 30px; max-width: 600px; }
  1. */
  2. protected static $container;
  3. protected static $booted;
  4. private function doTearDown()

    This doTearDown method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. static::ensureKernelShutdown();
  7. }
  8. /**
  1. public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
  2. {
  3. return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
  4. }
  5. public static function castErrorException(\ErrorException $e, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
  8. $a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
  9. }
  1. }
  2. return $a;
  3. }
  4. public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)

    This e argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $trace = Caster::PREFIX_VIRTUAL.'trace';
  7. $prefix = Caster::PREFIX_PROTECTED;
  8. $xPrefix = "\0Exception\0";
  1. }
  2. return $a;
  3. }
  4. public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. if (!$isNested) {
  7. return $a;
  8. }
  9. $f = $frame->value;
  1. unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
  2. return $a;
  3. }
  4. public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $sPrefix = "\0".SilencedErrorContext::class."\0";
  7. if (!isset($a[$s = $sPrefix.'severity'])) {
  8. return $a;
  1. unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
  2. return $a;
  3. }
  4. public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $sPrefix = "\0".SilencedErrorContext::class."\0";
  7. if (!isset($a[$s = $sPrefix.'severity'])) {
  8. return $a;
  1. unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
  2. return $a;
  3. }
  4. public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, $isNested)

    This e argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $sPrefix = "\0".SilencedErrorContext::class."\0";
  7. if (!isset($a[$s = $sPrefix.'severity'])) {
  8. return $a;
  1. }
  2. return $a;
  3. }
  4. public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $trace = Caster::PREFIX_VIRTUAL.'trace';
  7. $prefix = Caster::PREFIX_PROTECTED;
  8. $xPrefix = "\0Exception\0";
  1. }
  2. return $a;
  3. }
  4. public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $trace = Caster::PREFIX_VIRTUAL.'trace';
  7. $prefix = Caster::PREFIX_PROTECTED;
  8. $xPrefix = "\0Exception\0";
  1. public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
  2. {
  3. return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
  4. }
  5. public static function castErrorException(\ErrorException $e, array $a, Stub $stub, $isNested)

    This e argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
  8. $a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
  9. }
  1. public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
  2. {
  3. return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
  4. }
  5. public static function castErrorException(\ErrorException $e, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
  8. $a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
  9. }
  1. XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
  2. XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
  3. XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
  4. ];
  5. public static function castXml($h, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $a['current_byte_index'] = xml_get_current_byte_index($h);
  8. $a['current_column_number'] = xml_get_current_column_number($h);
  9. $a['current_line_number'] = xml_get_current_line_number($h);
  10. $a['error_code'] = xml_get_error_code($h);
  1. XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
  2. XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
  3. XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
  4. ];
  5. public static function castXml($h, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $a['current_byte_index'] = xml_get_current_byte_index($h);
  8. $a['current_column_number'] = xml_get_current_column_number($h);
  9. $a['current_line_number'] = xml_get_current_line_number($h);
  10. $a['error_code'] = xml_get_error_code($h);
  1. \PDO::FETCH_NUM => 'NUM',
  2. \PDO::FETCH_OBJ => 'OBJ',
  3. ],
  4. ];
  5. public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $attr = [];
  8. $errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
  9. $c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
  1. \PDO::FETCH_NUM => 'NUM',
  2. \PDO::FETCH_OBJ => 'OBJ',
  3. ],
  4. ];
  5. public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $attr = [];
  8. $errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
  9. $c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
  1. $c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);
  2. return $a;
  3. }
  4. public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a[$prefix.'errorInfo'] = $c->errorInfo();
  8. if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
  1. $c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);
  2. return $a;
  3. }
  4. public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $prefix = Caster::PREFIX_VIRTUAL;
  7. $a[$prefix.'errorInfo'] = $c->errorInfo();
  8. if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
  1. if (!$type || (!$log && !$throw)) {
  2. return !$silenced && $type && $log;
  3. }
  4. $scope = $this->scopedErrors & $type;
  5. if (4 < $numArgs = \func_num_args()) {

    This numArgs local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Yonel Ceruto
  6. $context = $scope ? (func_get_arg(4) ?: []) : [];
  7. } else {
  8. $context = [];
  9. }
  1. $a['trueColor'] = imageistruecolor($gd);
  2. return $a;
  3. }
  4. public static function castMysqlLink($h, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a['host'] = mysql_get_host_info($h);
  7. $a['protocol'] = mysql_get_proto_info($h);
  8. $a['server'] = mysql_get_server_info($h);
  1. $a['trueColor'] = imageistruecolor($gd);
  2. return $a;
  3. }
  4. public static function castMysqlLink($h, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a['host'] = mysql_get_host_info($h);
  7. $a['protocol'] = mysql_get_proto_info($h);
  8. $a['server'] = mysql_get_server_info($h);
  1. public static function castCurl($h, array $a, Stub $stub, $isNested)
  2. {
  3. return curl_getinfo($h);
  4. }
  5. public static function castDba($dba, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $list = dba_list();
  8. $a['file'] = $list[(int) $dba];
  9. return $a;
  1. public static function castCurl($h, array $a, Stub $stub, $isNested)
  2. {
  3. return curl_getinfo($h);
  4. }
  5. public static function castDba($dba, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $list = dba_list();
  8. $a['file'] = $list[(int) $dba];
  9. return $a;
  1. $a['server'] = mysql_get_server_info($h);
  2. return $a;
  3. }
  4. public static function castOpensslX509($h, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $stub->cut = -1;
  7. $info = openssl_x509_parse($h, false);
  8. $pin = openssl_pkey_get_public($h);
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class ProxyManagerCaster
  5. {
  6. public static function castProxy(ProxyInterface $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  7. {
  8. if ($parent = get_parent_class($c)) {
  9. $stub->class .= ' - '.$parent;
  10. }
  11. $stub->class .= '@proxy';
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class DoctrineCaster
  5. {
  6. public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  7. {
  8. foreach (['__cloner__', '__initializer__'] as $k) {
  9. if (\array_key_exists($k, $a)) {
  10. unset($a[$k]);
  11. ++$stub->cut;
  1. }
  2. return $a;
  3. }
  4. public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. foreach (['snapshot', 'association', 'typeClass'] as $k) {
  7. if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
  8. $a[$k] = new CutStub($a[$k]);
  9. }
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class DoctrineCaster
  5. {
  6. public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)

    This proxy argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  7. {
  8. foreach (['__cloner__', '__initializer__'] as $k) {
  9. if (\array_key_exists($k, $a)) {
  10. unset($a[$k]);
  11. ++$stub->cut;
  1. }
  2. return $a;
  3. }
  4. public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. foreach (['_entityPersister', '_identifier'] as $k) {
  7. if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
  8. unset($a[$k]);
  9. ++$stub->cut;
  1. }
  2. return $a;
  3. }
  4. public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)

    This proxy argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. foreach (['_entityPersister', '_identifier'] as $k) {
  7. if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
  8. unset($a[$k]);
  9. ++$stub->cut;
  1. }
  2. return $a;
  3. }
  4. public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)

    This coll argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. foreach (['snapshot', 'association', 'typeClass'] as $k) {
  7. if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
  8. $a[$k] = new CutStub($a[$k]);
  9. }
  1. }
  2. return $a;
  3. }
  4. public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. foreach (['snapshot', 'association', 'typeClass'] as $k) {
  7. if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
  8. $a[$k] = new CutStub($a[$k]);
  9. }
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class GmpCaster
  5. {
  6. public static function castGmp(\GMP $gmp, array $a, Stub $stub, $isNested, $filter): array

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Amrouche Hamza
  7. {
  8. $a[Caster::PREFIX_VIRTUAL.'value'] = new ConstStub(gmp_strval($gmp), gmp_strval($gmp));
  9. return $a;
  10. }
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class GmpCaster
  5. {
  6. public static function castGmp(\GMP $gmp, array $a, Stub $stub, $isNested, $filter): array

    This filter argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Amrouche Hamza
  7. {
  8. $a[Caster::PREFIX_VIRTUAL.'value'] = new ConstStub(gmp_strval($gmp), gmp_strval($gmp));
  9. return $a;
  10. }
  1. *
  2. * @final since Symfony 4.4
  3. */
  4. class GmpCaster
  5. {
  6. public static function castGmp(\GMP $gmp, array $a, Stub $stub, $isNested, $filter): array

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Amrouche Hamza
  7. {
  8. $a[Caster::PREFIX_VIRTUAL.'value'] = new ConstStub(gmp_strval($gmp), gmp_strval($gmp));
  9. return $a;
  10. }
  1. $prefix.'lastError' => $c->getLastError(),
  2. $prefix.'options' => self::getRedisOptions($c),
  3. ];
  4. }
  5. public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. $failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER);
  9. $a += [
  1. \RedisCluster::FAILOVER_ERROR => 'ERROR',
  2. \RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE',
  3. \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES',
  4. ];
  5. public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. if (!$connected = $c->isConnected()) {
  9. return $a + [
  1. $prefix.'lastError' => $c->getLastError(),
  2. $prefix.'options' => self::getRedisOptions($c),
  3. ];
  4. }
  5. public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. $failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER);
  9. $a += [
  1. $prefix.'persistentId' => $c->getPersistentID(),
  2. $prefix.'options' => self::getRedisOptions($c),
  3. ];
  4. }
  5. public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. return $a + [
  9. $prefix.'hosts' => $c->_hosts(),
  1. $prefix.'persistentId' => $c->getPersistentID(),
  2. $prefix.'options' => self::getRedisOptions($c),
  3. ];
  4. }
  5. public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. return $a + [
  9. $prefix.'hosts' => $c->_hosts(),
  1. \RedisCluster::FAILOVER_ERROR => 'ERROR',
  2. \RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE',
  3. \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES',
  4. ];
  5. public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $prefix = Caster::PREFIX_VIRTUAL;
  8. if (!$connected = $c->isConnected()) {
  9. return $a + [
  1. \XMLReader::END_ELEMENT => 'END_ELEMENT',
  2. \XMLReader::END_ENTITY => 'END_ENTITY',
  3. \XMLReader::XML_DECLARATION => 'XML_DECLARATION',
  4. ];
  5. public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. $props = Caster::PREFIX_VIRTUAL.'parserProperties';
  8. $info = [
  9. 'localName' => $reader->localName,
  10. 'prefix' => $reader->prefix,
  1. $this->dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
  2. $this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
  3. }
  4. private function doTearDown()

    This doTearDown method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Massimiliano Arione
  5. {
  6. if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) {
  7. $this->validator = null;
  8. }
  9. }
  1. /**
  2. * @var EventDispatcherInterface
  3. */
  4. protected $dispatcher;
  5. private function doSetUp()

    This doSetUp method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Massimiliano Arione
  6. {
  7. parent::setUp();
  8. $this->dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)->getMock();
  9. $this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory);
  1. }
  2. return $a;
  3. }
  4. public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, bool $isNested): array

    This c argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Alexander M. Turek
  5. {
  6. if (isset($a['__PHP_Incomplete_Class_Name'])) {
  7. $stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
  8. unset($a['__PHP_Incomplete_Class_Name']);
  9. }
  1. }
  2. return $a;
  3. }
  4. public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, bool $isNested): array

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Alexander M. Turek
  5. {
  6. if (isset($a['__PHP_Incomplete_Class_Name'])) {
  7. $stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
  8. unset($a['__PHP_Incomplete_Class_Name']);
  9. }
  1. protected $root;
  2. protected $propertyPath;
  3. protected $constraint;
  4. protected $defaultTimezone;
  5. private function doSetUp()

    This doSetUp method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Massimiliano Arione
  6. {
  7. $this->group = 'MyGroup';
  8. $this->metadata = null;
  9. $this->object = null;
  10. $this->value = 'InvalidValue';
  1. \Locale::setDefault('en');
  2. $this->setDefaultTimezone('UTC');
  3. }
  4. private function doTearDown()

    This doTearDown method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Massimiliano Arione
  5. {
  6. $this->restoreDefaultTimezone();
  7. }
  8. protected function setDefaultTimezone($defaultTimezone)
  1. class MemcachedCaster
  2. {
  3. private static $optionConstants;
  4. private static $defaultOptions;
  5. public static function castMemcached(\Memcached $c, array $a, Stub $stub, $isNested)

    This stub argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  6. {
  7. $a += [
  8. Caster::PREFIX_VIRTUAL.'servers' => $c->getServerList(),
  9. Caster::PREFIX_VIRTUAL.'options' => new EnumStub(
  10. self::getNonDefaultOptions($c)
  1. class MemcachedCaster
  2. {
  3. private static $optionConstants;
  4. private static $defaultOptions;
  5. public static function castMemcached(\Memcached $c, array $a, Stub $stub, $isNested)

    This isNested argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Jan Schädlich
  6. {
  7. $a += [
  8. Caster::PREFIX_VIRTUAL.'servers' => $c->getServerList(),
  9. Caster::PREFIX_VIRTUAL.'options' => new EnumStub(
  10. self::getNonDefaultOptions($c)
  1. }
  2. return $this->trans($id, ['%count%' => $number] + $parameters, $domain, $locale);
  3. }
  4. private function getPluralizationRule(int $number, string $locale): int

    This getPluralizationRule method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  5. {
  6. return PluralizationRules::get($number, $locale, false);
  7. }
  8. }
  1. *
  2. * @return Response A Response instance
  3. *
  4. * @throws NotFoundHttpException
  5. */
  6. public function cssAction($token)

    This token argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Fabien Potencier
  7. {
  8. if (null === $this->profiler) {
  9. throw new NotFoundHttpException('The profiler must be enabled.');
  10. }
  1. $defaults = $this->getNode('vars');
  2. $vars = null;
  3. }
  4. list($msg, $defaults) = $this->compileString($this->getNode('body'), $defaults, (bool) $vars);
  5. $method = !$this->hasNode('count') ? 'trans' : 'transChoice';

    This method local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Fabien Potencier
  6. $compiler
  7. ->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
  8. ->subcompile($msg)
  9. ;
  1. */
  2. protected function createChildContext(array $parentContext, $attribute/*, ?string $format */): array
  3. {
  4. if (\func_num_args() < 3) {
  5. @trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED);
  6. $format = null;

    This format local variable is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by David Buchmann
  7. }
  8. if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
  9. $parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
  10. } else {
  11. unset($parentContext[self::ATTRIBUTES]);
  1. /**
  2. * @var FormFactoryInterface
  3. */
  4. protected $factory;
  5. private function doSetUp()

    This doSetUp method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Massimiliano Arione
  6. {
  7. $this->factory = Forms::createFormFactoryBuilder()
  8. ->addExtensions($this->getExtensions())
  9. ->addTypeExtensions($this->getTypeExtensions())
  10. ->addTypes($this->getTypes())
  1. {
  2. use ForwardCompatTestTrait;
  3. use WebTestAssertionsTrait;
  4. use MailerAssertionsTrait;
  5. private function doTearDown()

    This doTearDown method is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. parent::tearDown();
  8. self::getClient(null);
  9. }
  1. public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
  2. {
  3. return $isNested ? $c->preservedSubset : $a;
  4. }
  5. public static function cutInternals($obj, array $a, Stub $stub, $isNested)

    This obj argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Permalink
    Last edited by Nicolas Grekas
  6. {
  7. if ($isNested) {
  8. $stub->cut += \count($a);
  9. return [];

Commented code should not be committed 32

More information: https://insight.symfony.com/what-we-analyse/php.commented_out_code

  1. // if ($hint = $this->getInfo()) {
  2. // $e->addHint($hint);
  3. // }
  4. // $e->setPath($this->getPath());
  5. //
  6. // throw $e;

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  7. }
  8. if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
  9. $ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), json_encode($value)));
  10. if ($hint = $this->getInfo()) {
  1. @trigger_error(sprintf('Setting path "%s" to an environment variable is deprecated since Symfony 4.3. Remove "cannotBeEmpty()", "validate()" or include a prefix/suffix value instead.', $this->getPath()), E_USER_DEPRECATED);
  2. // $e = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an environment variable when empty values are not allowed by definition and are validated.', $this->getPath(), json_encode($value)));
  3. // if ($hint = $this->getInfo()) {
  4. // $e->addHint($hint);
  5. // }
  6. // $e->setPath($this->getPath());

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  7. //
  8. // throw $e;
  9. }
  10. if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
  1. // this avoids ever passing an empty value to final validation closures
  2. if (!$this->allowEmptyValue && $this->isHandlingPlaceholder() && $this->finalValidationClosures) {
  3. @trigger_error(sprintf('Setting path "%s" to an environment variable is deprecated since Symfony 4.3. Remove "cannotBeEmpty()", "validate()" or include a prefix/suffix value instead.', $this->getPath()), E_USER_DEPRECATED);
  4. // $e = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an environment variable when empty values are not allowed by definition and are validated.', $this->getPath(), json_encode($value)));
  5. // if ($hint = $this->getInfo()) {
  6. // $e->addHint($hint);

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  7. // }
  8. // $e->setPath($this->getPath());
  9. //
  10. // throw $e;
  11. }
  1. {
  2. // deny environment variables only when using custom validators
  3. // this avoids ever passing an empty value to final validation closures
  4. if (!$this->allowEmptyValue && $this->isHandlingPlaceholder() && $this->finalValidationClosures) {
  5. @trigger_error(sprintf('Setting path "%s" to an environment variable is deprecated since Symfony 4.3. Remove "cannotBeEmpty()", "validate()" or include a prefix/suffix value instead.', $this->getPath()), E_USER_DEPRECATED);
  6. // $e = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an environment variable when empty values are not allowed by definition and are validated.', $this->getPath(), json_encode($value)));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  7. // if ($hint = $this->getInfo()) {
  8. // $e->addHint($hint);
  9. // }
  10. // $e->setPath($this->getPath());
  11. //
  1. $this->setSession($session = $session());
  2. }
  3. if (null === $session) {
  4. @trigger_error(sprintf('Calling "%s()" when no session has been set is deprecated since Symfony 4.1 and will throw an exception in 5.0. Use "hasSession()" instead.', __METHOD__), E_USER_DEPRECATED);
  5. // throw new \BadMethodCallException('Session has not been set');

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Florent Mata
  6. }
  7. return $session;
  8. }
  1. public $message = 'This value is not a valid country.';
  2. public function __construct($options = null)
  3. {
  4. if (!class_exists(Countries::class)) {
  5. // throw new LogicException('The Intl component is required to use the Country constraint. Try running "composer require symfony/intl".');

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Fabien Potencier
  6. @trigger_error(sprintf('Using the "%s" constraint without the "symfony/intl" component installed is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
  7. }
  8. parent::__construct($options);
  9. }
  1. if (!\is_string($default)) {
  2. @trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
  3. }
  4. $this->parameters[$name] = (string) $default;
  5. } elseif (null !== $default && !is_scalar($default)) { // !is_string in 5.0
  6. //throw new RuntimeException(sprintf('The default value of env parameter "%s" must be a string or null, %s given.', $env, \gettype($default)));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  7. throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, \gettype($default)));
  8. } elseif (is_scalar($default) && !\is_string($default)) {
  9. @trigger_error(sprintf('A non-string default value of env parameter "%s" is deprecated since 4.3, cast it to string instead.', $env), E_USER_DEPRECATED);
  10. }
  11. }
  1. if ($this->has($name)) {
  2. $defaultValue = parent::get($name);
  3. if (null !== $defaultValue && !is_scalar($defaultValue)) { // !is_string in 5.0
  4. //throw new RuntimeException(sprintf('The default value of an env() parameter must be a string or null, but "%s" given to "%s".', \gettype($defaultValue), $name));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  5. throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', \gettype($defaultValue), $name));
  6. } elseif (is_scalar($defaultValue) && !\is_string($defaultValue)) {
  7. @trigger_error(sprintf('A non-string default value of an env() parameter is deprecated since 4.3, cast "%s" to string instead.', $name), E_USER_DEPRECATED);
  8. }
  9. }
  1. $resolver->setAllowedTypes('input_format', 'string');
  2. $resolver->setDeprecated('html5', function (Options $options, $html5) {
  3. if ($html5 && 'single_text' === $options['widget'] && self::HTML5_FORMAT !== $options['format']) {
  4. return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
  5. //throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Christian Flothmann
  6. }
  7. return '';
  8. });
  9. }
  1. }
  2. if ($controller instanceof AbstractController) {
  3. if (null === $previousContainer = $controller->setContainer($this->container)) {
  4. @trigger_error(sprintf('Auto-injection of the container for "%s" is deprecated since Symfony 4.2. Configure it as a service instead.', $class), E_USER_DEPRECATED);
  5. // To be uncommented on Symfony 5:
  6. //throw new \LogicException(sprintf('"%s" has no container set, did you forget to define it as a service subscriber?', $class));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Nicolas Grekas
  7. } else {
  8. $controller->setContainer($previousContainer);
  9. }
  10. }
  1. public $values = [];
  2. public function __construct($options = null)
  3. {
  4. if (!class_exists(ExpressionLanguage::class)) {
  5. // throw new LogicException(sprintf('The "symfony/expression-language" component is required to use the "%s" constraint.', __CLASS__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  6. @trigger_error(sprintf('Using the "%s" constraint without the "symfony/expression-language" component installed is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
  7. }
  8. parent::__construct($options);
  9. }
  1. // @deprecated since Symfony 4.2, will throw in 5.0
  2. if (class_exists(Countries::class)) {
  3. $validCountryCode = Countries::exists(substr($canonicalize, 4, 2));
  4. } else {
  5. $validCountryCode = ctype_alpha(substr($canonicalize, 4, 2));
  6. // throw new LogicException('The Intl component is required to use the Bic constraint. Try running "composer require symfony/intl".');

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Fabien Potencier
  7. }
  8. if (!$validCountryCode) {
  9. $this->context->buildViolation($constraint->message)
  10. ->setParameter('{{ value }}', $this->formatValue($value))
  1. $resolver->setAllowedTypes('input_format', 'string');
  2. $resolver->setDeprecated('date_format', function (Options $options, $dateFormat) {
  3. if (null !== $dateFormat && 'single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
  4. return sprintf('Using the "date_format" option of %s with an HTML5 date widget is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
  5. //throw new LogicException(sprintf('Cannot use the "date_format" option of the %s with an HTML5 date.', self::class));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Christian Flothmann
  6. }
  7. return '';
  8. });
  9. $resolver->setDeprecated('date_widget', function (Options $options, $dateWidget) {
  1. return '';
  2. });
  3. $resolver->setDeprecated('html5', function (Options $options, $html5) {
  4. if ($html5 && self::HTML5_FORMAT !== $options['format']) {
  5. return sprintf('Using a custom format when the "html5" option of %s is enabled is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
  6. //throw new LogicException(sprintf('Cannot use the "format" option of %s when the "html5" option is disabled.', self::class));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Christian Flothmann
  7. }
  8. return '';
  9. });
  10. }
  1. return '';
  2. });
  3. $resolver->setDeprecated('time_widget', function (Options $options, $timeWidget) {
  4. if (null !== $timeWidget && 'single_text' === $options['widget']) {
  5. return sprintf('Using the "time_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
  6. //throw new LogicException(sprintf('Cannot use the "time_widget" option of the %s when the "widget" option is set to "single_text".', self::class));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Christian Flothmann
  7. }
  8. return '';
  9. });
  10. $resolver->setDeprecated('html5', function (Options $options, $html5) {
  1. return '';
  2. });
  3. $resolver->setDeprecated('date_widget', function (Options $options, $dateWidget) {
  4. if (null !== $dateWidget && 'single_text' === $options['widget']) {
  5. return sprintf('Using the "date_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
  6. //throw new LogicException(sprintf('Cannot use the "date_widget" option of the %s when the "widget" option is set to "single_text".', self::class));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Christian Flothmann
  7. }
  8. return '';
  9. });
  10. $resolver->setDeprecated('time_widget', function (Options $options, $timeWidget) {
  1. return null;
  2. }
  3. if (!$class->implementsInterface(ConfigurationInterface::class)) {
  4. @trigger_error(sprintf('Not implementing "%s" in the extension configuration class "%s" is deprecated since Symfony 4.1.', ConfigurationInterface::class, $class->getName()), E_USER_DEPRECATED);
  5. //throw new LogicException(sprintf('The extension configuration class "%s" must implement "%s".', $class->getName(), ConfigurationInterface::class));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Roland Franssen
  6. return null;
  7. }
  8. if (!($constructor = $class->getConstructor()) || !$constructor->getNumberOfRequiredParameters()) {
  1. */
  2. public function getResponse()
  3. {
  4. if (null === $this->response) {
  5. @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
  6. // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Chris Tanaskoski
  7. }
  8. return $this->response;
  9. }
  1. */
  2. public function getInternalRequest()
  3. {
  4. if (null === $this->internalRequest) {
  5. @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
  6. // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Chris Tanaskoski
  7. }
  8. return $this->internalRequest;
  9. }
  1. */
  2. public function getRequest()
  3. {
  4. if (null === $this->request) {
  5. @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
  6. // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Chris Tanaskoski
  7. }
  8. return $this->request;
  9. }
  1. */
  2. public function getInternalResponse()
  3. {
  4. if (null === $this->internalResponse) {
  5. @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
  6. // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Chris Tanaskoski
  7. }
  8. return $this->internalResponse;
  9. }
  1. */
  2. public function getCrawler()
  3. {
  4. if (null === $this->crawler) {
  5. @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
  6. // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Chris Tanaskoski
  7. }
  8. return $this->crawler;
  9. }
  1. if ($idReader && !$idReader->isSingleId()) {
  2. @trigger_error(sprintf('Passing an instance of "%s" to "%s" with an entity class "%s" that has a composite id is deprecated since Symfony 4.3 and will throw an exception in 5.0.', IdReader::class, __CLASS__, $class), E_USER_DEPRECATED);
  3. // In Symfony 5.0
  4. // throw new \InvalidArgumentException(sprintf('The second argument `$idReader` of "%s" must be null when the query cannot be optimized because of composite id fields.', __METHOD__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Jules Pietri
  5. }
  6. if ((5 > \func_num_args() || false !== func_get_arg(4)) && null === $idReader) {
  7. $idReader = new IdReader($manager, $classMetadata);
  1. public $message = 'This value is not a valid currency.';
  2. public function __construct($options = null)
  3. {
  4. if (!class_exists(Currencies::class)) {
  5. // throw new LogicException('The Intl component is required to use the Currency constraint. Try running "composer require symfony/intl".');

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Fabien Potencier
  6. @trigger_error(sprintf('Using the "%s" constraint without the "symfony/intl" component installed is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
  7. }
  8. parent::__construct($options);
  9. }
  1. }
  2. parent::__construct($options);
  3. if ((self::VALIDATION_MODE_STRICT === $this->mode || true === $this->strict) && !class_exists(StrictEmailValidator::class)) {
  4. // throw new LogicException(sprintf('The "egulias/email-validator" component is required to use the "%s" constraint in strict mode.', __CLASS__));

    Commented out code reduces readability and lowers the code confidence for other developers. If it's common usage for debug, it should not be committed. Using a version control system, such code can be safely removed.

    Time to fix: about 30 minutes
    Permalink
    Last edited by Remon van de Kamp
  5. @trigger_error(sprintf('Using the "%s"