Booleans and null should be compared strictly

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

in Tools/Tools.php, line 192
  1. if ($array === false || $array === null || empty($array))
  2. {
  3. return false;
  4. }
  5. if ($trim == true)

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by David Herrmann
  6. {
  7. $string = trim($string);
  8. }
  9. $lineCount = count($array);

Commented code should not be committed

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

  1. return new RedirectResponse($url, $status);
  2. }
  3. // UPSF2.4 Prepeare for upgrade prepeare for symfony 2.4 upgrade
  4. // public function setRequest(RequestStack $request_stack)
  5. // {
  6. // $this->request = $request_stack->getCurrentRequest();

    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 c33s
  7. // }
  8. }

The composer.json file should not raise warnings

More information: https://insight.symfony.com/what-we-analyse/composer.warning

The package "composer/composer" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.

Time to fix: about 1 hour
Open Issue Permalink
Collective

Text files should end with a valid new line character. 2

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

  1. output_dir: '%kernel.root_dir%/Resources/translations'
  2. ignored_domains: [ routes ]
  3. excluded_names: [ '*TestCase.php', '*Test.php' ]
  4. excluded_dirs: [ cache, data, logs ]
  5. #extractors: [ alias_of_the_extractor ]
  6. This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by David Herrmann
  1. <a href="{{ path(app.request.get('_route'), params) }}">
  2. <img src="{{ asset('media/components/famfamfam-flags/img/' ~ flag ~ '.png') }}" alt="Switch to {{ locale }}" title="Switch to {{ locale }}" />
  3. </a>
  4. </li>
  5. {% endif %}
  6. {% endfor %}

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by c33s