Repository navigation
Type the identifiers of collected too-wide and missing return type errors as literals - #7296
Open
ondrejmirtes wants to merge 1 commit into
Open
ondrejmirtes wants to merge 1 commit into
ondrejmirtes wants to merge 1 commit into
Conversation
…rors as literals The identifier extractor in phpstan/phpstan reads the identifier passed to RuleErrorBuilder::identifier() as constant strings. The errors that MissingReturnTypeFixRule and TooWideTypeInOverridableMemberRule report from collected data, and the ones the missing return type rules build from their lists of errors, carried the identifier typed as string, so the extraction of phpstan-src failed with "Unknown identifier". Amp-Thread-ID: https://ampcode.com/threads/T-01a19770-5331-74b2-963f-e324ae0f7635
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.
The Extract identifiers workflow in phpstan/phpstan has been failing for the
phpstan-srcmatrix entry since PHAR 89cdfaa (89cdfaa, the--fix/projectTypeseries). The latest failure is https://github.com/phpstan/phpstan/actions/runs/47061675055:The extractor's
RuleErrorBuilderCollectorrequires the argument ofRuleErrorBuilder::identifier()to be constant strings. These rules pass identifiers they carry inarray{string, string, string|null}tuples (message, identifier, tip), or read them back from collected data:MissingImplementedMethodReturnTypehintRule::buildError()/processFixableErrors()MissingFunctionReturnTypehintRuleMissingReturnTypeFixRule, throughMissingReturnTypeCollectorTooWideTypeInOverridableMemberRule, throughTooWideTypeInOverridableMemberCollector,OverridableMemberHelper,TooWideTypeCheck,TooWideParameterOutTypeCheck, andTooWideMethodReturnTypehintRuleThis follows ac37f68 and changes PHPDoc only. The identifiers are typed as the literals the rules actually produce:
'missingType.return'|'missingType.iterableValue'.MemberErrortype alias inTooWideTypeCheckwith{return,paramOut,parameterByRef}.{tooWideBool,unusedType}andthrows.unusedType(from the throw type rules that also callemitDeclaration()).Verified locally:
identifier-extractor/extractor.neon) on this branch completes with valid JSON. Before the change, it stopped with "Unknown identifier" at each of these files in turn.bin/phpstan analyseof the whole project reports no errors.