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

PHPCS Cleanup #108

Merged
merged 6 commits into from
Oct 16, 2023
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
4 changes: 1 addition & 3 deletions .deploy/config/local-config-dokku.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
*
* @param string $key
* @param string $default
*
* @return string|bool
*/
function fromenv( string $key, mixed $default = null ) {
function fromenv( string $key, mixed $default = null ): string|array|bool {
$value = getenv( $key );
if ( $value === false ) {
$value = $default;
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
},
"require": {
"php": "^8.0|^8.1",
"block-editor-custom-alignments/block-editor-custom-alignments": "*",
"composer/installers": "^2.2",
"gravityforms/gravityforms": "*",
"humanmade/s3-uploads": "^3.0",
Expand Down
34 changes: 2 additions & 32 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 phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- Update to the PHP version your production/local docker container runs on -->
<config name="testVersion" value="8.0" />
<!-- php -r 'echo PHP_VERSION_ID;' -->
<config name="php_version" value="70407" />
<config name="php_version" value="80118" />

<!-- Fix WordPress's terrible typing breaking PHPCS -->
<config name="minimum_supported_wp_version" value="6.0.2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function update_login_header(): void {
padding-top: 86px;
}
</style>',
$login_logo
esc_url( $login_logo )
);
}

Expand Down
10 changes: 2 additions & 8 deletions wp-content/plugins/core/src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ class Core {

public const PLUGIN_FILE = 'plugin.file';

/**
* @var \Psr\Container\ContainerInterface|\Invoker\InvokerInterface|\DI\FactoryInterface
*/
private $container;
private \Psr\Container\ContainerInterface|\Invoker\InvokerInterface|\DI\FactoryInterface $container;

/**
* @var string[] Names of classes implementing Definer_Interface.
Expand Down Expand Up @@ -56,10 +53,7 @@ public function init( string $plugin_path ): void {
$this->init_container( $plugin_path );
}

/**
* @return \Psr\Container\ContainerInterface|\Invoker\InvokerInterface|\DI\FactoryInterface
*/
public function container() {
public function container(): \Psr\Container\ContainerInterface|\Invoker\InvokerInterface|\DI\FactoryInterface {
return $this->container;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
$post_permalink = get_the_permalink();
?>

<div <?php echo get_block_wrapper_attributes(); ?>>
<div <?php echo wp_kses_data( get_block_wrapper_attributes() ); ?>>
<span class="wp-block-tribe-post-permalink__label"><?php esc_html_e( $post_permalink, 'tribe' ); ?></span>
</div>
8 changes: 4 additions & 4 deletions wp-content/themes/core/blocks/tribe/post-type-name/render.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php declare(strict_types=1);

// this gets us the post type, but we really want the name
$post_type = get_post_type();
$block_post_type = get_post_type();

if ( ! $post_type ) {
if ( ! $block_post_type ) {
return;
}

$post_object = get_post_type_object( $post_type );
$post_object = get_post_type_object( $block_post_type );

if ( ! $post_object ) {
return;
}
?>

<div <?php echo get_block_wrapper_attributes(); ?>>
<div <?php echo wp_kses_data( get_block_wrapper_attributes() ); ?>>
<span class="wp-block-tribe-post-type-name__label"><?php esc_html_e( $post_object->labels->singular_name, 'tribe' ); ?></span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
}
?>

<div <?php echo get_block_wrapper_attributes(); ?>>
<div <?php echo wp_kses_data( get_block_wrapper_attributes() ); ?>>
<p><?php echo wp_kses_post( $output ); ?></p>
</div>
20 changes: 10 additions & 10 deletions wp-content/themes/core/blocks/tribe/terms/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
* @var \WP_Block $block The instance of the WP_Block class that represents the block being rendered.
*/

$terms_block = new Terms_Block( $attributes );
$terms = $terms_block->get_the_terms();
$terms_block = new Terms_Block( $attributes );
$terms_block_terms = $terms_block->get_the_terms();

echo '<div ' . get_block_wrapper_attributes() . '>';
echo '<div ' . wp_kses_data( get_block_wrapper_attributes() ) . '>';

if ( 0 === count( $terms ) ) {
if ( 0 === count( $terms_block_terms ) ) {
echo '<!-- Terms block: No terms to list. -->';
echo '</div>';

return;
}

if ( count( $terms ) > 1 ) {
if ( count( $terms_block_terms ) > 1 ) {
echo '<ul class="wp-block-tribe-terms__list">';
}

foreach ( $terms as $term ) {
if ( count( $terms ) > 1 ) {
foreach ( $terms_block_terms as $term ) {
if ( count( $terms_block_terms ) > 1 ) {
echo '<li class="wp-block-tribe-terms__term">';
}

Expand All @@ -36,7 +36,7 @@
if ( $terms_block->display_as_links() ) {
echo sprintf(
'<a href="%s" class="wp-block-tribe-terms__link t-category">%s</a>',
esc_url( get_term_link( $term ) ),
esc_url( get_term_link( $term ) ?? '' ),
esc_html( $term->name )
);
} else {
Expand All @@ -48,12 +48,12 @@

echo '</span>';

if ( count( $terms ) > 1 ) { // phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed
if ( count( $terms_block_terms ) > 1 ) { // phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed
echo '</li>';
}
}

if ( count( $terms ) > 1 ) {
if ( count( $terms_block_terms ) > 1 ) {
echo '</ul>';
}

Expand Down