| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 2 | public function run($migration_file, MigrationContext $context) |
|
| 37 | { |
||
| 38 | 2 | $sqls = file_get_contents($migration_file); |
|
| 39 | 2 | $sqls = array_filter(preg_split('/;\s+/', $sqls)); |
|
| 40 | |||
| 41 | 2 | if ( !$sqls ) { |
|
|
|
|||
| 42 | 1 | throw new \LogicException('The "' . basename($migration_file) . '" migration contains no SQL statements.'); |
|
| 43 | } |
||
| 44 | |||
| 45 | 1 | $db = $context->getDatabase(); |
|
| 46 | |||
| 47 | 1 | foreach ( $sqls as $sql ) { |
|
| 48 | 1 | $db->perform($sql); |
|
| 49 | } |
||
| 53 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.