Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS: all methods must declare visibility #44543

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions packages/block-serialization-default-parser/parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class WP_Block_Parser_Block {
* @param string $innerHTML Resultant HTML from inside block comment delimiters after removing inner blocks.
* @param array $innerContent List of string fragments and null markers where inner blocks were found.
*/
function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) {
public function __construct( $name, $attrs, $innerBlocks, $innerHTML, $innerContent ) {
$this->blockName = $name;
$this->attrs = $attrs;
$this->innerBlocks = $innerBlocks;
Expand Down Expand Up @@ -152,7 +152,7 @@ class WP_Block_Parser_Frame {
* @param int $prev_offset Byte offset into document for after parse token ends.
* @param int $leading_html_start Byte offset into document where leading HTML before token starts.
*/
function __construct( $block, $token_start, $token_length, $prev_offset = null, $leading_html_start = null ) {
public function __construct( $block, $token_start, $token_length, $prev_offset = null, $leading_html_start = null ) {
$this->block = $block;
$this->token_start = $token_start;
$this->token_length = $token_length;
Expand Down Expand Up @@ -224,7 +224,7 @@ class WP_Block_Parser {
* @param string $document Input document being parsed.
* @return array[]
*/
function parse( $document ) {
public function parse( $document ) {
$this->document = $document;
$this->offset = 0;
$this->output = array();
Expand Down Expand Up @@ -252,7 +252,7 @@ function parse( $document ) {
* @since 5.0.0
* @return bool
*/
function proceed() {
public function proceed() {
$next_token = $this->next_token();
list( $token_type, $block_name, $attrs, $start_offset, $token_length ) = $next_token;
$stack_depth = count( $this->stack );
Expand Down Expand Up @@ -398,7 +398,7 @@ function proceed() {
* @since 4.6.1 fixed a bug in attribute parsing which caused catastrophic backtracking on invalid block comments
* @return array
*/
function next_token() {
public function next_token() {
$matches = null;

/*
Expand Down Expand Up @@ -473,7 +473,7 @@ function next_token() {
* @param string $innerHTML HTML content of block.
* @return WP_Block_Parser_Block freeform block object.
*/
function freeform( $innerHTML ) {
public function freeform( $innerHTML ) {
return new WP_Block_Parser_Block( null, $this->empty_attrs, array(), $innerHTML, array( $innerHTML ) );
}

Expand All @@ -485,7 +485,7 @@ function freeform( $innerHTML ) {
* @since 5.0.0
* @param null $length how many bytes of document text to output.
*/
function add_freeform( $length = null ) {
public function add_freeform( $length = null ) {
$length = $length ? $length : strlen( $this->document ) - $this->offset;

if ( 0 === $length ) {
Expand All @@ -506,7 +506,7 @@ function add_freeform( $length = null ) {
* @param int $token_length Byte length of entire block from start of opening token to end of closing token.
* @param int|null $last_offset Last byte offset into document if continuing form earlier output.
*/
function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) {
public function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_length, $last_offset = null ) {
$parent = $this->stack[ count( $this->stack ) - 1 ];
$parent->block->innerBlocks[] = (array) $block;
$html = substr( $this->document, $parent->prev_offset, $token_start - $parent->prev_offset );
Expand All @@ -527,7 +527,7 @@ function add_inner_block( WP_Block_Parser_Block $block, $token_start, $token_len
* @since 5.0.0
* @param int|null $end_offset byte offset into document for where we should stop sending text output as HTML.
*/
function add_block_from_stack( $end_offset = null ) {
public function add_block_from_stack( $end_offset = null ) {
$stack_top = array_pop( $this->stack );
$prev_offset = $stack_top->prev_offset;

Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/plugins/class-test-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Test_Widget extends WP_Widget {
/**
* Sets up a new test widget instance.
*/
function __construct() {
public function __construct() {
parent::__construct(
'test_widget',
'Test Widget',
Expand Down
28 changes: 14 additions & 14 deletions phpunit/block-supports/border-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class WP_Block_Supports_Border_Test extends WP_UnitTestCase {
*/
private $test_block_name;

function set_up() {
public function set_up() {
parent::set_up();
$this->test_block_name = null;
}

function tear_down() {
public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::tear_down();
Expand Down Expand Up @@ -53,7 +53,7 @@ private function register_bordered_block_with_support( $block_name, $supports =
return $registry->get_registered( $this->test_block_name );
}

function test_border_object_with_no_styles() {
public function test_border_object_with_no_styles() {
$block_type = self::register_bordered_block_with_support(
'test/border-object-with-no-styles',
array(
Expand All @@ -72,7 +72,7 @@ function test_border_object_with_no_styles() {
$this->assertSame( $expected, $actual );
}

function test_border_object_with_invalid_style_prop() {
public function test_border_object_with_invalid_style_prop() {
$block_type = self::register_bordered_block_with_support(
'test/border-object-with-invalid-style-prop',
array(
Expand All @@ -91,7 +91,7 @@ function test_border_object_with_invalid_style_prop() {
$this->assertSame( $expected, $actual );
}

function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
public function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
$block_type = self::register_bordered_block_with_support(
'test/border-color-slug-with-numbers-is-kebab-cased-properly',
array(
Expand Down Expand Up @@ -123,7 +123,7 @@ function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
$this->assertSame( $expected, $actual );
}

function test_flat_border_with_skipped_serialization() {
public function test_flat_border_with_skipped_serialization() {
$block_type = self::register_bordered_block_with_support(
'test/flat-border-with-skipped-serialization',
array(
Expand Down Expand Up @@ -153,7 +153,7 @@ function test_flat_border_with_skipped_serialization() {
$this->assertSame( $expected, $actual );
}

function test_flat_border_with_individual_skipped_serialization() {
public function test_flat_border_with_individual_skipped_serialization() {
$block_type = self::register_bordered_block_with_support(
'test/flat-border-with-individual-skipped-serialization',
array(
Expand Down Expand Up @@ -185,7 +185,7 @@ function test_flat_border_with_individual_skipped_serialization() {
$this->assertSame( $expected, $actual );
}

function test_split_border_radius() {
public function test_split_border_radius() {
$block_type = self::register_bordered_block_with_support(
'test/split-border-radius',
array(
Expand Down Expand Up @@ -214,7 +214,7 @@ function test_split_border_radius() {
$this->assertSame( $expected, $actual );
}

function test_flat_border_with_custom_color() {
public function test_flat_border_with_custom_color() {
$block_type = self::register_bordered_block_with_support(
'test/flat-border-with-custom-color',
array(
Expand Down Expand Up @@ -243,7 +243,7 @@ function test_flat_border_with_custom_color() {
$this->assertSame( $expected, $actual );
}

function test_split_borders_with_custom_colors() {
public function test_split_borders_with_custom_colors() {
$block_type = self::register_bordered_block_with_support(
'test/split-borders-with-custom-colors',
array(
Expand Down Expand Up @@ -288,7 +288,7 @@ function test_split_borders_with_custom_colors() {
$this->assertSame( $expected, $actual );
}

function test_split_borders_with_skipped_serialization() {
public function test_split_borders_with_skipped_serialization() {
$block_type = self::register_bordered_block_with_support(
'test/split-borders-with-skipped-serialization',
array(
Expand Down Expand Up @@ -332,7 +332,7 @@ function test_split_borders_with_skipped_serialization() {
$this->assertSame( $expected, $actual );
}

function test_split_borders_with_skipped_individual_feature_serialization() {
public function test_split_borders_with_skipped_individual_feature_serialization() {
$block_type = self::register_bordered_block_with_support(
'test/split-borders-with-skipped-individual-feature-serialization',
array(
Expand Down Expand Up @@ -378,7 +378,7 @@ function test_split_borders_with_skipped_individual_feature_serialization() {
$this->assertSame( $expected, $actual );
}

function test_partial_split_borders() {
public function test_partial_split_borders() {
$block_type = self::register_bordered_block_with_support(
'test/partial-split-borders',
array(
Expand Down Expand Up @@ -415,7 +415,7 @@ function test_partial_split_borders() {
$this->assertSame( $expected, $actual );
}

function test_split_borders_with_named_colors() {
public function test_split_borders_with_named_colors() {
$block_type = self::register_bordered_block_with_support(
'test/split-borders-with-named-colors',
array(
Expand Down
10 changes: 5 additions & 5 deletions phpunit/block-supports/colors-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ class WP_Block_Supports_Colors_Test extends WP_UnitTestCase {
*/
private $test_block_name;

function set_up() {
public function set_up() {
parent::set_up();
$this->test_block_name = null;
}

function tear_down() {
public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::tear_down();
}

function test_color_slugs_with_numbers_are_kebab_cased_properly() {
public function test_color_slugs_with_numbers_are_kebab_cased_properly() {
$this->test_block_name = 'test/color-slug-with-numbers';
register_block_type(
$this->test_block_name,
Expand Down Expand Up @@ -64,7 +64,7 @@ function test_color_slugs_with_numbers_are_kebab_cased_properly() {
$this->assertSame( $expected, $actual );
}

function test_color_with_skipped_serialization_block_supports() {
public function test_color_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/color-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
Expand Down Expand Up @@ -102,7 +102,7 @@ function test_color_with_skipped_serialization_block_supports() {
$this->assertSame( $expected, $actual );
}

function test_gradient_with_individual_skipped_serialization_block_supports() {
public function test_gradient_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/gradient-with-individual-skipped-serialization-block-support';
register_block_type(
$this->test_block_name,
Expand Down
16 changes: 8 additions & 8 deletions phpunit/block-supports/layout-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

class WP_Block_Supports_Layout_Test extends WP_UnitTestCase {
function set_up() {
public function set_up() {
parent::set_up();
$this->theme_root = realpath( __DIR__ . '/../data/themedir1' );
$this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
Expand All @@ -24,19 +24,19 @@ function set_up() {
unset( $GLOBALS['wp_themes'] );
}

function tear_down() {
public function tear_down() {
$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
wp_clean_themes_cache();
unset( $GLOBALS['wp_themes'] );
WP_Style_Engine_CSS_Rules_Store_Gutenberg::remove_all_stores();
parent::tear_down();
}

function filter_set_theme_root() {
public function filter_set_theme_root() {
return $this->theme_root;
}

function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() {
public function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
Expand All @@ -49,7 +49,7 @@ function test_outer_container_not_restored_for_non_aligned_image_block_with_non_
$this->assertSame( $expected, gutenberg_restore_image_outer_container( $block_content, $block ) );
}

function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() {
public function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
Expand All @@ -62,7 +62,7 @@ function test_outer_container_restored_for_aligned_image_block_with_non_themejso
$this->assertSame( $expected, gutenberg_restore_image_outer_container( $block_content, $block ) );
}

function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme() {
public function test_additional_styles_moved_to_restored_outer_container_for_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
switch_theme( 'default' );
$block = array(
Expand All @@ -89,7 +89,7 @@ function test_additional_styles_moved_to_restored_outer_container_for_aligned_im
$this->assertSame( $expected_other_attributes, gutenberg_restore_image_outer_container( $block_classes_other_attributes, $block ) );
}

function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() {
public function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() {
switch_theme( 'block-theme' );
$block = array(
'blockName' => 'core/image',
Expand Down Expand Up @@ -123,7 +123,7 @@ function test_outer_container_not_restored_for_aligned_image_block_with_themejso
* }
* @param string $expected_output The expected output.
*/
function test_gutenberg_get_layout_style( $args, $expected_output ) {
public function test_gutenberg_get_layout_style( $args, $expected_output ) {
$layout_styles = gutenberg_get_layout_style( $args['selector'], $args['layout'], $args['has_block_gap_support'], $args['gap_value'], $args['should_skip_gap_serialization'], $args['fallback_gap_value'], $args['block_spacing'] );
$this->assertSame( $expected_output, $layout_styles );
}
Expand Down
10 changes: 5 additions & 5 deletions phpunit/block-supports/spacing-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ class WP_Block_Supports_Spacing_Test extends WP_UnitTestCase {
*/
private $test_block_name;

function set_up() {
public function set_up() {
parent::set_up();
$this->test_block_name = null;
}

function tear_down() {
public function tear_down() {
unregister_block_type( $this->test_block_name );
$this->test_block_name = null;
parent::tear_down();
}

function test_spacing_style_is_applied() {
public function test_spacing_style_is_applied() {
$this->test_block_name = 'test/spacing-style-is-applied';
register_block_type(
$this->test_block_name,
Expand Down Expand Up @@ -68,7 +68,7 @@ function test_spacing_style_is_applied() {
$this->assertSame( $expected, $actual );
}

function test_spacing_with_skipped_serialization_block_supports() {
public function test_spacing_with_skipped_serialization_block_supports() {
$this->test_block_name = 'test/spacing-with-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
Expand Down Expand Up @@ -112,7 +112,7 @@ function test_spacing_with_skipped_serialization_block_supports() {
$this->assertSame( $expected, $actual );
}

function test_margin_with_individual_skipped_serialization_block_supports() {
public function test_margin_with_individual_skipped_serialization_block_supports() {
$this->test_block_name = 'test/margin-with-individual-skipped-serialization-block-supports';
register_block_type(
$this->test_block_name,
Expand Down
Loading