Skip to content

Commit

Permalink
Improve name (and work around theseer/Autoload#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 5, 2024
1 parent 8c7ccf6 commit aaea827
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
final readonly class UpdateSchemaLocation implements Migration
{
private const NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance';
private const NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema-instance';
private const LOCAL_NAME_SCHEMA_LOCATION = 'noNamespaceSchemaLocation';

public function migrate(DOMDocument $document): void
Expand All @@ -31,14 +31,14 @@ public function migrate(DOMDocument $document): void

assert($root instanceof DOMElement);

$existingSchemaLocation = $root->getAttributeNodeNS(self::NAMESPACE, self::LOCAL_NAME_SCHEMA_LOCATION)->value;
$existingSchemaLocation = $root->getAttributeNodeNS(self::NAMESPACE_URI, self::LOCAL_NAME_SCHEMA_LOCATION)->value;

if (str_contains($existingSchemaLocation, '://') === false) { // If the current schema location is a relative path, don't update it
return;
}

$root->setAttributeNS(
self::NAMESPACE,
self::NAMESPACE_URI,
'xsi:' . self::LOCAL_NAME_SCHEMA_LOCATION,
'https://schema.phpunit.de/' . Version::series() . '/phpunit.xsd',
);
Expand Down

0 comments on commit aaea827

Please sign in to comment.