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

Universal/SeparateFunctionsFromOO: simplify skipping the rest of the file #322

Merged
merged 1 commit into from
Nov 9, 2024

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 9, 2024

This commit updates the sniff to use return $phpcsFile->numTokens instead of return ($phpcsFile->numTokens + 1).

If a sniff file contains 50 tokens, the last $stackPtr will be 49, so returning 50 will already get us passed the end of the token stack and the + 1 is redundant.

Includes minor fix to the return type as the method never returns void.

…file

This commit updates the sniff to use `return $phpcsFile->numTokens` instead of `return ($phpcsFile->numTokens + 1)`.

If a sniff file contains 50 tokens, the last `$stackPtr` will be 49, so returning `50` will already get us passed the end of the token stack and the `+ 1` is redundant.

Includes minor fix to the return type as the method never returns `void`.
@jrfnl jrfnl added this to the 1.2.x Next milestone Nov 9, 2024
@jrfnl jrfnl merged commit de21892 into develop Nov 9, 2024
43 checks passed
@jrfnl jrfnl deleted the feature/universal-separatefunctionsfromoo-minor-fix branch November 9, 2024 00:19
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.

1 participant