1 | <?php |
||
8 | class Sqlite extends DbDumper |
||
9 | { |
||
10 | /** |
||
11 | * Dump the contents of the database to a given file. |
||
12 | * |
||
13 | * @param string $dumpFile |
||
14 | * |
||
15 | * @throws \Spatie\DbDumper\Exceptions\DumpFailed |
||
16 | */ |
||
17 | public function dumpToFile(string $dumpFile) |
||
31 | |||
32 | /** |
||
33 | * Get the command that should be performed to dump the database. |
||
34 | * |
||
35 | * @param string $dumpFile |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | public function getDumpCommand(string $dumpFile): string |
||
50 | } |
||
51 |
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.
Let’s take a look at an example:
As you can see in this example, the array
$myArray
is initialized the first time when the foreach loop is entered. You can also see that the value of thebar
key is only written conditionally; thus, its value might result from a previous iteration.This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.