Skip to content

Commit

Permalink
Update PHPCS (#21680)
Browse files Browse the repository at this point in the history
* Update composer packages

* Fix Array syntax

* Update current_time() to time()

* Fix short ternary
  • Loading branch information
Soean authored Apr 20, 2020
1 parent 0c37ba8 commit 56ae122
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 61 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"issues": "https://github.com/WordPress/gutenberg/issues"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"squizlabs/php_codesniffer": "^3.4.2",
"phpcompatibility/php-compatibility": "^9.2.0",
"wp-coding-standards/wpcs": "^2.1.1",
"sirbrillig/phpcs-variable-analysis": "^2.7"
"dealerdirect/phpcodesniffer-composer-installer": "^0.6",
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/php-compatibility": "^9.3",
"wp-coding-standards/wpcs": "^2.2",
"sirbrillig/phpcs-variable-analysis": "^2.8"
},
"require": {
"composer/installers": "~1.0"
Expand Down
109 changes: 58 additions & 51 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/class-wp-rest-block-directory-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private static function parse_block_metadata( $plugin ) {
$block->humanized_updated = sprintf(
/* translators: %s: Human-readable time difference. */
__( '%s ago', 'gutenberg' ),
human_time_diff( strtotime( $plugin['last_updated'] ), current_time( 'timestamp' ) )
human_time_diff( strtotime( $plugin['last_updated'] ), time() )
);

return $block;
Expand Down
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ function gutenberg_load_block_pattern( $name ) {
*/
function gutenberg_extend_settings_block_patterns( $settings ) {
if ( empty( $settings['__experimentalBlockPatterns'] ) ) {
$settings['__experimentalBlockPatterns'] = [];
$settings['__experimentalBlockPatterns'] = array();
}

$settings['__experimentalBlockPatterns'] = array_merge(
Expand Down
11 changes: 8 additions & 3 deletions lib/template-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,17 @@ function gutenberg_find_template( $template_file ) {
// See if there is a theme block template with higher priority than the resolved template post.
$higher_priority_block_template_path = null;
$higher_priority_block_template_priority = PHP_INT_MAX;
$block_template_files = glob( get_stylesheet_directory() . '/block-templates/*.html' ) ?: array();
$block_template_files = glob( get_stylesheet_directory() . '/block-templates/*.html' );
$block_template_files = is_array( $block_template_files ) ? $block_template_files : array();
if ( is_child_theme() ) {
$block_template_files = array_merge( $block_template_files, glob( get_template_directory() . '/block-templates/*.html' ) ?: array() );
$child_block_template_files = glob( get_template_directory() . '/block-templates/*.html' );
$child_block_template_files = is_array( $child_block_template_files ) ? $child_block_template_files : array();
$block_template_files = array_merge( $block_template_files, $child_block_template_files );
}
if ( gutenberg_is_experiment_enabled( 'gutenberg-full-site-editing-demo' ) ) {
$block_template_files = array_merge( $block_template_files, glob( dirname( __FILE__ ) . '/demo-block-templates/*.html' ) ?: array() );
$demo_block_template_files = glob( dirname( __FILE__ ) . '/demo-block-templates/*.html' );
$demo_block_template_files = is_array( $demo_block_template_files ) ? $demo_block_template_files : array();
$block_template_files = array_merge( $block_template_files, $demo_block_template_files );
}
foreach ( $block_template_files as $path ) {
if ( ! isset( $slug_priorities[ basename( $path, '.html' ) ] ) ) {
Expand Down

0 comments on commit 56ae122

Please sign in to comment.