Skip to content

NewExceptionsFromToString: 2 bugfixes + 1 enhancement#880

Merged
wimg merged 3 commits intomasterfrom
feature/863-newexceptionsfromtostring-bugfix-enhancement
Aug 28, 2019
Merged

NewExceptionsFromToString: 2 bugfixes + 1 enhancement#880
wimg merged 3 commits intomasterfrom
feature/863-newexceptionsfromtostring-bugfix-enhancement

Conversation

@jrfnl
Copy link
Copy Markdown
Member

@jrfnl jrfnl commented Aug 21, 2019

NewExceptionsFromToString: property should not be public

The $ooScopeTokens property is not intended to be set via a custom ruleset, so the property should never have been public.

NewExceptionsFromToString: ignore caught exceptions

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.

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 throw keyword didn't yield any errors.


Fixes #863

Related to #808

jrfnl added 3 commits August 21, 2019 19:48
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 wimg merged commit 18fc5eb into master Aug 28, 2019
@delete-merged-branch delete-merged-branch bot deleted the feature/863-newexceptionsfromtostring-bugfix-enhancement branch August 28, 2019 14:32
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