Commented code should not be committed 6

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

in src/Kernel.php, line 15
  1. * For the full copyright and license information, please view the LICENSE
  2. * file that was distributed with this source code.
  3. */
  4. use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
  5. //use Symfony\Bundle\FrameworkBundle\Routing\Loader\Configurator\RoutingConfigurator;

    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 Guite
  6. use Symfony\Component\Config\Loader\LoaderInterface;
  7. use Symfony\Component\Config\Resource\FileResource;
  8. use Symfony\Component\DependencyInjection\ContainerBuilder;
  9. //use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
  10. use Symfony\Component\Routing\RouteCollectionBuilder;
in src/Kernel.php, line 19
  1. use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
  2. //use Symfony\Bundle\FrameworkBundle\Routing\Loader\Configurator\RoutingConfigurator;
  3. use Symfony\Component\Config\Loader\LoaderInterface;
  4. use Symfony\Component\Config\Resource\FileResource;
  5. use Symfony\Component\DependencyInjection\ContainerBuilder;
  6. //use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

    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 Axel Guckelsberger
  7. use Symfony\Component\Routing\RouteCollectionBuilder;
  8. use Zikula\Bundle\CoreBundle\DynamicConfigDumper;
  9. use Zikula\Bundle\CoreBundle\Helper\PersistedBundleHelper;
  10. use Zikula\Bundle\CoreBundle\HttpKernel\ZikulaKernel;
  1. }
  2. $response = $event->getResponse();
  3. $response->headers->set('X-Frame-Options', $this->xFrameOptions);
  4. //$response->headers->set('X-Content-Security-Policy', "frame-ancestors 'self'");

    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 Guite
  5. $response->headers->set('X-XSS-Protection', '1');
  6. }
  7. }
  1. if ($request->server->has('USER_AGENT')) {
  2. $requestArgs['USER_AGENT'] = $request->server->get('USER_AGENT');
  3. }
  4. // while i think that REQUEST_URI is unnecessary,
  5. // the REFERER would be important, but results in way too many false positives
  6. /*

    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 Axel Guckelsberger
  7. if ($request->server->has('REQUEST_URI')) {
  8. $requestArgs['REQUEST_URI'] = $request->server->get('REQUEST_URI');
  9. }
  10. if ($request->server->has('HTTP_REFERER')) {
  11. $requestArgs['REFERER'] = $request->server->get('HTTP_REFERER');
  1. $config['General']['filter_type'] = $this->getSystemVar('idsfilter', 'xml');
  2. if (empty($config['General']['filter_type'])) {
  3. $config['General']['filter_type'] = 'xml';
  4. }
  5. $config['General']['base_path'] = ''; //PHPIDS_PATH_PREFIX;

    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 Craig Heydenburg
  6. // we don't use the base path because the tmp directory is in zkTemp (see below)
  7. $config['General']['use_base_path'] = false;
  8. // path to the filters used
  9. $defaultPath = 'Resources/config/phpids_zikula_default.xml';
  1. private function addFosJsRouting(string $locale): void
  2. {
  3. // reenable after https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/issues/221 OR https://github.com/zikula/core/issues/4027 is solved
  4. //if ('prod' === $this->kernel->getEnvironment() && file_exists($this->kernel->getProjectDir() . '/public/js/fos_js_routes.' . $locale . '.js')) {
  5. // $routeScript = $this->assetHelper->resolve('js/fos_js_routes.' . $locale . '.js');

    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 Guite
  6. //} else {
  7. $routeScript = $this->router->generate('fos_js_routing_js', ['callback' => 'fos.Router.setData']);
  8. //}
  9. $this->jsAssetBag->add([
  10. $this->assetHelper->resolve('bundles/fosjsrouting/js/router.js') => AssetBag::WEIGHT_ROUTER_JS,

Unused method, property, variable or parameter 2

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

  1. class DefaultPageAssetSetterListener implements EventSubscriberInterface
  2. {
  3. /**
  4. * @var ZikulaHttpKernelInterface
  5. */
  6. private $kernel;

    This kernel attribute is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Guite
  7. /**
  8. * @var AssetBag
  9. */
  10. private $cssAssetBag;
  1. CurrencyType::class,
  2. LanguageType::class,
  3. LocaleType::class,
  4. TimezoneType::class
  5. ])) {
  6. $fieldOptions['choice_loader'] = null;

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Craig Heydenburg
  7. }
  8. }
  9. public function getBlockPrefix()
  10. {

PHP code should follow PSR-1 basic coding standard 2

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

  1. */
  2. public function __construct()
  3. {
  4. }
  5. public function get_objectType(): string

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Guite
  6. {
  7. return $this->_objectType;
  8. }
  9. public function set_objectType(string $_objectType): void
  1. public function get_objectType(): string
  2. {
  3. return $this->_objectType;
  4. }
  5. public function set_objectType(string $_objectType): void

    Method names should be declared in camelCase.
    You should rename this method to comply with PSR-1.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Guite
  6. {
  7. if ($this->_objectType !== $_objectType) {
  8. $this->_objectType = $_objectType ?? '';
  9. }
  10. }