NewExceptionsFromToString: 2 bugfixes + 1 enhancement#880
Merged
Conversation
This property is not intended to be set via a custom ruleset, so the property should never have been `public`.
When an exception is thrown within a `try/catch` block, ignore it. This changes the sniff, in that previously only one error per method would be thrown. Now, an error will be thrown for each `throw` tag not in a `try/catch`. Fixes 863
This adds an additional check based on the docblock to attempt to catch exceptions thrown indirectly from this method. If the docblock indicates that the function may throw an exception, trust it. The additional check will only be run if search for the `throw` keyword didn't yield any errors. Fixes 863
wimg
approved these changes
Aug 28, 2019
40 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NewExceptionsFromToString: property should not be public
The
$ooScopeTokensproperty is not intended to be set via a custom ruleset, so the property should never have beenpublic.NewExceptionsFromToString: ignore caught exceptions
When an exception is thrown within a
try/catchblock, ignore it.This changes the sniff, in that previously only one error per method would be thrown. Now, an error will be thrown for each
throwtag not in atry/catch.NewExceptionsFromToString: detect thrown exceptions from docblock
This adds an additional check based on the docblock to attempt to catch exceptions thrown indirectly from this method.
If the docblock indicates that the function may throw an exception, trust it.
The additional check will only be run if the search for the
throwkeyword didn't yield any errors.Fixes #863
Related to #808