Tempest version
3.19.2
PHP version
8.5
Operating system
Linux
Description
While working on a Carve markup integration for Tempest:
tempest meta:view-component only reports @var declarations when the tag is
on a star-prefixed line inside a multiline PHPDoc block. A valid one-line
PHPDoc declaration is silently omitted.
This affects Tempest's built-in x-submit component, whose $label declaration
uses the one-line form.
Reproduction
With Tempest Framework 3.19.2 and PHP 8.5.10:
composer create-project tempest/app tempest-meta-repro
cd tempest-meta-repro
php tempest meta:view-component x-submit
Actual output:
{
"name": "x-submit",
"slots": [],
"variables": []
}
The component contains:
/** @var null|string $label The submit button's label */
Changing it to the multiline form makes the variable appear:
/**
* @var null|string $label The submit button's label
*/
Expected behavior
Both conventional PHPDoc forms should expose the same variable metadata. For
x-submit, the metadata should include $label with the label attribute
name.
Likely cause
MetaViewComponentCommand::resolveVariables() matches only lines beginning
with an optional indent followed by * @var:
->matchAll('/^\s*\*\s*@var.*$/m')
That pattern cannot match /** @var ... */.
Possible fix
Parse both one-line and multiline PHPDoc tags, ideally without making the
metadata extractor depend on a particular comment layout.
Tempest version
3.19.2
PHP version
8.5
Operating system
Linux
Description
While working on a Carve markup integration for Tempest:
tempest meta:view-componentonly reports@vardeclarations when the tag ison a star-prefixed line inside a multiline PHPDoc block. A valid one-line
PHPDoc declaration is silently omitted.
This affects Tempest's built-in
x-submitcomponent, whose$labeldeclarationuses the one-line form.
Reproduction
With Tempest Framework 3.19.2 and PHP 8.5.10:
composer create-project tempest/app tempest-meta-repro cd tempest-meta-repro php tempest meta:view-component x-submitActual output:
{ "name": "x-submit", "slots": [], "variables": [] }The component contains:
/** @var null|string $label The submit button's label */Changing it to the multiline form makes the variable appear:
Expected behavior
Both conventional PHPDoc forms should expose the same variable metadata. For
x-submit, the metadata should include$labelwith thelabelattributename.
Likely cause
MetaViewComponentCommand::resolveVariables()matches only lines beginningwith an optional indent followed by
* @var:That pattern cannot match
/** @var ... */.Possible fix
Parse both one-line and multiline PHPDoc tags, ideally without making the
metadata extractor depend on a particular comment layout.