Database queries should use parameter binding 2

  • Critical
  • Security

More information: https://insight.sensiolabs.com/what-we-analyse/doctrine.database_query_contains_string_and_variable_concatenation

  1. $end = time();
  2. }
  3. list($criteria, $args) = $this->buildCriteria($ip, $url, $start, $end, $limit, $method);
  4. $criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : '';

    If provided by the user, the value of implode(' AND ', $criteria) may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Jan Schumann
  5. $db = $this->initDb();
  6. $tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent, status_code FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((int) $limit), $args);
  7. $this->close($db);
  1. list($criteria, $args) = $this->buildCriteria($ip, $url, $start, $end, $limit, $method);
  2. $criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : '';
  3. $db = $this->initDb();
  4. $tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent, status_code FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((int) $limit), $args);

    If provided by the user, the value of $criteria may allow an SQL injection attack. Avoid concatenating parameters to SQL query strings, and use parameter binding instead.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Alexander Schwenn
  5. $this->close($db);
  6. return $tokens;
  7. }

Global variable or function should never be used 4

  • Major
  • Architecture

More information: https://insight.sensiolabs.com/what-we-analyse/php.use_global_variable_or_function

  1. *
  2. * @return bool Whether the error code indicates an error
  3. *
  4. * @see IntlGlobals::isFailure()
  5. */
  6. function intl_is_failure($errorCode)

    intl_is_failure() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. {
  8. return IntlGlobals::isFailure($errorCode);
  9. }
  10. /**
  1. * @return bool the error code of the last intl function call or
  2. * IntlGlobals::U_ZERO_ERROR if no error occurred
  3. *
  4. * @see IntlGlobals::getErrorCode()
  5. */
  6. function intl_get_error_code()

    intl_get_error_code() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. {
  8. return IntlGlobals::getErrorCode();
  9. }
  10. /**
  1. * @return bool the error message of the last intl function call or
  2. * "U_ZERO_ERROR" if no error occurred
  3. *
  4. * @see IntlGlobals::getErrorMessage()
  5. */
  6. function intl_get_error_message()

    intl_get_error_message() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. {
  8. return IntlGlobals::getErrorMessage();
  9. }
  10. /**
  1. *
  2. * @return string The name of the error code constant
  3. *
  4. * @see IntlGlobals::getErrorName()
  5. */
  6. function intl_error_name($errorCode)

    intl_error_name() adds to the global scope. Prefer class properties or methods to let other developers know what this relates to.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. {
  8. return IntlGlobals::getErrorName($errorCode);
  9. }
  10. }

PHP configuration should not be changed dynamically 10

  • Major
  • Bugrisk

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

  1. $e = null;
  2. $meta = false;
  3. $time = filemtime($this->file);
  4. $signalingException = new \UnexpectedValueException();
  5. $prevUnserializeHandler = ini_set('unserialize_callback_func', '');

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. $prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context) use (&$prevErrorHandler, $signalingException) {
  7. if (E_WARNING === $type && 'Class __PHP_Incomplete_Class has no unserializer' === $msg) {
  8. throw $signalingException;
  9. }
  1. $meta = unserialize(file_get_contents($metadata));
  2. } catch (\Error $e) {
  3. } catch (\Exception $e) {
  4. }
  5. restore_error_handler();
  6. ini_set('unserialize_callback_func', $prevUnserializeHandler);

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. if (null !== $e && $e !== $signalingException) {
  8. throw $e;
  9. }
  10. if (false === $meta) {
  11. return false;
  1. } else {
  2. error_reporting(-1);
  3. }
  4. if ('cli' !== PHP_SAPI) {
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. ExceptionHandler::register();
  7. } elseif ($displayErrors && (!ini_get('log_errors') || 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. if ('cli' !== PHP_SAPI) {
  2. ini_set('display_errors', 0);
  3. ExceptionHandler::register();
  4. } elseif ($displayErrors && (!ini_get('log_errors') || 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
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. }
  8. $handler = ErrorHandler::register();
  9. if (!$displayErrors) {
  10. $handler->throwAt(0, true);
  11. }
  1. private static $displayErrors = null;
  2. public function __construct()
  3. {
  4. if (null === self::$displayErrors) {
  5. self::$displayErrors = ini_set('display_errors', 1);

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. }
  8. public function __destruct()
  9. {
  1. }
  2. public function __destruct()
  3. {
  4. if (null !== self::$displayErrors) {
  5. ini_set('display_errors', self::$displayErrors);

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. self::$displayErrors = null;
  7. }
  8. }
  9. }
  1. if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
  2. throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
  3. }
  4. ini_set('session.save_path', $savePath);

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Drak
  5. ini_set('session.save_handler', 'files');
  6. }
  7. }
  1. if ($baseDir && !is_dir($baseDir) && !@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
  2. throw new \RuntimeException(sprintf('Session Storage was not able to create directory "%s"', $baseDir));
  3. }
  4. ini_set('session.save_path', $savePath);
  5. ini_set('session.save_handler', 'files');

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Drak
  6. }
  7. }
  1. if (headers_sent()) {
  2. return false;
  3. }
  4. if (null !== $lifetime) {
  5. ini_set('session.cookie_lifetime', $lifetime);

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Drak
  6. }
  7. if ($destroy) {
  8. $this->metadataBag->stampNew();
  9. }
  1. 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
  2. ));
  3. foreach ($options as $key => $value) {
  4. if (isset($validOptions[$key])) {
  5. ini_set('session.'.$key, $value);

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

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Drak
  6. }
  7. }
  8. }
  9. /**

exit() and die() functions should be avoided 8

  • Major
  • Bugrisk

More information: https://insight.sensiolabs.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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. }
  8. /**
  9. * Configures the error handler for delayed handling.
  1. <?php
  2. if (3 > $_SERVER['argc']) {
  3. echo "Usage: branch dir1 dir2 ... dirN\n";
  4. exit(1);

    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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. }
  6. chdir(dirname(__DIR__));
  7. $dirs = $_SERVER['argv'];
  8. array_shift($dirs);
  1. $flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
  2. foreach ($dirs as $k => $dir) {
  3. if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {
  4. if ($exitStatus) {
  5. exit($exitStatus);

    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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. unset($dirs[$k]);
  8. continue;
  9. }
  10. echo "$dir\n";
  1. echo "$dir\n";
  2. $json = ltrim(file_get_contents($dir.'/composer.json'));
  3. if (null === $package = json_decode($json)) {
  4. passthru("composer validate $dir/composer.json");
  5. exit(1);

    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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. $package->repositories = array(array(
  8. 'type' => 'composer',
  9. 'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
  1. }
  2. passthru("cd $dir && tar -cf package.tar --exclude='package.tar' *");
  3. if (!isset($package->extra->{'branch-alias'}->{'dev-master'})) {
  4. echo "Missing \"dev-master\" branch-alias in composer.json extra.\n";
  5. exit(1);

    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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. $package->version = str_replace('-dev', '.x-dev', $package->extra->{'branch-alias'}->{'dev-master'});
  8. $package->dist['type'] = 'tar';
  9. $package->dist['url'] = 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__))."/$dir/package.tar";
  1. if ($dirs) {
  2. $json = ltrim(file_get_contents('composer.json'));
  3. if (null === $package = json_decode($json)) {
  4. passthru("composer validate $dir/composer.json");
  5. exit(1);

    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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. $package->repositories = array(array(
  8. 'type' => 'composer',
  9. 'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/',
  1. if (!empty($notices)) {
  2. echo "\n";
  3. }
  4. if ('weak' !== $mode && ($deprecations['unsilenced'] || $deprecations['remaining'] || $deprecations['other'])) {
  5. exit(1);

    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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. });
  8. }
  9. }
  1. if ($this->autoExit) {
  2. if ($exitCode > 255) {
  3. $exitCode = 255;
  4. }
  5. 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
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. }
  7. return $exitCode;
  8. }

PHP 7 reserved words should not be used as class, interfaces or traits names 3

  • Major
  • Bugrisk

More information: https://insight.sensiolabs.com/what-we-analyse/php.php7_reserved_words

  1. *
  2. * @author Bernhard Schussek <bschussek@gmail.com>
  3. *
  4. * @deprecated since version 2.7, to be removed in 3.0. Use IsFalse instead.
  5. */
  6. class False extends IsFalse

    This name is a reserved word since PHP 7 and should not be used as class, interface or trait name.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. {
  8. }
  1. *
  2. * @author Bernhard Schussek <bschussek@gmail.com>
  3. *
  4. * @deprecated since version 2.7, to be removed in 3.0. Use IsNull instead.
  5. */
  6. class Null extends IsNull

    This name is a reserved word since PHP 7 and should not be used as class, interface or trait name.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. {
  8. }
  1. *
  2. * @author Bernhard Schussek <bschussek@gmail.com>
  3. *
  4. * @deprecated since version 2.7, to be removed in 3.0. Use IsTrue instead.
  5. */
  6. class True extends IsTrue

    This name is a reserved word since PHP 7 and should not be used as class, interface or trait name.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. {
  8. }

