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: tests/phpunit/logging/ActionScheduler_wpCommentLogger_Test.php #1189

Conversation

crstauf
Copy link
Contributor

@crstauf crstauf commented Oct 4, 2024

No description provided.

@crstauf
Copy link
Contributor Author

crstauf commented Oct 4, 2024

@barryhughes Check failure is because of Composer: please re-run.

@@ -1,10 +1,13 @@
<?php
// phpcs:disable WordPress.PHP.StrictInArray.MissingTrueStrict
Copy link
Member

Choose a reason for hiding this comment

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

On first glance, the in_array calls look like they could be made strict, which I think would be preferred over disabling this check for the entire class (or did you find any problems with that)?

Copy link
Contributor Author

@crstauf crstauf Oct 9, 2024

Choose a reason for hiding this comment

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

Making them strict caused the tests to fail. The tests seems to be checking that numeric strings work, so need to ignore that sniff in this case.

You can see that by reviewing the checks on commit f97745b.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, then I think it still makes more sense to apply the exceptions line-by-line (or, enabling and disabling for blocks of lines like here, where we have three in_array() calls in a row), rather than excluding the entire file.

This is principally because if at some future point we add additional tests or assertions in this file, we will want to flag any non-strict in_array() checks.

@crstauf
Copy link
Contributor Author

crstauf commented Oct 23, 2024

@barryhughes PHPUnit setup failure...?

@barryhughes barryhughes merged commit d4e5dac into woocommerce:trunk Oct 30, 2024
34 checks passed
@crstauf crstauf deleted the phpcs/ActionScheduler_wpCommentLogger_Test.php branch October 30, 2024 23:55
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