PHPCSStandards / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
805 stars 47 forks source link

File::find[Start|End]OfStatement(): add QA tests #509

Closed jrfnl closed 1 month ago

jrfnl commented 1 month ago

Description

Follow up on #502

File::findStartOfStatement(): fix some unintentional parse errors in the test case file

File::find[Start|End]OfStatement(): add QA tests

This commit adds two QA tests to find potential bugs in the File::find[Start|End]OfStatement() methods.

  1. It adds a test to ensure that the return value of File::findStartOfStatement() is never after the passed $start stack pointer.
  2. It adds a test to ensure that the return value of File::findEndOfStatement() is never before the passed $start stack pointer.

The tests use the existing test code, but tests all non-empty tokens within the file.

Note: this test doesn't test that the stack pointer returned is correct, only that it could be correct.

Suggested changelog entry

N/A