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

Form Post: Fix PHPStan and PHPCS issues. #81

Merged

Conversation

cbravobernal
Copy link
Contributor

@cbravobernal cbravobernal commented Mar 13, 2025

What

Part of #67

Refactor form-post.php file to follow PHPCS standards and PHPStan issues. I did manual testing and everything seems to be ok, but I would feel more comfortable if we plan some kind of unit or e2e testing.

The riskiest change is removing $postarr from wp_insert_post_empty_content. However the variable is not being used inside the function.

@@ -13,3 +13,6 @@

// Load our plugin.
require dirname( dirname( __DIR__ ) ) . '/secure-custom-fields.php';

// Load the ACF_Form_Post class.
require dirname( dirname( __DIR__ ) ) . '/includes/forms/form-post.php';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you share your thought on adding it to the main bootstrap? My first thought without digging into anything would be to have this require within the test-form-post.php file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I required the file on the test one, as you mentioned. Honestly, I'm not 100% sure of the best approach for these unit tests. Let's see in the future for functions that require several files.

@kraftbj kraftbj added this to the 6.5.0 milestone Mar 14, 2025
@kraftbj kraftbj merged commit be5c1d9 into WordPress:trunk Mar 15, 2025
4 checks passed
@cbravobernal cbravobernal deleted the refactor/phpstan-includes-forms-form-post branch March 16, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants