Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SchemaDetector.php

function SchemaDetector::detect

Throws

XmlException

File

vendor/phpunit/phpunit/src/TextUI/Configuration/Xml/SchemaDetector/SchemaDetector.php, line 25

Class

SchemaDetector
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\TextUI\XmlConfiguration

Code

public function detect(string $filename) : SchemaDetectionResult {
    $document = (new Loader())->loadFile($filename);
    $schemaFinder = new SchemaFinder();
    foreach ($schemaFinder->available() as $candidate) {
        $schema = (new SchemaFinder())->find($candidate);
        if (!(new Validator())->validate($document, $schema)
            ->hasValidationErrors()) {
            return new SuccessfulSchemaDetectionResult($candidate);
        }
    }
    return new FailedSchemaDetectionResult();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal