Using
use PHPUnit\Framework\Error\Notice; [...] $this->expectException( Notice::class );
in tests gets deprecated in phpunit 9 - https://thephp.cc/news/2020/02/migrating-to-phpunit-9 - and should be replaced with:
$this->expectNotice();
which is already available with at least phpunit 8.5
Some places to do:
https://codesearch.wmcloud.org/search/?q=PHPUnit%5C%5CFramework%5C%5CError&i=nope&files=&repos=