Booleans and null should be compared strictly

  • Minor
  • Bugrisk

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

  1. *
  2. * @param $methods
  3. */
  4. public function setRoutes($methods)
  5. {
  6. if ($methods == null) {

    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 Joao Gilberto Magalhaes
  7. $this->routes = null;
  8. return;
  9. }
  10. if (!is_array($methods)) {

Commented code should not be committed 3

  • Minor
  • Deadcode

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

  1. {
  2. public function writeHeader()
  3. {
  4. header('Content-Type: application/json');
  5. // header('Access-Control-Allow-Origin: *');

    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 Joao Gilberto Magalhaes
  6. // header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
  7. // header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
  8. }
  9. public function writeOutput(ServiceAbstract $instance)
  1. public function writeHeader()
  2. {
  3. header('Content-Type: application/json');
  4. // header('Access-Control-Allow-Origin: *');
  5. // header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");

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

    Time to fix: about 30 minutes
    Open Issue Permalink
    Last edited by Joao Gilberto Magalhaes
  6. // header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
  7. }
  8. public function writeOutput(ServiceAbstract $instance)
  9. {
  1. public function writeHeader()
  2. {
  3. header('Content-Type: application/json');
  4. // header('Access-Control-Allow-Origin: *');
  5. // header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
  6. // header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");

    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 Joao Gilberto Magalhaes
  7. }
  8. public function writeOutput(ServiceAbstract $instance)
  9. {
  10. $serialized = $instance->getResponse()->getResponseBag()->process();

Text files should end with a newline character

  • Info
  • Codestyle

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

in src/UploadedFiles.php, line 65
  1. throw new \InvalidArgumentException("The upload '$key' does not exists");
  2. }
  3. return $_FILES[$key][$property];
  4. }
  5. }

    This file ends with no newline character. It won't render properly on a terminal, and it's considered a bad practice. Add a simple line feed as the last character to fix it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Joao Gilberto Magalhaes