sleep() should not be used

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

  1. $documentToUpdate = new NoSqlDocument(
  2. $document[0]->getIdDocument(),
  3. self::TEST_COLLECTION,
  4. [ 'price' => 150000 ]
  5. );
  6. sleep(1); // Just to force a new Update DateTime

    sleep() may create timeouts without even protecting your application.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Joao Gilberto Magalhaes
  7. $documentSaved = $this->dbDriver->save($documentToUpdate);
  8. // Get the saved document
  9. $documentFromDb = $this->dbDriver->getDocumentById($document[0]->getIdDocument(), self::TEST_COLLECTION);

Commented code should not be committed

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

  1. $singleRow = $iterator->moveNext();
  2. $this->assertEquals($array[$i++], $singleRow->toArray());
  3. }
  4. // See --> http://php.net/manual/pt_BR/pdostatement.rowcount.php
  5. //$this->assertEquals(3, $iterator->count());

    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. }
  7. public function testExecuteAndGetId()
  8. {
  9. $idInserted = $this->dbDriver->executeAndGetId(

Unused use statement should be avoided

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

  1. */
  2. namespace Store;
  3. use ByJG\AnyDataset\DbDriverInterface;
  4. use ByJG\AnyDataset\Factory;

    The class ByJG\AnyDataset\Factory is declared but never used. You should remove the use statement.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Joao Gilberto Magalhaes
  5. class BasePdoTest extends \PHPUnit_Framework_TestCase
  6. {
  7. /**

Project files should not mix end of lines

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

Some files contain mixed and/or invalid end of lines ( \r\n instead of \n). Homogenize them to improve compatibility across different platforms.

  • docs/Connecting-to-MongoDB.md

To solve this issue, run the below command:

Time to fix: about 15 minutes
Open Issue Permalink
Collective
sed -i "s/\r//g" 'docs/Connecting-to-MongoDB.md'

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

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

  1. ```
  2. ### See also [Connecting to Data Sources](Connecting-to-Data-Sources.md)

    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 João Gilberto Magalhães
  1. (old version!)
  2. XMLNuke have a CachedDBDataset class. The main purpose of this class is retrieve queries from the database and store it in
  3. cache for an pre-defined time.

    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 João Gilberto Magalhães
  1. }
  2. return $filter;
  3. }
  4. }

    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 Joao Gilberto Magalhaes
  1. }
  2. return $result;
  3. }
  4. }

    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 Joao Gilberto Magalhaes
  1. namespace ByJG\AnyDataset;
  2. interface IterableInterface
  3. {
  4. public function getIterator();
  5. }

    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 Joao Gilberto Magalhaes
in src/Store/DbCached.php, line 151
  1. */
  2. public function getUri()
  3. {
  4. return $this->dbDriver->getUri();
  5. }
  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 Joao Gilberto Magalhaes