From e594d5b76a2b567bf9a0912c4cf44a6a80b42426 Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Thu, 29 Sep 2022 10:56:52 +0200 Subject: [PATCH] cs --- .../StandardDocumentationReader.php | 2 +- src/Schema/Element/ElementSingle.php | 2 +- src/Schema/Inheritance/Base.php | 2 +- src/Schema/Inheritance/Restriction.php | 2 +- src/Schema/Schema.php | 8 +++--- src/SchemaReader.php | 25 +++++++++---------- tests/FilesystemTest.php | 2 +- tests/RestrictionsTest.php | 20 +++++++-------- tests/TypesTest.php | 1 - 9 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/Documentation/StandardDocumentationReader.php b/src/Documentation/StandardDocumentationReader.php index efa3c44d..edef2aa1 100644 --- a/src/Documentation/StandardDocumentationReader.php +++ b/src/Documentation/StandardDocumentationReader.php @@ -23,7 +23,7 @@ public function get(DOMElement $node): string foreach ($childNode->childNodes as $subChildNode) { if ($subChildNode instanceof DOMElement && $subChildNode->localName == 'documentation') { if (!empty($doc)) { - $doc .= "\n" . ($subChildNode->nodeValue); + $doc .= "\n".($subChildNode->nodeValue); } else { $doc .= ($subChildNode->nodeValue); } diff --git a/src/Schema/Element/ElementSingle.php b/src/Schema/Element/ElementSingle.php index 9795b961..a53fd2b6 100644 --- a/src/Schema/Element/ElementSingle.php +++ b/src/Schema/Element/ElementSingle.php @@ -8,7 +8,7 @@ interface ElementSingle extends ElementItem, InterfaceSetMinMax, InterfaceSetDefault { - public function getType(): ? Type; + public function getType(): ?Type; public function isQualified(): bool; diff --git a/src/Schema/Inheritance/Base.php b/src/Schema/Inheritance/Base.php index 8d5c5d08..017bc003 100644 --- a/src/Schema/Inheritance/Base.php +++ b/src/Schema/Inheritance/Base.php @@ -13,7 +13,7 @@ abstract class Base */ protected $base; - public function getBase(): ? Type + public function getBase(): ?Type { return $this->base; } diff --git a/src/Schema/Inheritance/Restriction.php b/src/Schema/Inheritance/Restriction.php index 05d88593..b65cff6f 100644 --- a/src/Schema/Inheritance/Restriction.php +++ b/src/Schema/Inheritance/Restriction.php @@ -32,6 +32,6 @@ public function getChecks(): array */ public function getChecksByType(string $type): array { - return isset($this->checks[$type]) ? $this->checks[$type] : []; + return $this->checks[$type] ?? []; } } diff --git a/src/Schema/Schema.php b/src/Schema/Schema.php index 6d6283fc..2d4c55b8 100644 --- a/src/Schema/Schema.php +++ b/src/Schema/Schema.php @@ -24,7 +24,7 @@ protected function findSomethingNoThrow( string $name, string $namespace = null, array &$calling = [] - ): ? SchemaItem { + ): ?SchemaItem { $calling[spl_object_hash($this)] = true; $cid = "$getter, $name, $namespace"; @@ -64,7 +64,7 @@ protected function findSomethingNoThrowSchemas( string $name, string $namespace = null, array &$calling = [] - ): ? SchemaItem { + ): ?SchemaItem { foreach ($schemas as $childSchema) { if (!isset($calling[spl_object_hash($childSchema)])) { /** @@ -182,7 +182,7 @@ public function getTargetNamespace(): ?string return $this->targetNamespace; } - public function setTargetNamespace(? string $targetNamespace): void + public function setTargetNamespace(?string $targetNamespace): void { $this->targetNamespace = $targetNamespace; } @@ -318,7 +318,7 @@ public function getType(string $name): ?Type return null; } - public function getAttribute(string $name): ? AttributeItem + public function getAttribute(string $name): ?AttributeItem { if (isset($this->attributes[$name])) { return $this->attributes[$name]; diff --git a/src/SchemaReader.php b/src/SchemaReader.php index 6d42222c..d6e399a0 100644 --- a/src/SchemaReader.php +++ b/src/SchemaReader.php @@ -381,8 +381,8 @@ private function loadSequenceChildNode( ElementContainer $elementContainer, DOMElement $node, DOMElement $childNode, - ? int $max, - ? int $min = null + ?int $max, + ?int $min = null ): void { switch ($childNode->localName) { case 'sequence': @@ -419,8 +419,8 @@ private function loadSequenceChildNodeLoadElement( ElementContainer $elementContainer, DOMElement $node, DOMElement $childNode, - ? int $max, - ? int $min + ?int $max, + ?int $min ): void { if ($childNode->hasAttribute('ref')) { $elementDef = $this->findElement($elementContainer->getSchema(), $node, $childNode->getAttribute('ref')); @@ -915,7 +915,7 @@ private static function splitParts(DOMElement $node, string $typeName): array $prefix = null; $name = $typeName; if (strpos($typeName, ':') !== false) { - list($prefix, $name) = explode(':', $typeName); + [$prefix, $name] = explode(':', $typeName); } /** @@ -932,7 +932,7 @@ private static function splitParts(DOMElement $node, string $typeName): array private function findAttributeItem(Schema $schema, DOMElement $node, string $typeName): AttributeItem { - list($name, $namespace) = static::splitParts($node, $typeName); + [$name, $namespace] = static::splitParts($node, $typeName); /** * @var string|null $namespace @@ -953,7 +953,7 @@ private function findAttributeItem(Schema $schema, DOMElement $node, string $typ private function findAttributeGroup(Schema $schema, DOMElement $node, string $typeName): AttributeGroup { - list($name, $namespace) = static::splitParts($node, $typeName); + [$name, $namespace] = static::splitParts($node, $typeName); /** * @var string|null $namespace @@ -974,7 +974,7 @@ private function findAttributeGroup(Schema $schema, DOMElement $node, string $ty private function findElement(Schema $schema, DOMElement $node, string $typeName): ElementDef { - list($name, $namespace) = static::splitParts($node, $typeName); + [$name, $namespace] = static::splitParts($node, $typeName); /** * @var string|null $namespace @@ -990,7 +990,7 @@ private function findElement(Schema $schema, DOMElement $node, string $typeName) private function findGroup(Schema $schema, DOMElement $node, string $typeName): Group { - list($name, $namespace) = static::splitParts($node, $typeName); + [$name, $namespace] = static::splitParts($node, $typeName); /** * @var string|null $namespace @@ -1011,7 +1011,7 @@ private function findGroup(Schema $schema, DOMElement $node, string $typeName): private function findType(Schema $schema, DOMElement $node, string $typeName): SchemaItem { - list($name, $namespace) = static::splitParts($node, $typeName); + [$name, $namespace] = static::splitParts($node, $typeName); /** * @var string|null $namespace @@ -1165,9 +1165,8 @@ private function loadImportFresh( ): Closure { return function () use ($namespace, $schema, $file): void { $dom = $this->getDOM( - isset($this->knownLocationSchemas[$file]) - ? $this->knownLocationSchemas[$file] - : $file + $this->knownLocationSchemas[$file] + ?? $file ); $schemaNew = $this->createOrUseSchemaForNs($schema, $namespace); diff --git a/tests/FilesystemTest.php b/tests/FilesystemTest.php index ef6e77c4..78845a71 100644 --- a/tests/FilesystemTest.php +++ b/tests/FilesystemTest.php @@ -11,7 +11,7 @@ class FilesystemTest extends BaseTest * * Covers the issue described in {@link https://github.com/goetas/xsd-reader/pull/10 PR #10}. */ - public function testReferencedOnFileSystem_1() + public function testReferencedOnFileSystem1() { /* * Using vfsStream seems ideal, but currently seems to have an issue with directorypaths with a space in diff --git a/tests/RestrictionsTest.php b/tests/RestrictionsTest.php index 3782b727..962e0c39 100644 --- a/tests/RestrictionsTest.php +++ b/tests/RestrictionsTest.php @@ -12,7 +12,7 @@ class RestrictionsTest extends BaseTest /** * Test the correct detection an Enumeration-restriction. */ - public function testRestriction_1() + public function testRestriction1() { $schema = $this->reader->readString( ' @@ -52,7 +52,7 @@ public function testRestriction_1() /** * Test the correct detection a pattern-restriction. */ - public function testRestriction_2() + public function testRestriction2() { $schema = $this->reader->readString( ' @@ -87,7 +87,7 @@ public function testRestriction_2() /** * Test the correct detection a length-restriction. */ - public function testRestriction_3() + public function testRestriction3() { $schema = $this->reader->readString( ' @@ -122,7 +122,7 @@ public function testRestriction_3() /** * Test the correct detection a minLength- and maxLength-restriction. */ - public function testRestriction_4() + public function testRestriction4() { $schema = $this->reader->readString( ' @@ -164,7 +164,7 @@ public function testRestriction_4() /** * Test the correct detection a minInclusive- and maxInclusive-restriction. */ - public function testRestriction_5() + public function testRestriction5() { $schema = $this->reader->readString( ' @@ -206,7 +206,7 @@ public function testRestriction_5() /** * Test the correct detection a minExclusive- and maxExclusive-restriction. */ - public function testRestriction_6() + public function testRestriction6() { $schema = $this->reader->readString( ' @@ -248,7 +248,7 @@ public function testRestriction_6() /** * Test the correct detection a fractionDigits-restriction. */ - public function testRestriction_7() + public function testRestriction7() { $schema = $this->reader->readString( ' @@ -283,7 +283,7 @@ public function testRestriction_7() /** * Test the correct detection a totalDigits-restriction. */ - public function testRestriction_8() + public function testRestriction8() { $schema = $this->reader->readString( ' @@ -318,7 +318,7 @@ public function testRestriction_8() /** * Test the correct detection a totalDigits- and fractionDigits-restriction. */ - public function testRestriction_9() + public function testRestriction9() { $schema = $this->reader->readString( ' @@ -360,7 +360,7 @@ public function testRestriction_9() /** * Test the correct detection a whiteSpace-restriction. */ - public function testRestriction_10() + public function testRestriction10() { $schema = $this->reader->readString( ' diff --git a/tests/TypesTest.php b/tests/TypesTest.php index 4211de55..0d8bab8b 100644 --- a/tests/TypesTest.php +++ b/tests/TypesTest.php @@ -199,7 +199,6 @@ public function getMaxOccurencesOverride() ]; } - public function getMinOccurences() { return [