Skip to content

Commit ed5a5ff

Browse files
committed
fix phpcs issues
1 parent 55dab62 commit ed5a5ff

8 files changed

Lines changed: 11 additions & 11 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ cypress/screenshots
1616
/artifacts/
1717
/blob-report/
1818
/playwright/.cache/
19+
.phpunit.result.cache

phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
2121
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
2222
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
23+
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed" />
2324
</rule>
2425
</ruleset>

phpunit/bootstrap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
// Require composer dependencies.
9-
require_once dirname( dirname( __FILE__ ) ) . '/vendor/autoload.php';
9+
require_once dirname( __DIR__ ) . '/vendor/autoload.php';
1010

1111
// Determine the tests directory (from a WP dev checkout).
1212
// Try the WP_TESTS_DIR environment variable first.
@@ -19,7 +19,7 @@
1919

2020
// See if we're installed inside an existing WP dev instance.
2121
if ( ! $_tests_dir ) {
22-
$_try_tests_dir = dirname( __FILE__ ) . '/../../../../../tests/phpunit';
22+
$_try_tests_dir = __DIR__ . '/../../../../../tests/phpunit';
2323
if ( file_exists( $_try_tests_dir . '/includes/functions.php' ) ) {
2424
$_tests_dir = $_try_tests_dir;
2525
}
@@ -40,12 +40,12 @@
4040
* Manually load the plugin being tested.
4141
*/
4242
function _manually_load_plugin() {
43-
require dirname( dirname( __FILE__ ) ) . '/wp-bootstrap-blocks.php';
43+
require dirname( __DIR__ ) . '/wp-bootstrap-blocks.php';
4444
}
4545
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
4646

4747
// Start up the WP testing environment.
4848
require $_tests_dir . '/includes/bootstrap.php';
4949

5050
// Load plugin UnitTestCase
51-
require_once dirname( __FILE__ ) . '/wp-bootstrap-blocks-unittestcase.php';
51+
require_once __DIR__ . '/wp-bootstrap-blocks-unittestcase.php';

phpunit/settings/class-wp-bootstrap-blocks-settings-test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package wp-bootstrap-blocks
66
*/
77

8-
use \WP_Bootstrap_Blocks\Settings;
8+
use WP_Bootstrap_Blocks\Settings;
99

1010
/**
1111
* Class WP_Bootstrap_Blocks_Settings_Test

phpunit/wp-bootstrap-blocks-functions-test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function test_wp_bootstrap_blocks_get_template_with_filter() {
3434
add_filter(
3535
'wp_bootstrap_blocks_get_template',
3636
function () {
37-
return trailingslashit( dirname( __FILE__ ) ) . 'fixtures/templates/dummy.php';
37+
return trailingslashit( __DIR__ ) . 'fixtures/templates/dummy.php';
3838
}
3939
);
4040
$container_template = wp_bootstrap_blocks_get_template( 'container', array() );

phpunit/wp-bootstrap-blocks-unittestcase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ protected function load_fixture( $variant, $state = '' ) {
7575
$filepath = $this->get_fixture_path( $variant, $state );
7676
if ( ! file_exists( $filepath ) ) {
7777
if ( self::OUTPUT_STATE_NAME === $state ) {
78-
throw new Exception( 'Fixture file ' . $filepath . ' does not exist. Please record output fixture file first by setting the environment variable WP_BOOTSTRAP_BLOCKS_RECORD to true and running the tests again.' );
78+
throw new Exception( 'Fixture file ' . esc_html( $filepath ) . ' does not exist. Please record output fixture file first by setting the environment variable WP_BOOTSTRAP_BLOCKS_RECORD to true and running the tests again.' );
7979
} else {
80-
throw new Exception( 'Fixture file ' . $filepath . ' does not exist. Please create it first.' );
80+
throw new Exception( 'Fixture file ' . esc_html( $filepath ) . ' does not exist. Please create it first.' );
8181
}
8282
}
8383
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
@@ -94,7 +94,7 @@ protected function load_fixture( $variant, $state = '' ) {
9494
*/
9595
protected function create_fixture_if_needed( $variant, $content ) {
9696
if ( getenv( 'WP_BOOTSTRAP_BLOCKS_RECORD' ) === '1' ) {
97-
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents
97+
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents
9898
file_put_contents( $this->get_fixture_path( $variant, 'output' ), $content );
9999
}
100100
}

src/class-wp-bootstrap-blocks.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,5 +346,4 @@ protected function log_version_number() {
346346
delete_option( $this->token . '_version' );
347347
update_option( $this->token . '_version', self::$version );
348348
}
349-
350349
}

src/settings/class-settings.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,5 @@ public static function is_css_grid_enabled() {
428428
public static function get_option( $option_name, $constant_name, $default_value ) {
429429
return defined( $constant_name ) ? constant( $constant_name ) : get_option( $option_name, $default_value );
430430
}
431-
432431
}
433432
endif;

0 commit comments

Comments
 (0)