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

Static analysis fixes for block theme #269

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Conversation

darylldoyle
Copy link
Collaborator

Description of the Change

This PR fixes any static analysis violations in the block theme.

How to test the Change

Test the theme out

Changelog Entry

Fixed - Static analysis violations in the block theme.

Credits

Props @darylldoyle

Checklist:

@darylldoyle darylldoyle self-assigned this Jan 20, 2025
@@ -21,3 +21,11 @@
define( 'TENUP_THEME_DIST_URL', TENUP_THEME_TEMPLATE_URL . '/dist/' );
define( 'TENUP_THEME_INC', TENUP_THEME_PATH . 'includes/' );
define( 'TENUP_THEME_BLOCK_DIR', TENUP_THEME_INC . 'blocks/' );

define( 'TENUP_BLOCK_THEME_VERSION', '1.0.0' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally left this one out as it doesn't do anything and we have the version in the style.css file that actually controls caching

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have this defined in the theme, see: https://github.com/10up/wp-scaffold/blob/trunk/themes/10up-block-theme/functions.php#L9

All custom consts should also be defined here since this is how PHPStan knows about them. If you remove from the theme, feel free to also remove from here.

Comment on lines +26 to +31
define( 'TENUP_BLOCK_THEME_TEMPLATE_URL', '' );
define( 'TENUP_BLOCK_THEME_PATH', '/' );
define( 'TENUP_BLOCK_THEME_DIST_PATH', TENUP_BLOCK_THEME_PATH . 'dist/' );
define( 'TENUP_BLOCK_THEME_DIST_URL', TENUP_BLOCK_THEME_TEMPLATE_URL . '/dist/' );
define( 'TENUP_BLOCK_THEME_INC', TENUP_BLOCK_THEME_PATH . 'includes/' );
define( 'TENUP_BLOCK_THEME_BLOCK_DIST_DIR', TENUP_BLOCK_THEME_DIST_PATH . '/blocks/' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all already defined above 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ones above are TENUP_THEME_* and these are TENUP_BLOCK_THEME_*. This file is use by PHPStan to know what custom constants exist, so needs to be 1:1 with what we have in the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 I didn't reallize we were in a separate file here... 🤦

@darylldoyle darylldoyle merged commit 1bac75d into trunk Jan 20, 2025
7 checks passed
@darylldoyle darylldoyle deleted the update/static-fixes branch January 20, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants