Issues (21)

SchemaValidator/XmlSchemaValidatorFactory.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiechu\SymfonyCommonsBundle\Service\SchemaValidator;
6
7
class XmlSchemaValidatorFactory extends AbstractSchemaValidatorFactory implements SchemaValidatorFactoryInterface
8
{
9
    /**
10
     * {@inheritdoc}
11
     */
12 2
    public function getValidator(string $id): SchemaValidatorInterface
13
    {
14 2
        $this->assertHasSchema($id);
15
16 2
        if (!$this->registeredSchemas[$id] instanceof XmlSchemaValidator) {
17 2
            $this->registeredSchemas[$id] = new XmlSchemaValidator($this->fileLocator->locate($this->registeredSchemas[$id]));
0 ignored issues
show
It seems like $this->fileLocator->loca...registeredSchemas[$id]) can also be of type array; however, parameter $schemaLocation of Spiechu\SymfonyCommonsBu...alidator::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

17
            $this->registeredSchemas[$id] = new XmlSchemaValidator(/** @scrutinizer ignore-type */ $this->fileLocator->locate($this->registeredSchemas[$id]));
Loading history...
18
        }
19
20 2
        return $this->registeredSchemas[$id];
21
    }
22
}
23