aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/collection/src/Tool/TypeTrait.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-03-14 10:13:22 +0000
committerMario <mario@mariovavti.com>2024-03-14 10:13:22 +0000
commit55097c47c5534d4453f7494f8a1542f7beb4d588 (patch)
tree399f81bbd03fcb4bb713339d06512eee962ec8f6 /vendor/ramsey/collection/src/Tool/TypeTrait.php
parent97b82fc77b424d051b2a472ab2318fd768151bdd (diff)
downloadvolse-hubzilla-55097c47c5534d4453f7494f8a1542f7beb4d588.tar.gz
volse-hubzilla-55097c47c5534d4453f7494f8a1542f7beb4d588.tar.bz2
volse-hubzilla-55097c47c5534d4453f7494f8a1542f7beb4d588.zip
Revert "composer update and use the fixed streams php-jcs library until the floats issue will be fixed upstream. see here for reference https://codeberg.org/streams/streams/issues/151"
This reverts commit 6bf61dfa6b585db01b607a79bd64ec9c583a9c10.
Diffstat (limited to 'vendor/ramsey/collection/src/Tool/TypeTrait.php')
-rw-r--r--vendor/ramsey/collection/src/Tool/TypeTrait.php48
1 files changed, 32 insertions, 16 deletions
diff --git a/vendor/ramsey/collection/src/Tool/TypeTrait.php b/vendor/ramsey/collection/src/Tool/TypeTrait.php
index ac51b7f10..8214e9654 100644
--- a/vendor/ramsey/collection/src/Tool/TypeTrait.php
+++ b/vendor/ramsey/collection/src/Tool/TypeTrait.php
@@ -36,22 +36,38 @@ trait TypeTrait
* @param string $type The type to check the value against.
* @param mixed $value The value to check.
*/
- protected function checkType(string $type, mixed $value): bool
+ protected function checkType(string $type, $value): bool
{
- return match ($type) {
- 'array' => is_array($value),
- 'bool', 'boolean' => is_bool($value),
- 'callable' => is_callable($value),
- 'float', 'double' => is_float($value),
- 'int', 'integer' => is_int($value),
- 'null' => $value === null,
- 'numeric' => is_numeric($value),
- 'object' => is_object($value),
- 'resource' => is_resource($value),
- 'scalar' => is_scalar($value),
- 'string' => is_string($value),
- 'mixed' => true,
- default => $value instanceof $type,
- };
+ switch ($type) {
+ case 'array':
+ return is_array($value);
+ case 'bool':
+ case 'boolean':
+ return is_bool($value);
+ case 'callable':
+ return is_callable($value);
+ case 'float':
+ case 'double':
+ return is_float($value);
+ case 'int':
+ case 'integer':
+ return is_int($value);
+ case 'null':
+ return $value === null;
+ case 'numeric':
+ return is_numeric($value);
+ case 'object':
+ return is_object($value);
+ case 'resource':
+ return is_resource($value);
+ case 'scalar':
+ return is_scalar($value);
+ case 'string':
+ return is_string($value);
+ case 'mixed':
+ return true;
+ default:
+ return $value instanceof $type;
+ }
}
}