Source code should not contain FIXME comments 7

  • Major
  • Bugrisk

More information: https://insight.sensiolabs.com/what-we-analyse/task_fixme_comment

  1. protected function describeRoute(Route $route, array $options = array())
  2. {
  3. $requirements = $route->getRequirements();
  4. unset($requirements['_scheme'], $requirements['_method']);
  5. // fixme: values were originally written as raw

    FIXME comments are left in the code when a bug has been noticed but not fixed. You should fix the bug and remove the comment.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Jean-François Simon
  6. $description = array(
  7. '<comment>Path</comment> '.$route->getPath(),
  8. '<comment>Path Regex</comment> '.$route->compile()->getRegex(),
  9. '<comment>Host</comment> '.('' !== $route->getHost() ? $route->getHost() : 'ANY'),
  10. '<comment>Host Regex</comment> '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : ''),
  1. /**
  2. * {@inheritdoc}
  3. */
  4. public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
  5. {
  6. // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism

    FIXME comments are left in the code when a bug has been noticed but not fixed. You should fix the bug and remove the comment.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by pborreli
  7. if (HttpKernelInterface::MASTER_REQUEST === $type) {
  8. $this->traces = array();
  9. $this->request = $request;
  10. if (null !== $this->surrogate) {
  11. $this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy();
  1. Request::setTrustedProxies($trustedProxies);
  2. }
  3. // always a "master" request (as the real master request can be in cache)
  4. $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch);
  5. // FIXME: we probably need to also catch exceptions if raw === true

    FIXME comments are left in the code when a bug has been noticed but not fixed. You should fix the bug and remove the comment.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC
  7. if (null !== $entry && in_array($response->getStatusCode(), array(500, 502, 503, 504))) {
  8. if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) {
  9. $age = $this->options['stale_if_error'];
  1. // check if this ACL has already been hydrated
  2. if (!$aclFound && isset($this->loadedAcls[$oid->getType()][$oid->getIdentifier()])) {
  3. $acl = $this->loadedAcls[$oid->getType()][$oid->getIdentifier()];
  4. if (!$acl->isSidLoaded($sids)) {
  5. // FIXME: we need to load ACEs for the missing SIDs. This is never

    FIXME comments are left in the code when a bug has been noticed but not fixed. You should fix the bug and remove the comment.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Johannes Schmitt
  6. // reached by the default implementation, since we do not
  7. // filter by SID
  8. throw new \RuntimeException('This is not supported by the default implementation.');
  9. } else {
  10. $result->attach($oid, $acl);
  1. *
  2. * @return string
  3. */
  4. protected function getLookupSql(array $ancestorIds)
  5. {
  6. // FIXME: add support for filtering by sids (right now we select all sids)

    FIXME comments are left in the code when a bug has been noticed but not fixed. You should fix the bug and remove the comment.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Johannes Schmitt
  7. $sql = <<<SELECTCLAUSE
  8. SELECT
  9. o.id as acl_id,
  10. o.object_identifier,
  1. {
  2. $sql = $this->getAncestorLookupSql($batch);
  3. $ancestorIds = array();
  4. foreach ($this->connection->executeQuery($sql)->fetchAll() as $data) {
  5. // FIXME: skip ancestors which are cached

    FIXME comments are left in the code when a bug has been noticed but not fixed. You should fix the bug and remove the comment.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Johannes Schmitt
  6. // Fix: Oracle returns keys in uppercase
  7. $ancestorIds[] = reset($data);
  8. }
  9. return $ancestorIds;
  1. $this->propertyChanges->offsetSet($acl, array());
  2. if (null !== $this->cache) {
  3. if (count($sharedPropertyChanges) > 0) {
  4. // FIXME: Currently, there is no easy way to clear the cache for ACLs

    FIXME comments are left in the code when a bug has been noticed but not fixed. You should fix the bug and remove the comment.

    Time to fix: about 2 hours
    Open Issue Permalink
    Last edited by Johannes Schmitt
  5. // of a certain type. The problem here is that we need to make
  6. // sure to clear the cache of all child ACLs as well, and these
  7. // child ACLs might be of a different class type.
  8. $this->cache->clearCache();
  9. } else {

Code should not be duplicated 10

  • Minor
  • Architecture

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

  1. if (!$event->isMasterRequest()) {
  2. return;
  3. }
  4. if (!preg_match('{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}', $event->getRequest()->headers->get('User-Agent'))) {
  5. $this->sendHeaders = false;

    The next 35 lines appear both in src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php:42 and src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php:43.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Christophe Coevoet
  6. $this->headers = array();
  7. return;
  8. }
  1. $twig->setLoader($realLoader);
  2. return array('template' => $template, 'file' => $file, 'valid' => false, 'exception' => $e);
  3. }
  4. return array('template' => $template, 'file' => $file, 'valid' => true);

    The next 24 lines appear both in src/Symfony/Bridge/Twig/Command/LintCommand.php:157 and src/Symfony/Bundle/FrameworkBundle/Command/YamlLintCommand.php:114.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Grégoire Pineau
  5. }
  6. private function display(InputInterface $input, OutputInterface $output, $files)
  7. {
  8. switch ($input->getOption('format')) {
  1. $flags = ENT_QUOTES | ENT_SUBSTITUTE;
  2. } else {
  3. $flags = ENT_QUOTES;
  4. }
  5. return sprintf('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);

    The next 57 lines appear both in src/Symfony/Bridge/Twig/Extension/CodeExtension.php:184 and src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php:172.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Christian Flothmann
  6. }
  7. return $text;
  8. }
  1. if (false === $ret) {
  2. throw new \RuntimeException('Aborted');
  3. }
  4. $ret = trim($ret);
  5. } else {
  6. $ret = '';

    The next 96 lines appear both in src/Symfony/Component/Console/Helper/DialogHelper.php:135 and src/Symfony/Component/Console/Helper/QuestionHelper.php:199.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Lee McDermott
  7. $i = 0;
  8. $ofs = -1;
  9. $matches = $autocomplete;
  10. $numMatches = count($matches);
  1. // Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML()
  2. if (function_exists('mb_convert_encoding')) {
  3. $content = mb_convert_encoding($content, 'HTML-ENTITIES', $charset);
  4. } elseif (function_exists('iconv')) {
  5. $content = preg_replace_callback(

    The next 20 lines appear both in src/Symfony/Component/DomCrawler/Crawler.php:162 and src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php:433.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. '/[\x80-\xFF]+/',
  7. function ($m) {
  8. $m = unpack('C*', $m[0]);
  9. $i = 1;
  10. $entities = '';
  1. if ('content="ESI/1.0"' == $value) {
  2. $response->headers->remove('Surrogate-Control');
  3. } elseif (preg_match('#,\s*content="ESI/1.0"#', $value)) {
  4. $response->headers->set('Surrogate-Control', preg_replace('#,\s*content="ESI/1.0"#', '', $value));
  5. } elseif (preg_match('#content="ESI/1.0",\s*#', $value)) {
  6. $response->headers->set('Surrogate-Control', preg_replace('#content="ESI/1.0",\s*#', '', $value));

    The next 27 lines appear both in src/Symfony/Component/HttpKernel/HttpCache/Esi.php:242 and src/Symfony/Component/HttpKernel/HttpCache/Ssi.php:162.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. }
  8. }
  9. }
  10. /**
  1. $indexContent = $this->getValue($indexName);
  2. if (!$indexContent) {
  3. return array();
  4. }
  5. $profileList = explode("\n", $indexContent);

    The next 31 lines appear both in src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php:50 and src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php:60.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andrej Hudec
  6. $result = array();
  7. foreach ($profileList as $item) {
  8. if (0 === $limit) {
  9. break;
  1. return false;
  2. }
  3. $profile = $this->getValue($this->getItemName($token));
  4. if (false !== $profile) {

    The next 26 lines appear both in src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php:143 and src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php:149.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andrej Hudec
  5. $profile = $this->createProfileFromData($token, $profile);
  6. }
  7. return $profile;
  8. }
  1. *
  2. * @return bool
  3. */
  4. abstract protected function appendValue($key, $value, $expiration = 0);
  5. private function createProfileFromData($token, $data, $parent = null)

    The next 23 lines appear both in src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php:232 and src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php:247.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Andrej Hudec
  6. {
  7. $profile = new Profile($token);
  8. $profile->setIp($data['ip']);
  9. $profile->setMethod($data['method']);
  10. $profile->setUrl($data['url']);
  1. }
  2. /**
  3. * {@inheritdoc}
  4. */
  5. protected function requiresAuthentication(Request $request)

    The next 35 lines appear both in src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php:88 and src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php:65.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Jordi Boggiano
  6. {
  7. if ($this->options['post_only'] && !$request->isMethod('POST')) {
  8. return false;
  9. }

Source code should not contain TODO comments 12

  • Minor
  • Architecture

More information: https://insight.sensiolabs.com/what-we-analyse/task_todo_comment

  1. list($req, $headers) = $match;
  2. if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) {
  3. return $this->restoreResponse($headers, $body);
  4. }
  5. // TODO the metaStore referenced an entity that doesn't exist in

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Pascal Borreli
  6. // the entityStore. We definitely want to return nil but we should
  7. // also purge the entry from the meta-store when this is detected.
  8. }
  9. /**
  1. $conditions[] = sprintf('(%s) mod %d = 0', $expr, $a);
  2. }
  3. return $xpath->addCondition(implode(' and ', $conditions));
  4. // todo: handle an+b, odd, even

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Jean-François Simon
  5. // an+b means every-a, plus b, e.g., 2n+1 means odd
  6. // 0n+b means b
  7. // n+0 means a=1, i.e., all elements
  8. // an means every a elements, i.e., 2n means even
  9. // -n means -1n
  1. ." or name(.) = 'select'"
  2. ." or name(.) = 'textarea'"
  3. .')'
  4. .' and ancestor::fieldset[@disabled]'
  5. );
  6. // todo: in the second half, add "and is not a descendant of that fieldset element's first legend element child, if any."

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Jean-François Simon
  7. }
  8. /**
  9. * @return XPathExpr
  10. */
  1. $id = strtolower($id);
  2. if ('service_container' === $id) {
  3. // BC: 'service_container' is no longer a self-reference but always
  4. // $this, so ignore this call.
  5. // @todo Throw InvalidArgumentException in next major release.

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by sun
  6. return;
  7. }
  8. if (self::SCOPE_CONTAINER !== $scope) {
  9. if (!isset($this->scopedServices[$scope])) {
  10. throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id));
  1. $id = $this->aliases[$id];
  2. }
  3. if ('service_container' === $id) {
  4. // BC: 'service_container' was a synthetic service previously.
  5. // @todo Change to false in next major release.

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by sun
  6. return true;
  7. }
  8. return isset($this->services[$id]) || array_key_exists($id, $this->services);
  9. }
  1. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  2. {
  3. foreach ($contains as $contain) {
  4. $expr = Expression::create($contain);
  5. // todo: avoid forking process for each $pattern by using multiple -e options

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Manuele Menozzi
  6. $command
  7. ->add('| grep -v \'^$\'')
  8. ->add('| xargs -I{} grep -I')
  9. ->add($expr->isCaseSensitive() ? null : '-i')
  10. ->add($not ? '-L' : '-l')
  1. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  2. {
  3. foreach ($contains as $contain) {
  4. $expr = Expression::create($contain);
  5. // todo: avoid forking process for each $pattern by using multiple -e options

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Manuele Menozzi
  6. $command
  7. ->add('| xargs -I{} -r grep -I')
  8. ->add($expr->isCaseSensitive() ? null : '-i')
  9. ->add($not ? '-L' : '-l')
  10. ->add('-Ee')->arg($expr->renderPattern())
  1. {
  2. if (!function_exists('exec')) {
  3. return false;
  4. }
  5. // todo: find a better way (command could not be available)

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Gordon Franke
  6. $testCommand = 'which ';
  7. if (self::TYPE_WINDOWS === $this->type) {
  8. $testCommand = 'where ';
  9. }
  1. *
  2. * @return \PDOStatement The statement that needs to be executed later to release the lock
  3. *
  4. * @throws \DomainException When an unsupported PDO driver is used
  5. *
  6. * @todo implement missing advisory locks

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Tobias Schultze
  7. * - for oci using DBMS_LOCK.REQUEST
  8. * - for sqlsrv using sp_getapplock with LockOwner = Session
  9. */
  10. private function doAdvisoryLock($sessionId)
  11. {
  1. if (null === $timeZoneId) {
  2. // In PHP 5.5 if $timeZoneId is null it fallbacks to `date_default_timezone_get()` method
  3. if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
  4. $timeZoneId = date_default_timezone_get();
  5. } else {
  6. // TODO: changes were made to ext/intl in PHP 5.4.4 release that need to be investigated since it will

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. // use ini's date.timezone when the time zone is not provided. As a not well tested workaround, uses UTC.
  8. // See the first two items of the commit message for more information:
  9. // https://github.com/php/php-src/commit/eb346ef0f419b90739aadfb6cc7b7436c5b521d9
  10. $timeZoneId = getenv('TZ') ?: 'UTC';
  11. }
  1. if (!$rootNode && XML_PI_NODE !== $child->nodeType) {
  2. $rootNode = $child;
  3. }
  4. }
  5. // todo: throw an exception if the root node name is not correctly configured (bc)

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Charles Sarrazin
  6. if ($rootNode->hasChildNodes()) {
  7. $xpath = new \DOMXPath($dom);
  8. $data = array();
  9. foreach ($xpath->query('namespace::*', $dom->documentElement) as $nsNode) {
  1. $flags = array();
  2. } elseif ('#,' === substr($line, 0, 2)) {
  3. $flags = array_map('trim', explode(',', substr($line, 2)));
  4. } elseif ('msgid "' === substr($line, 0, 7)) {
  5. // We start a new msg so save previous
  6. // TODO: this fails when comments or contexts are added

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Clemens Tolboom
  7. $this->addMessage($messages, $item);
  8. $item = $defaults;
  9. $item['ids']['singular'] = substr($line, 7, -1);
  10. } elseif ('msgstr "' === substr($line, 0, 8)) {
  11. $item['translated'] = substr($line, 8, -1);

Source code should not contain XXX comments

  • Minor
  • Architecture

More information: https://insight.sensiolabs.com/what-we-analyse/task_xxx_comment

  1. // In some circumstances PHP_AUTH_DIGEST needs to be set
  2. $headers['PHP_AUTH_DIGEST'] = $authorizationHeader;
  3. $this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader;
  4. } elseif (0 === stripos($authorizationHeader, 'bearer ')) {
  5. /*
  6. * XXX: Since there is no PHP_AUTH_BEARER in PHP predefined variables,

    XXX comments are left in the code when a piece of code needs refactoring. You should improve the implementation and remove the comment.

    Time to fix: about 1 day
    Open Issue Permalink
    Last edited by Lance Chen
  7. * I'll just set $headers['AUTHORIZATION'] here.
  8. * http://php.net/manual/en/reserved.variables.server.php
  9. */
  10. $headers['AUTHORIZATION'] = $authorizationHeader;
  11. }

Error silenced by the at sign (@) 33

  • Minor
  • Bugrisk

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

  1. // discard chmod failure (some filesystem may not support it)
  2. }
  3. }
  4. if (\function_exists('opcache_invalidate') && ini_get('opcache.enable')) {
  5. @opcache_invalidate($this->file, true);

    Adding "@" before opcache_invalidate($this->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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. }
  8. /**
  9. * Gets the meta file path.
  1. }
  2. restore_error_handler();
  3. if ('' !== trim($content)) {
  4. @$dom->loadHTML($content);

    Adding "@" before $dom->loadHTML($content) 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
    Open Issue Permalink
    Last edited by Romain Neutron
  5. }
  6. libxml_use_internal_errors($internalErrors);
  7. libxml_disable_entity_loader($disableEntities);
  1. $dom = new \DOMDocument('1.0', $charset);
  2. $dom->validateOnParse = true;
  3. if ('' !== trim($content)) {
  4. @$dom->loadXML($content, $options);

    Adding "@" before $dom->loadXML($content, $options) 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
    Open Issue Permalink
    Last edited by Fabien Potencier
  5. }
  6. libxml_use_internal_errors($internalErrors);
  7. libxml_disable_entity_loader($disableEntities);
  1. if ('globals' === $type) {
  2. if (is_object($meta)) {
  3. return ' = object('.get_class($meta).')';
  4. }
  5. return ' = '.substr(@json_encode($meta), 0, 50);

    Adding "@" before json_encode($meta) 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
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. }
  7. if ('functions' === $type) {
  8. return '('.implode(', ', $meta).')';
  9. }
  1. </xsd:schema>
  2. EOF
  3. ;
  4. $disableEntities = libxml_disable_entity_loader(false);
  5. $valid = @$dom->schemaValidateSource($source);

    Adding "@" before $dom->schemaValidateSource($source) 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
    Open Issue Permalink
    Last edited by Anthon Pang
  6. libxml_disable_entity_loader($disableEntities);
  7. foreach ($tmpfiles as $tmpfile) {
  8. @unlink($tmpfile);
  9. }
  1. $paths = array_unique($paths);
  2. $filepaths = array();
  3. foreach ($paths as $path) {
  4. if (@file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) {

    Adding "@" before file_exists($file = $path . DIRECTORY_SEPARATOR . $name) 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
    Open Issue Permalink
    Last edited by Tristan Darricau
  5. if (true === $first) {
  6. return $file;
  7. }
  8. $filepaths[] = $file;
  9. }
  1. {
  2. if (!extension_loaded('dom')) {
  3. throw new \RuntimeException('Extension DOM is required.');
  4. }
  5. $content = @file_get_contents($file);

    Adding "@" before file_get_contents($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
    Open Issue Permalink
    Last edited by Romain Neutron
  6. if ('' === trim($content)) {
  7. throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file));
  8. }
  9. $internalErrors = libxml_use_internal_errors(true);
  1. } catch (\Exception $e) {
  2. $valid = false;
  3. }
  4. } elseif (!is_array($schemaOrCallable) && is_file((string) $schemaOrCallable)) {
  5. $schemaSource = file_get_contents((string) $schemaOrCallable);
  6. $valid = @$dom->schemaValidateSource($schemaSource);

    Adding "@" before $dom->schemaValidateSource($schemaSource) 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
    Open Issue Permalink
    Last edited by Curtis
  7. } else {
  8. libxml_use_internal_errors($internalErrors);
  9. throw new \InvalidArgumentException('The schemaOrCallable argument has to be a valid path to XSD file or callable.');
  10. }
  1. $this->initialize($input, $output);
  2. if (null !== $this->processTitle) {
  3. if (function_exists('cli_set_process_title')) {
  4. if (false === @cli_set_process_title($this->processTitle)) {

    Adding "@" before cli_set_process_title($this->processTitle) 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
    Open Issue Permalink
    Last edited by Maxime Steinhausser
  5. if ('Darwin' === PHP_OS) {
  6. $output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
  7. } else {
  8. $error = error_get_last();
  9. trigger_error($error['message'], E_USER_WARNING);
  1. // workaround for an HHVM bug, should be removed when https://github.com/facebook/hhvm/issues/7281 is fixed
  2. if ('' === $this->getPath()) {
  3. return $this->rewindable = false;
  4. }
  5. if (false !== $stream = @opendir($this->getPath())) {

    Adding "@" before opendir($this->getPath()) 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
    Open Issue Permalink
    Last edited by alquerci
  6. $infos = stream_get_meta_data($stream);
  7. closedir($stream);
  8. if ($infos['seekable']) {
  9. return $this->rewindable = true;
  1. if (!is_string($data)) {
  2. return;
  3. }
  4. if (null !== $result = @preg_replace('/^[\pZ\p{Cc}]+|[\pZ\p{Cc}]+$/u', '', $data)) {

    Adding "@" before preg_replace('/^[\\pZ\\p{Cc}]+|[\\pZ\\p{Cc}]+$/u', '', $data) 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
    Open Issue Permalink
    Last edited by Yaroslav Kiliba
  5. $event->setData($result);
  6. } else {
  7. $event->setData(trim($data));
  8. }
  9. }
  1. $cacheKey = $requestIp.'-'.$ip;
  2. if (isset(self::$checkedIps[$cacheKey])) {
  3. return self::$checkedIps[$cacheKey];
  4. }
  5. if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) {

    Adding "@" before inet_pton('::1') 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
    Open Issue Permalink
    Last edited by Victor Berchet
  6. throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".');
  7. }
  8. if (false !== strpos($ip, '/')) {
  9. list($address, $netmask) = explode('/', $ip, 2);
  1. } else {
  2. $address = $ip;
  3. $netmask = 128;
  4. }
  5. $bytesAddr = unpack('n*', @inet_pton($address));

    Adding "@" before inet_pton($address) 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
    Open Issue Permalink
    Last edited by Jakub Zalas
  6. $bytesTest = unpack('n*', @inet_pton($requestIp));
  7. if (!$bytesAddr || !$bytesTest) {
  8. return self::$checkedIps[$cacheKey] = false;
  9. }
  1. $address = $ip;
  2. $netmask = 128;
  3. }
  4. $bytesAddr = unpack('n*', @inet_pton($address));
  5. $bytesTest = unpack('n*', @inet_pton($requestIp));

    Adding "@" before inet_pton($requestIp) 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
    Open Issue Permalink
    Last edited by Jakub Zalas
  6. if (!$bytesAddr || !$bytesTest) {
  7. return self::$checkedIps[$cacheKey] = false;
  8. }
  1. if (!interface_exists('JsonSerializable', false)) {
  2. // PHP 5.3 triggers annoying warnings for some
  3. // types that can't be serialized as JSON (INF, resources, etc.)
  4. // but doesn't provide the JsonSerializable interface.
  5. set_error_handler(function () { return false; });
  6. $data = @json_encode($data, $this->encodingOptions);

    Adding "@" before json_encode($data, $this->encodingOptions) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. restore_error_handler();
  8. } elseif (\PHP_VERSION_ID < 50500) {
  9. // PHP 5.4 and up wrap exceptions thrown by JsonSerializable
  10. // objects in a new exception that needs to be removed.
  11. // Fortunately, PHP 5.5 and up do not trigger any warning anymore.
  1. */
  2. abstract class CacheWarmer implements CacheWarmerInterface
  3. {
  4. protected function writeCacheFile($file, $content)
  5. {
  6. $tmpFile = @tempnam(dirname($file), basename($file));

    Adding "@" before tempnam(dirname($file), basename($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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
  8. @chmod($file, 0666 & ~umask());
  9. return;
  10. }
  1. {
  2. $path = $this->getPath($key);
  3. if (isset($this->locks[$key])) {
  4. $fp = $this->locks[$key];
  5. @ftruncate($fp, 0);

    Adding "@" before ftruncate($fp, 0) 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
    Open Issue Permalink
    Last edited by Matthias Pigulla
  6. @fseek($fp, 0);
  7. $len = @fwrite($fp, $data);
  8. if (strlen($data) !== $len) {
  9. @ftruncate($fp, 0);
  1. $path = $this->getPath($key);
  2. if (isset($this->locks[$key])) {
  3. $fp = $this->locks[$key];
  4. @ftruncate($fp, 0);
  5. @fseek($fp, 0);

    Adding "@" before fseek($fp, 0) 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
    Open Issue Permalink
    Last edited by Matthias Pigulla
  6. $len = @fwrite($fp, $data);
  7. if (strlen($data) !== $len) {
  8. @ftruncate($fp, 0);
  9. return false;
  1. $fp = $this->locks[$key];
  2. @ftruncate($fp, 0);
  3. @fseek($fp, 0);
  4. $len = @fwrite($fp, $data);
  5. if (strlen($data) !== $len) {
  6. @ftruncate($fp, 0);

    Adding "@" before ftruncate($fp, 0) 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
    Open Issue Permalink
    Last edited by Matthias Pigulla
  7. return false;
  8. }
  9. } else {
  10. if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
  1. if (ini_get('open_basedir')) {
  2. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  3. $dirs = array();
  4. foreach ($searchPath as $path) {
  5. // Silencing against https://bugs.php.net/69240
  6. if (@is_dir($path)) {

    Adding "@" before is_dir($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
    Open Issue Permalink
    Last edited by Ben
  7. $dirs[] = $path;
  8. } else {
  9. if (basename($path) == $name && @is_executable($path)) {
  10. return $path;
  11. }
  1. $input = $this->input;
  2. $r = $e = array();
  3. $w = array($this->pipes[0]);
  4. // let's have a look if something changed in streams
  5. if (false === $n = @stream_select($r, $w, $e, 0, 0)) {

    Adding "@" before stream_select($r, $w, $e, 0, 0) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. return;
  7. }
  8. foreach ($w as $stdin) {
  9. if (isset($this->inputBuffer[0])) {
  1. $read = $e = array();
  2. $r = $this->pipes;
  3. unset($r[0]);
  4. // let's have a look if something changed in streams
  5. if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {

    Adding "@" before stream_select($r, $w, $e, 0, $blocking ? \Symfony\Component\Process\Process::TIMEOUT_PRECISION * 1000000.0 : 0) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. // if a system call has been interrupted, forget about it, let's try again
  7. // otherwise, an error occurred, let's reset pipes
  8. if (!$this->hasSystemCallBeenInterrupted()) {
  9. $this->pipes = array();
  10. }
  1. $w = $this->write();
  2. $read = $r = $e = array();
  3. if ($blocking) {
  4. if ($w) {
  5. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);

    Adding "@" before stream_select($r, $w, $e, 0, \Symfony\Component\Process\Process::TIMEOUT_PRECISION * 1000000.0) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. } elseif ($this->fileHandles) {
  7. usleep(Process::TIMEOUT_PRECISION * 1E6);
  8. }
  9. }
  10. foreach ($this->fileHandles as $type => $fileHandle) {
  1. }
  2. if ($tty) {
  3. static $isTtySupported;
  4. if (null === $isTtySupported) {
  5. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);

    Adding "@" before proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. if (!$isTtySupported) {
  8. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  9. }
  1. if ('\\' === DIRECTORY_SEPARATOR) {
  2. return $result = false;
  3. }
  4. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);

    Adding "@" before proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. }
  6. /**
  7. * Creates the descriptors needed by the proc_open.
  8. *
  1. return false;
  2. }
  3. } else {
  4. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  5. $ok = @proc_terminate($this->process, $signal);

    Adding "@" before proc_terminate($this->process, $signal) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. } elseif (function_exists('posix_kill')) {
  7. $ok = @posix_kill($pid, $signal);
  8. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  9. $ok = false === fgets($pipes[2]);
  10. }
  1. }
  2. } else {
  3. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  4. $ok = @proc_terminate($this->process, $signal);
  5. } elseif (function_exists('posix_kill')) {
  6. $ok = @posix_kill($pid, $signal);

    Adding "@" before posix_kill($pid, $signal) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  8. $ok = false === fgets($pipes[2]);
  9. }
  10. if (!$ok) {
  11. if ($throwException) {
  1. $source = file_get_contents(__DIR__.'/schema/dic/xliff-core/xliff-core-1.2-strict.xsd');
  2. $source = str_replace('http://www.w3.org/2001/xml.xsd', $location, $source);
  3. $disableEntities = libxml_disable_entity_loader(false);
  4. if (!@$dom->schemaValidateSource($source)) {

    Adding "@" before $dom->schemaValidateSource($source) 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
    Open Issue Permalink
    Last edited by Fabien Potencier
  5. libxml_disable_entity_loader($disableEntities);
  6. throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: %s', $file, implode("\n", $this->getXmlErrors($internalErrors))));
  7. }
  1. $length = strlen(utf8_decode($stringValue));
  2. } else {
  3. preg_replace('/./u', '', $stringValue, -1, $length);
  4. }
  5. } elseif (function_exists('mb_strlen')) {
  6. if (@mb_check_encoding($stringValue, $constraint->charset)) {

    Adding "@" before mb_check_encoding($stringValue, $constraint->charset) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. $length = mb_strlen($stringValue, $constraint->charset);
  8. } else {
  9. $invalidCharset = true;
  10. }
  11. } elseif (function_exists('iconv_strlen')) {
  1. $length = mb_strlen($stringValue, $constraint->charset);
  2. } else {
  3. $invalidCharset = true;
  4. }
  5. } elseif (function_exists('iconv_strlen')) {
  6. $length = @iconv_strlen($stringValue, $constraint->charset);

    Adding "@" before iconv_strlen($stringValue, $constraint->charset) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. $invalidCharset = false === $length;
  8. } else {
  9. $length = strlen($stringValue);
  10. }
  1. return stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
  2. }
  3. public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
  4. {
  5. return @stream_context_get_params($stream) ?: $a;

    Adding "@" before stream_context_get_params($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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. }
  7. public static function castGd($gd, array $a, Stub $stub, $isNested)
  8. {
  9. $a['size'] = imagesx($gd).'x'.imagesy($gd);
  1. * @return bool Tells if the current output stream supports ANSI colors or not
  2. */
  3. protected function supportsColors()
  4. {
  5. if ($this->outputStream !== static::$defaultOutput) {
  6. return @(is_resource($this->outputStream) && function_exists('posix_isatty') && posix_isatty($this->outputStream));

    Adding "@" before is_resource($this->outputStream) && function_exists('posix_isatty') && posix_isatty($this->outputStream) 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. }
  8. if (null !== static::$defaultColors) {
  9. return static::$defaultColors;
  10. }
  11. if (isset($_SERVER['argv'][1])) {
  1. }
  2. }
  3. }
  4. if ('\\' === DIRECTORY_SEPARATOR) {
  5. static::$defaultColors = @(

    Adding "@" before '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM') 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
    Open Issue Permalink
    Last edited by Michele Locati
  6. '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
  7. || false !== getenv('ANSICON')
  8. || 'ON' === getenv('ConEmuANSI')
  9. || 'xterm' === getenv('TERM')
  10. );

Object parameters should be type hinted 31

  • Minor
  • Bugrisk

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

  1. }
  2. /**
  3. * Renders a caught exception.
  4. */
  5. public function renderException($e, $output)

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. {
  7. $output->writeln('');
  8. do {
  9. $title = sprintf(' [%s] ', get_class($e));
  1. public function write(Profile $profile)
  2. {
  3. $data = array(
  4. 'token' => $profile->getToken(),
  5. 'parent' => $profile->getParentToken(),
  6. 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()),

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrej Hudec
  7. 'data' => $profile->getCollectors(),
  8. 'ip' => $profile->getIp(),
  9. 'method' => $profile->getMethod(),
  10. 'url' => $profile->getUrl(),
  11. 'time' => $profile->getTime(),
  1. // remove the value the filter is applied on
  2. array_shift($args);
  3. }
  4. // format args
  5. $args = array_map(function ($param) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. if ($param->isDefaultValueAvailable()) {
  7. return $param->getName().' = '.json_encode($param->getDefaultValue());
  8. }
  9. return $param->getName();
  1. {
  2. $headers = array('Bundle name', 'Extension alias');
  3. $rows = array();
  4. $bundles = $this->getContainer()->get('kernel')->getBundles();
  5. usort($bundles, function ($bundleA, $bundleB) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. return strcmp($bundleA->getName(), $bundleB->getName());
  7. });
  8. foreach ($bundles as $bundle) {
  9. $extension = $bundle->getContainerExtension();
  1. {
  2. $headers = array('Bundle name', 'Extension alias');
  3. $rows = array();
  4. $bundles = $this->getContainer()->get('kernel')->getBundles();
  5. usort($bundles, function ($bundleA, $bundleB) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. return strcmp($bundleA->getName(), $bundleB->getName());
  7. });
  8. foreach ($bundles as $bundle) {
  9. $extension = $bundle->getContainerExtension();
  1. *
  2. * @return string
  3. */
  4. private function findAlternative($nonExistentBundleName)
  5. {
  6. $bundleNames = array_map(function ($b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Ryan Weaver
  7. return $b->getName();
  8. }, $this->kernel->getBundles());
  9. $alternative = null;
  10. $shortest = null;
  1. *
  2. * @return \ArrayObject The dependencies for the given node
  3. *
  4. * @throws \RuntimeException if a circular dependency is detected
  5. */
  6. private static function resolveDependencies(array $tree, $node, \ArrayObject $resolved = null, \ArrayObject $unresolved = null)

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Victor Berchet
  7. {
  8. if (null === $resolved) {
  9. $resolved = new \ArrayObject();
  10. }
  11. if (null === $unresolved) {
  1. continue;
  2. }
  3. // can it be handled by an extension?
  4. if (!$this->container->hasExtension($node->namespaceURI)) {
  5. $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. throw new InvalidArgumentException(sprintf(
  7. 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
  8. $node->tagName,
  9. $file,
  10. $node->namespaceURI,
  1. if (in_array($namespace, array('imports', 'parameters', 'services'))) {
  2. continue;
  3. }
  4. if (!$this->container->hasExtension($namespace)) {
  5. $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. throw new InvalidArgumentException(sprintf(
  7. 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s',
  8. $namespace,
  9. $file,
  10. $namespace,
  1. public function __construct(\Traversable $iterator, $sort)
  2. {
  3. $this->iterator = $iterator;
  4. if (self::SORT_BY_NAME === $sort) {
  5. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  7. };
  8. } elseif (self::SORT_BY_TYPE === $sort) {
  9. $this->sort = function ($a, $b) {
  10. if ($a->isDir() && $b->isFile()) {
  1. public function __construct(\Traversable $iterator, $sort)
  2. {
  3. $this->iterator = $iterator;
  4. if (self::SORT_BY_NAME === $sort) {
  5. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  7. };
  8. } elseif (self::SORT_BY_TYPE === $sort) {
  9. $this->sort = function ($a, $b) {
  10. if ($a->isDir() && $b->isFile()) {
  1. if (self::SORT_BY_NAME === $sort) {
  2. $this->sort = function ($a, $b) {
  3. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  4. };
  5. } elseif (self::SORT_BY_TYPE === $sort) {
  6. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. if ($a->isDir() && $b->isFile()) {
  8. return -1;
  9. } elseif ($a->isFile() && $b->isDir()) {
  10. return 1;
  11. }
  1. if (self::SORT_BY_NAME === $sort) {
  2. $this->sort = function ($a, $b) {
  3. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  4. };
  5. } elseif (self::SORT_BY_TYPE === $sort) {
  6. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. if ($a->isDir() && $b->isFile()) {
  8. return -1;
  9. } elseif ($a->isFile() && $b->isDir()) {
  10. return 1;
  11. }
  1. }
  2. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  3. };
  4. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  5. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Rui Marinho
  6. return $a->getATime() - $b->getATime();
  7. };
  8. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  9. $this->sort = function ($a, $b) {
  10. return $a->getCTime() - $b->getCTime();
  1. }
  2. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  3. };
  4. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  5. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Rui Marinho
  6. return $a->getATime() - $b->getATime();
  7. };
  8. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  9. $this->sort = function ($a, $b) {
  10. return $a->getCTime() - $b->getCTime();
  1. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  2. $this->sort = function ($a, $b) {
  3. return $a->getATime() - $b->getATime();
  4. };
  5. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  6. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Rui Marinho
  7. return $a->getCTime() - $b->getCTime();
  8. };
  9. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  10. $this->sort = function ($a, $b) {
  11. return $a->getMTime() - $b->getMTime();
  1. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  2. $this->sort = function ($a, $b) {
  3. return $a->getATime() - $b->getATime();
  4. };
  5. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  6. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Rui Marinho
  7. return $a->getCTime() - $b->getCTime();
  8. };
  9. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  10. $this->sort = function ($a, $b) {
  11. return $a->getMTime() - $b->getMTime();
  1. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  2. $this->sort = function ($a, $b) {
  3. return $a->getCTime() - $b->getCTime();
  4. };
  5. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  6. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Rui Marinho
  7. return $a->getMTime() - $b->getMTime();
  8. };
  9. } elseif (is_callable($sort)) {
  10. $this->sort = $sort;
  11. } else {
  1. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  2. $this->sort = function ($a, $b) {
  3. return $a->getCTime() - $b->getCTime();
  4. };
  5. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  6. $this->sort = function ($a, $b) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Rui Marinho
  7. return $a->getMTime() - $b->getMTime();
  8. };
  9. } elseif (is_callable($sort)) {
  10. $this->sort = $sort;
  11. } else {
  1. /**
  2. * {@inheritdoc}
  3. */
  4. public function guessType($class, $property)
  5. {
  6. return $this->guess(function ($guesser) use ($class, $property) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. return $guesser->guessType($class, $property);
  8. });
  9. }
  10. /**
  1. /**
  2. * {@inheritdoc}
  3. */
  4. public function guessRequired($class, $property)
  5. {
  6. return $this->guess(function ($guesser) use ($class, $property) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. return $guesser->guessRequired($class, $property);
  8. });
  9. }
  10. /**
  1. /**
  2. * {@inheritdoc}
  3. */
  4. public function guessMaxLength($class, $property)
  5. {
  6. return $this->guess(function ($guesser) use ($class, $property) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Bernhard Schussek
  7. return $guesser->guessMaxLength($class, $property);
  8. });
  9. }
  10. /**
  1. /**
  2. * {@inheritdoc}
  3. */
  4. public function guessPattern($class, $property)
  5. {
  6. return $this->guess(function ($guesser) use ($class, $property) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Michel Weimerskirch
  7. return $guesser->guessPattern($class, $property);
  8. });
  9. }
  10. /**
  1. }
  2. return false;
  3. }
  4. public static function preBind($listener, FormEvent $event)

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. {
  6. set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
  7. $listener->preBind($event);
  8. restore_error_handler();
  9. }
  1. $profileToken = $profile->getToken();
  2. // when there are errors in sub-requests, the parent and/or children tokens
  3. // may equal the profile token, resulting in infinite loops
  4. $parentToken = $profile->getParentToken() !== $profileToken ? $profile->getParentToken() : null;
  5. $childrenToken = array_filter(array_map(function ($p) use ($profileToken) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Javier Eguiluz
  6. return $profileToken !== $p->getToken() ? $p->getToken() : null;
  7. }, $profile->getChildren()));
  8. // Store profile
  9. $data = array(
  1. public function write(Profile $profile)
  2. {
  3. $data = array(
  4. 'token' => $profile->getToken(),
  5. 'parent' => $profile->getParentToken(),
  6. 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()),

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Andrej Hudec
  7. 'data' => $profile->getCollectors(),
  8. 'ip' => $profile->getIp(),
  9. 'method' => $profile->getMethod(),
  10. 'url' => $profile->getUrl(),
  11. 'time' => $profile->getTime(),
  1. $variables = array(
  2. 'token' => $token,
  3. 'user' => $token->getUser(),
  4. 'object' => $object,
  5. 'roles' => array_map(function ($role) { return $role->getRole(); }, $roles),

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Fabien Potencier
  6. 'trust_resolver' => $this->trustResolver,
  7. );
  8. // this is mainly to propose a better experience when the expression is used
  9. // in an access control rule, as the developer does not know that it's going
  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
    Open Issue Permalink
    Last edited by Fabien Potencier
  7. {
  8. if (0 === strpos($path, 'http') || !$path) {
  9. return $path;
  10. }
  1. $metadata->mergeConstraints($this->getMetadataFor($parent->name));
  2. }
  3. $interfaces = $metadata->getReflectionClass()->getInterfaces();
  4. $interfaces = array_filter($interfaces, function ($interface) use ($parent, $interfaces) {

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Mathieu Lemoine
  5. $interfaceName = $interface->getName();
  6. if ($parent && $parent->implementsInterface($interfaceName)) {
  7. return false;
  8. }
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'length' => $dom->length,
  8. );
  1. * @param DumperInterface $dumper The dumper being used for dumping
  2. * @param Cursor $cursor A cursor used for tracking dumper state position
  3. * @param array &$refs A map of all references discovered while dumping
  4. * @param mixed $item A Stub object or the original value being dumped
  5. */
  6. private function dumpItem($dumper, $cursor, &$refs, $item)

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

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by Nicolas Grekas
  7. {
  8. $cursor->refIndex = 0;
  9. $cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
  10. $cursor->hardRefTo = $cursor->hardRefHandle = $cursor->hardRefCount = 0;
  11. $firstSeen = true;

Templates should not be too long

  • Minor
  • Codestyle

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

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

Time to fix: about 3.1 days
Open Issue Permalink
Collective

Commented code should not be committed 21

  • Minor
  • Deadcode

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

  1. * {@inheritdoc}
  2. */
  3. public function parse($source)
  4. {
  5. // Matches an optional namespace, optional element, and required class
  6. // $source = 'test|input.ab6bd_field';

    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
    Open Issue Permalink
    Last edited by Troy McCabe
  7. // $matches = array (size=4)
  8. // 0 => string 'test|input.ab6bd_field' (length=22)
  9. // 1 => string 'test' (length=4)
  10. // 2 => string 'input' (length=5)
  11. // 3 => string 'ab6bd_field' (length=11)
  1. * {@inheritdoc}
  2. */
  3. public function parse($source)
  4. {
  5. // Matches an optional namespace, required element or `*`
  6. // $source = 'testns|testel';

    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
    Open Issue Permalink
    Last edited by Troy McCabe
  7. // $matches = array (size=3)
  8. // 0 => string 'testns|testel' (length=13)
  9. // 1 => string 'testns' (length=6)
  10. // 2 => string 'testel' (length=6)
  11. if (preg_match('/^(?:([a-z]++)\|)?([\w-]++|\*)$/i', trim($source), $matches)) {
  1. * {@inheritdoc}
  2. */
  3. public function parse($source)
  4. {
  5. // Matches an optional namespace, optional element, and required id
  6. // $source = 'test|input#ab6bd_field';

    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
    Open Issue Permalink
    Last edited by Troy McCabe
  7. // $matches = array (size=4)
  8. // 0 => string 'test|input#ab6bd_field' (length=22)
  9. // 1 => string 'test' (length=4)
  10. // 2 => string 'input' (length=5)
  11. // 3 => string 'ab6bd_field' (length=11)
  1. // a construct like:
  2. // $a = new ServiceA(ServiceB $b); $b = new ServiceB(ServiceA $a);
  3. // this is an indication for a wrong implementation, you can circumvent this problem
  4. // by setting up your service structure like this:
  5. // $b = new ServiceB();

    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
    Open Issue Permalink
    Last edited by Johannes M. Schmitt
  6. // $a = new ServiceA(ServiceB $b);
  7. // $b->setServiceA(ServiceA $a);
  8. if ($this->hasReference($id, $sDefinition->getArguments())) {
  9. throw new ServiceCircularReferenceException($id, array($id));
  10. }
  1. // Some languages are translated together with their region,
  2. // i.e. "en_GB" is translated as "British English"
  3. // we don't include these languages though because they mess up
  4. // the name sorting
  5. // $name = $this->langBundle->getLanguageName($displayLocale, $lang, $region);

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. // Some languages are simply not translated
  7. // Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans)
  8. if (null === ($name = $this->languageDataProvider->getName($lang, $displayLocale))) {
  9. return;
  1. return;
  2. }
  3. // "as" (Assamese) has no "Variants" block
  4. //if (!$langBundle->get('Variants')) {
  5. // continue;

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. //}
  7. $extras = array();
  8. // Discover the name of the script part of the locale
  1. $compiler = new GenrbCompiler($genrb, $genrbEnv);
  2. $config = new GeneratorConfig($sourceDir.'/data', $icuVersionInDownload);
  3. $baseDir = dirname(__DIR__).'/data';
  4. //$txtDir = $baseDir.'/txt';

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. $jsonDir = $baseDir;
  6. //$phpDir = $baseDir.'/'.Intl::PHP;
  7. //$resDir = $baseDir.'/'.Intl::RB_V2;
  8. $targetDirs = array($jsonDir/*, $resDir*/);
  1. $baseDir = dirname(__DIR__).'/data';
  2. //$txtDir = $baseDir.'/txt';
  3. $jsonDir = $baseDir;
  4. //$phpDir = $baseDir.'/'.Intl::PHP;

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. //$resDir = $baseDir.'/'.Intl::RB_V2;
  6. $targetDirs = array($jsonDir/*, $resDir*/);
  7. $workingDirs = array($jsonDir/*, $txtDir, $resDir*/);
  1. $baseDir = dirname(__DIR__).'/data';
  2. //$txtDir = $baseDir.'/txt';
  3. $jsonDir = $baseDir;
  4. //$phpDir = $baseDir.'/'.Intl::PHP;
  5. //$resDir = $baseDir.'/'.Intl::RB_V2;

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. $targetDirs = array($jsonDir/*, $resDir*/);
  7. $workingDirs = array($jsonDir/*, $txtDir, $resDir*/);
  8. //$config->addBundleWriter($txtDir, new TextBundleWriter());
  1. //$resDir = $baseDir.'/'.Intl::RB_V2;
  2. $targetDirs = array($jsonDir/*, $resDir*/);
  3. $workingDirs = array($jsonDir/*, $txtDir, $resDir*/);
  4. //$config->addBundleWriter($txtDir, new TextBundleWriter());

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. $config->addBundleWriter($jsonDir, new JsonBundleWriter());
  6. echo "Starting resource bundle compilation. This may take a while...\n";
  7. $filesystem->remove($workingDirs);
  1. echo "Generating language data...\n";
  2. $generator = new LanguageDataGenerator($compiler, Intl::LANGUAGE_DIR);
  3. $generator->generateData($config);
  4. //echo "Compiling...\n";

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. //
  6. //$compiler->compile($txtDir.'/'.Intl::LANGUAGE_DIR, $resDir.'/'.Intl::LANGUAGE_DIR);
  7. echo "Generating script data...\n";
  1. $generator = new LanguageDataGenerator($compiler, Intl::LANGUAGE_DIR);
  2. $generator->generateData($config);
  3. //echo "Compiling...\n";
  4. //
  5. //$compiler->compile($txtDir.'/'.Intl::LANGUAGE_DIR, $resDir.'/'.Intl::LANGUAGE_DIR);

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. echo "Generating script data...\n";
  7. $generator = new ScriptDataGenerator($compiler, Intl::SCRIPT_DIR);
  8. $generator->generateData($config);
  1. echo "Generating script data...\n";
  2. $generator = new ScriptDataGenerator($compiler, Intl::SCRIPT_DIR);
  3. $generator->generateData($config);
  4. //echo "Compiling...\n";

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. //
  6. //$compiler->compile($txtDir.'/'.Intl::SCRIPT_DIR, $resDir.'/'.Intl::SCRIPT_DIR);
  7. echo "Generating region data...\n";
  1. $generator = new ScriptDataGenerator($compiler, Intl::SCRIPT_DIR);
  2. $generator->generateData($config);
  3. //echo "Compiling...\n";
  4. //
  5. //$compiler->compile($txtDir.'/'.Intl::SCRIPT_DIR, $resDir.'/'.Intl::SCRIPT_DIR);

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. echo "Generating region data...\n";
  7. $generator = new RegionDataGenerator($compiler, Intl::REGION_DIR);
  8. $generator->generateData($config);
  1. echo "Generating region data...\n";
  2. $generator = new RegionDataGenerator($compiler, Intl::REGION_DIR);
  3. $generator->generateData($config);
  4. //echo "Compiling...\n";

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. //
  6. //$compiler->compile($txtDir.'/'.Intl::REGION_DIR, $resDir.'/'.Intl::REGION_DIR);
  7. echo "Generating currency data...\n";
  1. $generator = new RegionDataGenerator($compiler, Intl::REGION_DIR);
  2. $generator->generateData($config);
  3. //echo "Compiling...\n";
  4. //
  5. //$compiler->compile($txtDir.'/'.Intl::REGION_DIR, $resDir.'/'.Intl::REGION_DIR);

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. echo "Generating currency data...\n";
  7. $generator = new CurrencyDataGenerator($compiler, Intl::CURRENCY_DIR);
  8. $generator->generateData($config);
  1. echo "Generating currency data...\n";
  2. $generator = new CurrencyDataGenerator($compiler, Intl::CURRENCY_DIR);
  3. $generator->generateData($config);
  4. //echo "Compiling...\n";

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. //
  6. //$compiler->compile($txtDir.'/'.Intl::CURRENCY_DIR, $resDir.'/'.Intl::CURRENCY_DIR);
  7. echo "Generating locale data...\n";
  1. $generator = new CurrencyDataGenerator($compiler, Intl::CURRENCY_DIR);
  2. $generator->generateData($config);
  3. //echo "Compiling...\n";
  4. //
  5. //$compiler->compile($txtDir.'/'.Intl::CURRENCY_DIR, $resDir.'/'.Intl::CURRENCY_DIR);

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. echo "Generating locale data...\n";
  7. $reader = new BundleEntryReader(new JsonBundleReader());
  1. new RegionDataProvider($jsonDir.'/'.Intl::REGION_DIR, $reader)
  2. );
  3. $generator->generateData($config);
  4. //echo "Compiling...\n";

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. //
  6. //$compiler->compile($txtDir.'/'.Intl::LOCALE_DIR, $resDir.'/'.Intl::LOCALE_DIR);
  7. //
  8. //$filesystem->remove($txtDir);
  1. $generator->generateData($config);
  2. //echo "Compiling...\n";
  3. //
  4. //$compiler->compile($txtDir.'/'.Intl::LOCALE_DIR, $resDir.'/'.Intl::LOCALE_DIR);

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  5. //
  6. //$filesystem->remove($txtDir);
  7. echo "Resource bundle compilation complete.\n";
  1. //echo "Compiling...\n";
  2. //
  3. //$compiler->compile($txtDir.'/'.Intl::LOCALE_DIR, $resDir.'/'.Intl::LOCALE_DIR);
  4. //
  5. //$filesystem->remove($txtDir);

    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
    Open Issue Permalink
    Last edited by Bernhard Schussek
  6. echo "Resource bundle compilation complete.\n";
  7. $svnInfo = <<<SVN_INFO
  8. SVN information

Unused method, property, variable or parameter 122

  • Minor
  • Deadcode

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

  1. /**
  2. * @deprecated since version 2.3, to be removed in 3.0.
  3. */
  4. class DeprecationErrorHandler
  5. {
  6. public static function handle($errorNumber, $message, $file, $line, $context)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Colin Frei
  7. {
  8. if ($errorNumber & ~E_USER_DEPRECATED) {
  9. return true;
  10. }
  1. }
  2. return \PHPUnit\Util\ErrorHandler::handleError($errorNumber, $message, $file, $line);
  3. }
  4. public static function handleBC($errorNumber, $message, $file, $line, $context)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Colin Frei
  5. {
  6. if ($errorNumber & ~E_USER_DEPRECATED) {
  7. return true;
  8. }
  1. }
  2. return \PHPUnit\Util\ErrorHandler::handleError($errorNumber, $message, $file, $line);
  3. }
  4. public static function handleBC($errorNumber, $message, $file, $line, $context)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Colin Frei
  5. {
  6. if ($errorNumber & ~E_USER_DEPRECATED) {
  7. return true;
  8. }
  1. }
  2. return \PHPUnit\Util\ErrorHandler::handleError($errorNumber, $message, $file, $line);
  3. }
  4. public static function handleBC($errorNumber, $message, $file, $line, $context)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Colin Frei
  5. {
  6. if ($errorNumber & ~E_USER_DEPRECATED) {
  7. return true;
  8. }
  1. }
  2. return \PHPUnit\Util\ErrorHandler::handleError($errorNumber, $message, $file, $line);
  3. }
  4. public static function handleBC($errorNumber, $message, $file, $line, $context)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Colin Frei
  5. {
  6. if ($errorNumber & ~E_USER_DEPRECATED) {
  7. return true;
  8. }
  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
    Open Issue 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 e argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue 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
    Open Issue 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 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'length' => $dom->length,
  8. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'length' => $dom->length,
  8. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. Caster::PREFIX_VIRTUAL.'Core' => '1.0',
  8. Caster::PREFIX_VIRTUAL.'XML' => '2.0',
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. Caster::PREFIX_VIRTUAL.'Core' => '1.0',
  8. Caster::PREFIX_VIRTUAL.'XML' => '2.0',
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. Caster::PREFIX_VIRTUAL.'Core' => '1.0',
  8. Caster::PREFIX_VIRTUAL.'XML' => '2.0',
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  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 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  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 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  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 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  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 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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'doctype' => $dom->doctype,
  8. 'implementation' => $dom->implementation,
  9. 'documentElement' => new CutStub($dom->documentElement),
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'doctype' => $dom->doctype,
  8. 'implementation' => $dom->implementation,
  9. 'documentElement' => new CutStub($dom->documentElement),
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'data' => $dom->data,
  8. 'length' => $dom->length,
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'name' => $dom->name,
  8. 'specified' => $dom->specified,
  9. 'value' => $dom->value,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'name' => $dom->name,
  8. 'specified' => $dom->specified,
  9. 'value' => $dom->value,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'tagName' => $dom->tagName,
  8. 'schemaTypeInfo' => $dom->schemaTypeInfo,
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'tagName' => $dom->tagName,
  8. 'schemaTypeInfo' => $dom->schemaTypeInfo,
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'wholeText' => $dom->wholeText,
  8. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'wholeText' => $dom->wholeText,
  8. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'typeName' => $dom->typeName,
  8. 'typeNamespace' => $dom->typeNamespace,
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'typeName' => $dom->typeName,
  8. 'typeNamespace' => $dom->typeNamespace,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'severity' => $dom->severity,
  8. 'message' => $dom->message,
  9. 'type' => $dom->type,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'severity' => $dom->severity,
  8. 'message' => $dom->message,
  9. 'type' => $dom->type,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'lineNumber' => $dom->lineNumber,
  8. 'columnNumber' => $dom->columnNumber,
  9. 'offset' => $dom->offset,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'lineNumber' => $dom->lineNumber,
  8. 'columnNumber' => $dom->columnNumber,
  9. 'offset' => $dom->offset,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'name' => $dom->name,
  8. 'entities' => $dom->entities,
  9. 'notations' => $dom->notations,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'name' => $dom->name,
  8. 'entities' => $dom->entities,
  9. 'notations' => $dom->notations,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  9. 'notationName' => $dom->notationName,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'publicId' => $dom->publicId,
  8. 'systemId' => $dom->systemId,
  9. 'notationName' => $dom->notationName,
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'target' => $dom->target,
  8. 'data' => $dom->data,
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'target' => $dom->target,
  8. 'data' => $dom->data,
  9. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'document' => $dom->document,
  8. );
  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
    Open Issue Permalink
    Last edited by Nicolas Grekas
  5. {
  6. $a += array(
  7. 'document' => $dom->document,
  8. );
  1. if (null === $match) {
  2. return;
  3. }
  4. list($req, $headers) = $match;

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Fabien Potencier
  5. if (file_exists($body = $this->getPath($headers['x-content-digest'][0]))) {
  6. return $this->restoreResponse($headers, $body);
  7. }
  8. // TODO the metaStore referenced an entity that doesn't exist in
  1. $input = $this->input;
  2. $r = $e = array();
  3. $w = array($this->pipes[0]);
  4. // let's have a look if something changed in streams
  5. if (false === $n = @stream_select($r, $w, $e, 0, 0)) {

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Nicolas Grekas
  6. return;
  7. }
  8. foreach ($w as $stdin) {
  9. if (isset($this->inputBuffer[0])) {
  1. $read = $e = array();
  2. $r = $this->pipes;
  3. unset($r[0]);
  4. // let's have a look if something changed in streams
  5. if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {

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

    Time to fix: about 15 minutes