Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
Closed
Description
Symfony version(s) affected
6.4.3
Description
marking anyreadonly
class as a lazy service results in an error.
the bug seems not on symfony side, but on (#53843 (comment))
https://github.com/FriendsOfPHP/proxy-manager-lts
side, as it does not count for readonly classes while creating proxies.
How to reproduce
- create
readonly
class
<?phpnamespaceApp;readonlyclass TestService{publicfunctionfoo():string {return'bar'; }}
- mark it as lazy
services:App\TestService:lazy:true
- inject it anywhere, e.g. in controller
<?phpnamespaceApp\Controller;useApp\TestService;useSymfony\Component\Routing\Attribute\Route;class TestController{ #[Route(path:'/test') publicfunction __invoke(TestService$service): Response {returnnew Response($service->foo()); }}
- result is error
Compile Error: Non-readonly class ContainerBh60GB2\TestServiceGhost93bb697 cannot extend readonly class App\TestService
Possible Solution
No response
Additional Context
No response