Error with thumb() method in File class for Virtual files

I’d like to switch one of my playground projects from Kirby 3 to 4 but get this error:

Whoops\Exception\ErrorException thrown with message "Declaration of CdnFile::thumb($options = null) must be compatible with Kirby\Cms\File::thumb(array|string|null $options = null): Kirby\Cms\FileVersion|Kirby\Cms\File|Kirby\Filesystem\Asset"

I am using a custom File class CdnFile according to this Cookbook:

...
public function thumb($options = null)
  {
    return $this;
  }
...

Any hints what iI need to change here?

Thank you!!

The signature has changed (type hint added), so you need to changes this in your method as well

Sorry, but how do I need to change it?

public function thumb(array|string|null $options = null): Kirby\Cms\FileVersion|Kirby\Cms\File|Kirby\Filesystem\Asset) {}

Kirby 4 adds a lot of type hints where there were none in Kirby 3, so you will likely get some of these errors. If you extends a method in a child class (page model, file model etc.), then you need to make sure that the signatures of the methods match (number and type of arguments, return types).