Repository navigation
fix: check aliased use imports and multi-catch types, treat third-party namespaces as external - #1106
Open
rootsiemen wants to merge 1 commit into
Open
rootsiemen wants to merge 1 commit into
rootsiemen wants to merge 1 commit into
Conversation
… namespaces as external Closes crazy-goat#1105
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.
Closes #1105
Problem
bin/check-upgrade-exceptions.php(from #1045) had three gaps:use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;line was reported as undeclared.use X as Y;alias form and the second and later types of a multi-catch (catch (A | B $e)) — a wrong name there passed the gate.bin/README.mdand the CHANGELOG entry said inline code spans are matched "fence-aware", which does not say what the code does.Fix
checkUpgradeExceptionsAddNamedType()now treats a name as external when its namespace is notCrazyGoat\WorkermanBundle\...(third-party and global types, with or without a leading backslash). A fully qualified bundle name is checked like a short one; a leading-backslash name with no namespace is still a global type and is skipped.useregex now allows an optionalas Aliasafter the type, so the imported type (not the alias) is checked.catchclauses are now captured whole and every type inside is recorded, so all multi-catch positions are checked.bin/README.mdand the [Docs] UPGRADE.md Before/After exception table is unchecked by the tree gate #1045 CHANGELOG wording now say exactly what the code does: inline spans match only when their backticks are not adjacent to another backtick, so a fenced block's closing fence cannot pair with an inline span.Tests
testThirdPartyQualifiedNamesAndAliasesAreExternal: aliased Symfony import, multi-catch second type and backtick prose mention all pass the gate.testAliasedUndeclaredBundleTypeFails: an aliasedCrazyGoat\WorkermanBundle\Exception\GhostExceptionimport fails the gate.testMultiCatchSecondTypeIsChecked: an undeclared second multi-catch type fails the gate.testProseAndExampleNamingAnUndeclaredTypeFailsstill passes: itsuse Vendor\Package\GhostException;line is now external, but its prose backtick and barecatch (GhostException $e)still trigger the failure.Note: this environment has no PHP runtime, so the PHPUnit suite could not be run here — the change is small and follows the existing patterns, and CI's lint/test jobs are the verification step. Please let me know if CI flags anything.