Skip to content
Merged
Prev Previous commit
Fix lint issues reported by the Gutenberg linter
  • Loading branch information
oandregal committed Nov 29, 2021
commit 25bac06ed49d6b06388ee989229c6745c1c17e3a
40 changes: 21 additions & 19 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*
* @access private
*/

class WP_Theme_JSON_Gutenberg {

/**
Expand Down Expand Up @@ -320,17 +319,16 @@ class WP_Theme_JSON_Gutenberg {
/**
* Constructor.
*
* @param array $theme_json A structure that follows the theme.json schema.
* @param string $origin Optional. What source of data this object represents.
* One of 'default', 'theme', or 'custom'. Default 'theme'.
* @param array $theme_json A structure that follows the theme.json schema.
* @param string $origin Optional. What source of data this object represents.
* One of 'default', 'theme', or 'custom'. Default 'theme'.
*/
public function __construct( $theme_json = array(), $origin = 'theme' ) {
if ( ! in_array( $origin, self::VALID_ORIGINS, true ) ) {
$origin = 'theme';
}

$this->theme_json = WP_Theme_JSON_Schema_Gutenberg::migrate( $theme_json );

$valid_block_names = array_keys( self::get_blocks_metadata() );
$valid_element_names = array_keys( self::ELEMENTS );
$theme_json = self::sanitize( $this->theme_json, $valid_block_names, $valid_element_names );
Expand Down Expand Up @@ -486,7 +484,6 @@ private static function sanitize( $input, $valid_block_names, $valid_element_nam
* }
* }
*
*
* @return array Block metadata.
*/
private static function get_blocks_metadata() {
Expand Down Expand Up @@ -1059,11 +1056,12 @@ private static function replace_slug_in_string( $input, $slug ) {
* for the presets and adds them to the $declarations array
* following the format:
*
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
*
* ```php
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```
*
* @param array $settings Settings to process.
* @param array $origins List of origins to process.
Expand All @@ -1089,10 +1087,12 @@ private static function compute_preset_vars( $settings, $origins ) {
* for the custom values and adds them to the $declarations
* array following the format:
*
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```php
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```
*
* @param array $settings Settings to process.
* @return array Returns the modified $declarations.
Expand Down Expand Up @@ -1172,10 +1172,12 @@ private static function flatten_tree( $tree, $prefix = '', $token = '--' ) {
* Given a styles array, it extracts the style properties
* and adds them to the $declarations array following the format:
*
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```php
* array(
* 'name' => 'property_name',
* 'value' => 'property_value,
* )
* ```
*
* @param array $styles Styles to process.
* @param array $settings Theme settings.
Expand Down