Skip to content

Register LaravelPresenceResolver in services.neon - #383

Merged
TomasVotruba merged 1 commit into
symplify:mainfrom
stchrTIO:register-laravel-presence-resolver-in-services
Oct 28, 2026
Merged

TomasVotruba merged 1 commit into
symplify:mainfrom
stchrTIO:register-laravel-presence-resolver-in-services

Conversation

@stchrTIO

Copy link
Copy Markdown
Contributor

LaravelPresenceResolver (#331) is only registered in config/symfony-rules.neon, but several rules need it in their constructor, e.g. NoConstructorAndRequiredTogetherRule, NoListenerWithoutContractRule, NoServiceJugglingRule and NoNullableServiceInConstructorRule.

A project that registers rules one by one and includes only config/services/services.neon (instead of the whole sets) fails with:

Service of type Symplify\PHPStanRules\NodeAnalyzer\LaravelPresenceResolver required by NoConstructorAndRequiredTogetherRule::__construct() not found.

Registering it in the project config is no workaround: it fails with "Multiple services of type ... found" once the service is in services.neon.

This PR moves the registration to config/services/services.neon, next to the other shared services. Setups using the extension installer load both files, so nothing changes for them. A test checks that services.neon alone provides the service.

ComposerRequireResolver (#380) in symfony-rules.neon is the same kind of case, but it's only used by CommandMustHaveAsCommandAttributeRule and its test registers it with its own workingDirectory, so I left it out of this PR.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomasVotruba
TomasVotruba enabled auto-merge (squash) October 28, 2026 15:54
@TomasVotruba

Copy link
Copy Markdown
Member

Makes sense, thank you Simon 👍

@TomasVotruba
TomasVotruba disabled auto-merge October 28, 2026 15:55
@TomasVotruba
TomasVotruba merged commit c402ae5 into symplify:main Oct 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants