Problem Description: I upgraded a TYPO3 project to version 12 and I am getting the error below
Cannot autowire service "TYPO3\CMS\Core\Routing\PageArguments": argument "$pageId" of method "__construct()" is type-hinted "int", you should configure its value explicitly.
As the class concerned is a TYPO3 core class, I have no clue of what is causing this error.
What I have tried: The error occurs due to the installation of a specific extension. I have already used the Extension Scanner in the Install Tool to find and update deprecated code in this extension.
Currently I am testing the frontend of the website to find and fix errors, then I encountered this problem.
What I expect to happen: The website loads without the error above.
I'll really appreciate any tipps on what may be causing this issue.
Thanks
Update
As you can read here, the TyposcriptFrontendController is not available anymore as a Service, that can be injected. So you might be able to identify the issue in your project by finding the class, that expects this type as a constructor argument or injector Method argument.
ripgrep example for constructor injection
This could find your problem but the expression is not good enough to take linebreaks in the constructors argument list into account, so there might be blind spots.
ripgrep example for injection method
Same limitation here
I hope you can find the problem in your code.
To fix the problem, you need to remove the injection for the frontend controller and access it in another way. You can access it via the ContentObjectRenderer, the ServerRequest or as a last resort via the global variable $GLOBALS['TSFE']. In most cases you do have access to something...
Original Answer
In my case it was the "autowiring" of a class, that expected the TyposcriptFrontendController to be injected as a constructor argument.
I ended up using the following Configuration (package/Configuration/Services.yaml)
With this approach you can enable/disable the autowiring per class. Instead of injecting the TyposcriptFrontendController i retrieve it from the ServerRequest Attribute (frontend.controller).
Something must have changed from V11 to V12
I advice you to have a look at the Services.yaml/Services.php file of your local site package.
Here you can find the full documentation:
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/DependencyInjection/Index.html
Fixed for V12:
https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/DependencyInjection/Index.html