Booleans and null should be compared strictly

  • Minor
  • Bugrisk

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

  1. ->from($this->className, 'p');
  2. } elseif ($this->objectManager instanceof \Doctrine\ODM\MongoDB\DocumentManager) {
  3. /** @var \Doctrine\ODM\MongoDB\Query\Builder $builder */
  4. $builder = $this->objectManager->createQueryBuilder($this->className);
  5. if (!empty($fields) && true == $distinct) {

    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 Cedrick Oka
  6. $builder->distinct($fields[0]);
  7. }
  8. $builder->count();
  9. } else {

Text files should end with a newline character 4

  • Info
  • Codestyle

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

  1. * @author Cedrick Oka Baidai <okacedrick@gmail.com>
  2. *
  3. */
  4. class BadQueryExprException extends PaginationException
  5. {
  6. }

    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 Cedrick Oka
  1. * @author Cedrick Oka Baidai <okacedrick@gmail.com>
  2. *
  3. */
  4. class PaginationException extends \Exception
  5. {
  6. }

    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 Cedrick Oka
  1. return false;
  2. }
  3. return (boolean) preg_match($mapConverter['pattern'], $exprValue);
  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 Cedrick Oka
in Util/FilterUtil.php, line 31
  1. $value = new \DateTime(is_int($value) ? '@'.$value : $value);
  2. }
  3. return $value;
  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 Cedrick Oka