aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/collection/src/Tool
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-03-08 09:31:23 +0000
committerMario <mario@mariovavti.com>2021-03-08 09:31:23 +0000
commit951e9c8c4f39dd8577834d5bc501c05d80722de9 (patch)
tree6a42c6a229c7b2b3e13bc5af77a733d054242695 /vendor/ramsey/collection/src/Tool
parentf94b046333c57acde493ee5dc2511acc6baca701 (diff)
parent89415e17313578eb115c441480b6e0ddfa90afef (diff)
downloadvolse-hubzilla-5.4.tar.gz
volse-hubzilla-5.4.tar.bz2
volse-hubzilla-5.4.zip
Merge branch '5.4RC'5.4
Diffstat (limited to 'vendor/ramsey/collection/src/Tool')
-rw-r--r--vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php8
-rw-r--r--vendor/ramsey/collection/src/Tool/ValueToStringTrait.php7
2 files changed, 12 insertions, 3 deletions
diff --git a/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php b/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php
index 7bc4878db..f9be1be28 100644
--- a/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php
+++ b/vendor/ramsey/collection/src/Tool/ValueExtractorTrait.php
@@ -29,7 +29,7 @@ trait ValueExtractorTrait
/**
* Extracts the value of the given property or method from the object.
*
- * @param object $object The object to extract the value from.
+ * @param mixed $object The object to extract the value from.
* @param string $propertyOrMethod The property or method for which the
* value should be extracted.
*
@@ -37,8 +37,12 @@ trait ValueExtractorTrait
*
* @throws ValueExtractionException if the method or property is not defined.
*/
- protected function extractValue(object $object, string $propertyOrMethod)
+ protected function extractValue($object, string $propertyOrMethod)
{
+ if (!is_object($object)) {
+ throw new ValueExtractionException('Unable to extract a value from a non-object');
+ }
+
if (property_exists($object, $propertyOrMethod)) {
return $object->$propertyOrMethod;
}
diff --git a/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php b/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php
index 34a9a0a68..721ade002 100644
--- a/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php
+++ b/vendor/ramsey/collection/src/Tool/ValueToStringTrait.php
@@ -71,7 +71,12 @@ trait ValueToStringTrait
return '(' . get_resource_type($value) . ' resource #' . (int) $value . ')';
}
- // after this line $value is an object since is not null, scalar, array or resource
+ // If we don't know what it is, use var_export().
+ if (!is_object($value)) {
+ return '(' . var_export($value, true) . ')';
+ }
+
+ // From here, $value should be an object.
// __toString() is implemented
if (is_callable([$value, '__toString'])) {