The expression return $this->container-...lBundleMetaData::class) could return the type null which is incompatible with the type-hinted return Zikula\CoreBundle\Bundle...BundleMetaDataInterface. Consider adding an additional type-check to rule them out.