Skip to content

Commit 916e673

Browse files
committed
Fix linting issues, fix namespaces
1 parent 4f9f26d commit 916e673

6 files changed

Lines changed: 34 additions & 35 deletions

File tree

‎command.php‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
return;
44
}
55

6-
$autoloader = __DIR__ . '/vendor/autoload.php';
7-
if ( file_exists( $autoloader ) ) {
8-
require_once $autoloader;
6+
$automattic_wpcli_sqlite_autoloader = __DIR__ . '/vendor/autoload.php';
7+
if ( file_exists( $automattic_wpcli_sqlite_autoloader ) ) {
8+
require_once $automattic_wpcli_sqlite_autoloader;
99
}
1010

11-
WP_CLI::add_command( 'sqlite', 'Sqlite_Command', array(
12-
'before_invoke' => function() {
13-
// Load the SQLite driver
14-
$min_version = '7.4';
15-
if ( version_compare( PHP_VERSION, $min_version, '<' ) ) {
16-
WP_CLI::error( "The `wp server` command requires PHP {$min_version} or newer." );
17-
}
18-
}
19-
) );
11+
WP_CLI::add_command(
12+
'sqlite',
13+
'\Automattic\WP_CLI\SQLite\SQLite_Command',
14+
array(
15+
'before_invoke' => function () {
16+
// Load the SQLite driver
17+
$min_version = '7.4';
18+
if ( version_compare( PHP_VERSION, $min_version, '<' ) ) {
19+
WP_CLI::error( "The `wp server` command requires PHP {$min_version} or newer." );
20+
}
21+
},
22+
)
23+
);

‎phpcs.xml.dist‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@
4545
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
4646
<properties>
4747
<property name="prefixes" type="array">
48-
<element value="WP_CLI\Router"/><!-- Namespaces. -->
49-
<element value="wpcli_server"/><!-- Global variables and such. -->
48+
<element value="Automattic\WP_Cli\SQLite"/><!-- Namespaces. -->
49+
<element value="automattic_wpcli_sqlite"/><!-- Global variables and such. -->
5050
</property>
5151
</properties>
5252
</rule>
53-
54-
<!-- Exclude existing classes from the prefix rule as it would break BC to prefix them now. -->
55-
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
56-
<exclude-pattern>*/src/Server_Command\.php$</exclude-pattern>
57-
</rule>
58-
</ruleset>
53+
</ruleset>

‎src/Base.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace WP_CLI\SQLite;
2+
namespace Automattic\WP_CLI\SQLite;
33

44
use WP_CLI;
55

‎src/Export.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace WP_CLI\SQLite;
2+
namespace Automattic\WP_CLI\SQLite;
33

44
use Exception;
55
use PDO;

‎src/Import.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace WP_CLI\SQLite;
2+
namespace Automattic\WP_CLI\SQLite;
33

44
use Exception;
55
use Generator;
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<?php
22

3+
namespace Automattic\WP_CLI\SQLite;
4+
5+
use WP_CLI;
6+
use WP_CLI_Command;
7+
8+
class SQLite_Command extends WP_CLI_Command {
39

4-
class Sqlite_Command extends WP_CLI_Command {
510

611
/**
712
* Imports the database to SQLite.
@@ -11,15 +16,11 @@ class Sqlite_Command extends WP_CLI_Command {
1116
* <file>
1217
* : The file to import or - for stdin.
1318
*/
14-
public function import($args, $assoc_args) {
19+
public function import( $args, $assoc_args ) {
1520
WP_CLI::success( 'Importing database...' );
16-
17-
$import = new WP_CLI\SQLite\Import();
18-
19-
$file = $args[0];
20-
21+
$import = new Import();
22+
$file = $args[0];
2123
$import->run( $file, $assoc_args );
22-
2324
}
2425

2526

@@ -31,10 +32,9 @@ public function import($args, $assoc_args) {
3132
* <file>
3233
* : The file to export to or - for stdout.
3334
*/
34-
public function export($args, $assoc_args) {
35+
public function export( $args, $assoc_args ) {
3536
WP_CLI::success( 'Exporting database...' );
36-
37-
$export = new WP_CLI\SQLite\Export();
37+
$export = new Export();
3838
$export->run( $args[0], $assoc_args );
3939
}
40-
}
40+
}

0 commit comments

Comments
 (0)