fix(framework): read one-line docblock vars in meta:view-component - #2299
Open
dereuromark wants to merge 2 commits into
Open
dereuromark wants to merge 2 commits into
dereuromark wants to merge 2 commits into
Conversation
The variable extractor only matched var tags on star-prefixed lines of a multiline docblock, so components declaring attributes in a one-line docblock (like the built-in `x-submit` does for `$label`) reported no variables. One-line docblocks directly followed by a plain assignment to the same variable, such as the `$formSession = get(...)` in `x-input`, type a local and stay excluded, so `x-input` does not suddenly list its services as attributes. Compound assignments such as `??=` keep the variable, since they are how components give an attribute a default.
Member
|
Could you take a look at the failing test? I assume it's something to do with line endings |
With /m, `$` matches before `\n` but not before `\r`, and neither the declaration class nor the trailing whitespace can consume a carriage return. On a CRLF checkout (Windows CI) no multiline var tag matched and every component reported an empty variable list.
Author
|
"5 workflows awaiting approval" |
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.
Fixes #2298
meta:view-componentonly picked up var tags on the star-prefixed lines of a multiline docblock. A one-line docblock was skipped, sox-submitreported no variables:/** @var null|string $label The submit button's label */The extractor now reads both forms.
x-submitlists$labelwith its description.One-line docblocks also type local variables, as in
x-input:A one-line var tag directly followed by a plain
=assignment to the same variable is treated as a local and left out, sox-inputdoesn't start listing$formSessionand$validatoras attributes. Compound assignments like??=still count as attributes, since that's how components set a default.