Skip to content

Conversation

rodrigoprimo
Copy link
Contributor

@rodrigoprimo rodrigoprimo commented Oct 21, 2024

Description

This PR improves code coverage for the Generic.PHP.DisallowShortOpenTag sniff.

Related issues/external references

Part of #146

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
    • This change is only breaking for integrators, not for external standards or end-users.
  • Documentation improvement

PR checklist

  • I have checked there is no other PR open for the same change.
  • I have read the Contribution Guidelines.
  • I grant the project the right to include and distribute the code under the BSD-3-Clause license (and I have the right to grant these rights).
  • I have added tests to cover my changes.
  • I have verified that the code complies with the projects coding standards.
  • [Required for new sniffs] I have added XML documentation for the sniff.

@rodrigoprimo
Copy link
Contributor Author

rodrigoprimo commented Oct 25, 2024

@jrfnl, while checking your suggestion for the snippet clipping test (#638 (comment)), I noticed that the test to ensure that close tags are recognized as such only if placed after the open tag needs to be the last test on the file, as there should be no close tag after the open tag:

// Only recognize closing tag after opener.
Some?> content <?

I wonder if we should indicate that in the code comment above it or if this test should be moved to its own file?

@jrfnl
Copy link
Member

jrfnl commented Oct 25, 2024

I wonder if we should indicate that in the code comment above it or if this test should be moved to its own file?

Adding a code comment would be good. As it's not a parse error, I don't think this needs a separate test file.

@rodrigoprimo
Copy link
Contributor Author

Ok, I just added a comment documenting that the test must be the last one in the file.

@jrfnl jrfnl added this to the 3.11.0 milestone Oct 25, 2024
Copy link
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

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

:shipit:

@jrfnl jrfnl merged commit 3ba1aff into PHPCSStandards:master Oct 25, 2024
41 checks passed
@jrfnl jrfnl deleted the test-coverage-disallow-short-open-tag branch October 25, 2024 20:10
jrfnl pushed a commit that referenced this pull request Oct 25, 2024
* Add extra tests to improve code coverage
* Add comment to last test in case file 3 to clarify that it must be the last in the file.
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