'Supress all #[\ReturnTypeWillChange]

I am using old library that throw the following error

Return type of ... should either be compatible with ..., or #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

My code still works of course, because it isn't really an error and is just a depreciation notice (read: https://php.watch/versions/8.1/ReturnTypeWillChange)

I placed #[\ReturnTypeWillChange] in my code and it supressed the error coming from my code. However, the old library i am using still throws this error and i cant find a good way to suppress it. I could place the #[\ReturnTypeWillChange] in all necessary place in the code in the library, however the library is mass installed through composer in a lot of computer, i just cant find a fast way to place #[\ReturnTypeWillChange] in all computer !!!

Is there any way to force php to shut up about the ReturnTypeWillChange error coming from a specific library ??



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source