@@ -103,7 +103,7 @@ public function package( $args, $assoc_args ) {
103103
104104 $ force = Utils \get_flag_value ( $ assoc_args , 'force ' );
105105
106- $ package_root = dirname ( dirname ( __FILE__ ) );
106+ $ package_root = dirname ( __DIR__ );
107107 $ template_path = $ package_root . '/templates/ ' ;
108108 $ wp_cli_yml = <<<EOT
109109require:
@@ -236,7 +236,7 @@ public function package_readme( $args, $assoc_args ) {
236236 $ force = Utils \get_flag_value ( $ assoc_args , 'force ' );
237237 $ branch = Utils \get_flag_value ( $ assoc_args , 'branch ' , 'master ' );
238238
239- $ package_root = dirname ( dirname ( __FILE__ ) );
239+ $ package_root = dirname ( __DIR__ );
240240 $ template_path = $ package_root . '/templates/ ' ;
241241
242242 $ bits = explode ( '/ ' , $ composer_obj ['name ' ] );
@@ -354,10 +354,10 @@ public function package_readme( $args, $assoc_args ) {
354354 $ bundled = ! empty ( $ composer_obj ['extra ' ]['bundled ' ] );
355355 foreach ( [ 'using ' , 'installing ' , 'contributing ' , 'support ' ] as $ key ) {
356356 if ( isset ( $ readme_sections [ $ key ] ) ) {
357- $ file = dirname ( dirname ( __FILE__ ) ) . '/templates/readme- ' . $ key . '.mustache ' ;
357+ $ file = dirname ( __DIR__ ) . '/templates/readme- ' . $ key . '.mustache ' ;
358358 if ( $ bundled
359- && file_exists ( dirname ( dirname ( __FILE__ ) ) . '/templates/readme- ' . $ key . '-bundled.mustache ' ) ) {
360- $ file = dirname ( dirname ( __FILE__ ) ) . '/templates/readme- ' . $ key . '-bundled.mustache ' ;
359+ && file_exists ( dirname ( __DIR__ ) . '/templates/readme- ' . $ key . '-bundled.mustache ' ) ) {
360+ $ file = dirname ( __DIR__ ) . '/templates/readme- ' . $ key . '-bundled.mustache ' ;
361361 }
362362 $ readme_sections [ $ key ]['body ' ] = $ file ;
363363 }
@@ -459,7 +459,7 @@ public function package_github( $args, $assoc_args ) {
459459 self ::check_if_valid_package_dir ( $ package_dir );
460460
461461 $ force = Utils \get_flag_value ( $ assoc_args , 'force ' );
462- $ template_path = dirname ( dirname ( __FILE__ ) ) . '/templates ' ;
462+ $ template_path = dirname ( __DIR__ ) . '/templates ' ;
463463
464464 $ composer_obj = json_decode ( file_get_contents ( $ package_dir . '/composer.json ' ), true );
465465 $ settings_vars = [
@@ -650,7 +650,7 @@ public function package_tests( $args, $assoc_args ) {
650650 Process::create ( Utils \esc_cmd ( 'mkdir %s ' , $ features_dir ) )->run ();
651651 }
652652
653- $ package_root = dirname ( dirname ( __FILE__ ) );
653+ $ package_root = dirname ( __DIR__ );
654654
655655 // Only create a sample feature file when none exist
656656 if ( ! glob ( $ features_dir . '/*.feature ' ) ) {
@@ -798,5 +798,4 @@ private static function check_if_valid_package_dir( $package_dir ) {
798798 WP_CLI ::error ( 'Invalid package directory. composer.json file must be present. ' );
799799 }
800800 }
801-
802801}
0 commit comments