Skip to content

[Toolkit] Document Stimulus controller CSS classes and outlets in the API reference - #3733

Merged
Kocal merged 1 commit into
symfony:3.xfrom
kbond:toolkit-stimulus-class-docs
Jul 30, 2026
Merged

[Toolkit] Document Stimulus controller CSS classes and outlets in the API reference#3733
Kocal merged 1 commit into
symfony:3.xfrom
kbond:toolkit-stimulus-class-docs

Conversation

@kbond

@kbond kbond commented Jul 26, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

Documents a Stimulus controller's static classes and static outlets in the recipe API reference from @css-class and @outlet docblock tags — rendered as Class and Outlet tables and linted both ways like @value/@target/@action. This rounds out the full controller surface: values, targets, classes, outlets and actions.

The class tag is spelled @css-class rather than @class to avoid clashing with JSDoc's @class.

@kbond
kbond requested a review from Kocal as a code owner July 26, 2026 01:50
@carsonbot carsonbot added Feature New Feature Toolkit Status: Needs Review Needs to be reviewed labels Jul 26, 2026
@kbond
kbond force-pushed the toolkit-stimulus-class-docs branch from 3562148 to e56cef5 Compare July 29, 2026 12:20
public function __construct(
public readonly string $name,
public readonly string $attribute,
public readonly string $description,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe optional ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this, it should be in a follow-up PR that makes the change for all.

public function isEmpty(): bool
{
return [] === $this->values && [] === $this->targets && [] === $this->actions;
return [] === $this->values && [] === $this->targets && [] === $this->classes && [] === $this->actions;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return [] === $this->values && [] === $this->targets && [] === $this->classes && [] === $this->actions;
return [] === $this->actions && [] === $this->values && [] === $this->targets && [] === $this->classes;

Nitpicking but according to my inner voice, this should relate more to the probabilities

@smnandre smnandre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuine question: no outlets for now ?

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Jul 29, 2026
@kbond

kbond commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

outlets

What do you mean? If you mean usages, not yet but I use it in #3740. Oh, you meant stimulus outlets 🤦🏻‍♂️. No, I thought I'd wait until needed. But maybe it should be added here...?

… API reference

Parse `static classes`/`static outlets` and `@css-class`/`@outlet` docblock tags alongside
values/targets/actions, render them as Class and Outlet tables in the recipe API reference,
and lint the tags against the declarations with `StimulusControllerDocChecker`.
@kbond
kbond force-pushed the toolkit-stimulus-class-docs branch from e56cef5 to 5b096f0 Compare July 29, 2026 20:32
@kbond kbond changed the title [Toolkit] Document Stimulus controller CSS classes in the API reference [Toolkit] Document Stimulus controller CSS classes and outlets in the API reference Jul 29, 2026
@kbond

kbond commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

I just pushed support for @outlet.

@Kocal

Kocal commented Jul 30, 2026

Copy link
Copy Markdown
Member

Thank you @kbond.

@Kocal
Kocal merged commit a5c09c3 into symfony:3.x Jul 30, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New Feature Status: Reviewed Has been reviewed by a maintainer Toolkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants