diff options
Diffstat (limited to 'server/vendor/php-opencloud/common/src/Common/JsonSchema')
| -rw-r--r-- | server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php | 18 | ||||
| -rw-r--r-- | server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php | 15 |
2 files changed, 19 insertions, 14 deletions
diff --git a/server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php b/server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php index 2c12ec0..74d2a78 100644 --- a/server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php +++ b/server/vendor/php-opencloud/common/src/Common/JsonSchema/JsonPatch.php @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types=1); namespace OpenCloud\Common\JsonSchema; @@ -13,7 +13,7 @@ class JsonPatch return (new static)->makeDiff($src, $dest); } - public function makeDiff($srcStruct, $desStruct, $path = '') + public function makeDiff($srcStruct, $desStruct, string $path = ''): array { $changes = []; @@ -28,7 +28,7 @@ class JsonPatch return $changes; } - protected function handleArray($srcStruct, $desStruct, $path) + protected function handleArray(array $srcStruct, array $desStruct, string $path): array { $changes = []; @@ -53,7 +53,7 @@ class JsonPatch return $changes; } - protected function handleObject($srcStruct, $desStruct, $path) + protected function handleObject(\stdClass $srcStruct, \stdClass $desStruct, string $path): array { $changes = []; @@ -76,12 +76,12 @@ class JsonPatch return $changes; } - protected function shouldPartiallyReplace($o1, $o2) + protected function shouldPartiallyReplace(\stdClass $o1, \stdClass $o2): bool { return count(array_diff_key((array) $o1, (array) $o2)) < count($o1); } - protected function arrayDiff(array $a1, array $a2) + protected function arrayDiff(array $a1, array $a2): array { $result = []; @@ -94,8 +94,10 @@ class JsonPatch return $result; } - protected function path($root, $path) + protected function path(string $root, $path): string { + $path = (string) $path; + if ($path === '_empty_') { $path = ''; } @@ -103,7 +105,7 @@ class JsonPatch return rtrim($root, '/') . '/' . ltrim($path, '/'); } - protected function makePatch($op, $path, $val = null) + protected function makePatch(string $op, string $path, $val = null): array { switch ($op) { default: diff --git a/server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php b/server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php index a1cd380..e1e3f65 100644 --- a/server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php +++ b/server/vendor/php-opencloud/common/src/Common/JsonSchema/Schema.php @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types=1); namespace OpenCloud\Common\JsonSchema; @@ -6,7 +6,10 @@ use JsonSchema\Validator; class Schema { + /** @var object */ private $body; + + /** @var Validator */ private $validator; public function __construct($body, Validator $validator = null) @@ -15,7 +18,7 @@ class Schema $this->validator = $validator ?: new Validator(); } - public function getPropertyPaths() + public function getPropertyPaths(): array { $paths = []; @@ -26,7 +29,7 @@ class Schema return $paths; } - public function normalizeObject($subject, array $aliases) + public function normalizeObject($subject, array $aliases): \stdClass { $out = new \stdClass; @@ -49,17 +52,17 @@ class Schema $this->validator->check($data, $this->body); } - public function isValid() + public function isValid(): bool { return $this->validator->isValid(); } - public function getErrors() + public function getErrors(): array { return $this->validator->getErrors(); } - public function getErrorString() + public function getErrorString(): string { $msg = "Provided values do not validate. Errors:\n"; |
