Skip to content

Commit f399659

Browse files
committed
Moving classes to newly created directories (inc and backends) and using constant for including files
1 parent 5b4019f commit f399659

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

phpcs-diff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
Domain Path: /languages
1313
*/
1414

15+
if ( false === defined( 'PHPCS_DIFF_PLUGIN_DIR' ) ) {
16+
define( 'PHPCS_DIFF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
17+
}
18+
1519
// Load the command only if we're running WordPress via WP CLI.
1620
if ( defined( 'WP_CLI' ) && WP_CLI ) {
1721
require_once( './wp-cli-command.php' );

wp-cli-command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class PHPCS_Diff_CLI_Command extends WP_CLI_Command {
4545
*/
4646
public function __invoke( $args, $assoc_args ) {
4747

48-
require_once( dirname( __FILE__ ). '/class-phpcs-diff.php' );
48+
require_once( PHPCS_DIFF_PLUGIN_DIR . 'inc/class-phpcs-diff.php' );
4949

5050
$repo = sanitize_title( $assoc_args['repo'] );
5151
$start_revision = absint( $assoc_args['start_revision'] );
@@ -60,7 +60,7 @@ public function __invoke( $args, $assoc_args ) {
6060
}
6161

6262
// @todo: replace SVN version control backend with any other parser you might want to use - eg.: git
63-
require_once( dirname( __FILE__ ) . '/class-phpcs-diff-svn.php' );
63+
require_once( PHPCS_DIFF_PLUGIN_DIR . 'backends/class-phpcs-diff-svn.php' );
6464
$phpcs = new PHPCS_Diff( new PHPCS_Diff_SVN( $repo ) );
6565

6666
if ( true === array_key_exists( 'ignore-diff-too-big', $assoc_args ) ) {

0 commit comments

Comments
 (0)