C2paSignSubscriber type hint breaks every page on Drupal 10
Part of #3596034 (closed).
Problem/motivation
Since #3589403 (closed), C2paSignSubscriber::__construct() types $fileMimeTypeGuesser as Drupal\Core\File\MimeType\MimeTypeGuesser. On Drupal 10 file.mime_type.guesser is a lazy service, so the container passes its proxy class and every request returns 500. The previous hint, the proxy class, fails on Drupal 11, where the service is not lazy.
Steps to reproduce
- Install c2pa_sign 1.4.11 on Drupal 10.6.18.
- Open
/user/login. It returns 500:
TypeError: Drupal\c2pa_sign\EventSubscriber\C2paSignSubscriber::__construct(): Argument #1 ($fileMimeTypeGuesser) must be of type Drupal\Core\File\MimeType\MimeTypeGuesser, Drupal\Core\ProxyClass\File\MimeType\MimeTypeGuesser givenProposed resolution
Type the argument and the property as Symfony\Component\Mime\MimeTypeGuesserInterface. The proxy and the real class both implement it. $time gets TimeInterface too, so a decorated datetime.time service cannot fail the same way. With that change the same site returns 200. The new derivative test in #3596043 (closed) fails on Drupal 10 without this change.
AI Compliance
🤖 Generated with the help of an LLM, reviewed and approved by me before posting.