public function validate(): Schema
    {
        $errors = $this->schemaValidator->validateMapping();
        if (!empty($errors)) {
            $allMetaData = $this->getAllMetaData();
            $mappingPath = __DIR__ . '/../../var/doctrineMapping.ser';
            file_put_contents($mappingPath, print_r($allMetaData, true));
            throw new DoctrineStaticMetaException(
                'Found errors in Doctrine mapping, mapping has been dumped to ' . $mappingPath . "\n\n" . print_r(
                    $errors,
                    true
                )
            );
        }

        return $this;
    }