accept arrays as named parameters for {Uns,S}erializer and
[awesomized/ext-ion] / ion.stub.php
index 06eef69130538f46da3bdeb2f92fc8d172b0e4ff..9431b17265fcb9cd44b15e833038353034e592c5 100644 (file)
@@ -28,11 +28,11 @@ namespace ion;
  *  * object (incl. \Serializable, and classes implementing magic and custom __serialize)
  *
  * @param mixed $data PHP value(s).
- * @param Serializer|null $serializer Custom serializer.
+ * @param Serializer|array|null $serializer Custom serializer.
  * @return string serialized ION data
  * @throws \ion\Exception
  */
-function serialize(mixed $data, ?Serializer $serializer = null) : string {}
+function serialize(mixed $data, Serializer|array|null $serializer = null) : string {}
 
 /**
  * Unserialize ION data (stream) as PHP value(s).
@@ -41,7 +41,7 @@ function serialize(mixed $data, ?Serializer $serializer = null) : string {}
  * @return mixed unserialized PHP values
  * @throws \ion\Exception
  */
-function unserialize($data, ?Unserializer $unserializer = null) : mixed {}
+function unserialize($data, Unserializer|array|null $unserializer = null) : mixed {}
 
 /**
  * Serializer interface, used to customize ion\serialize()'s behavior.
@@ -275,13 +275,13 @@ class Timestamp extends \DateTime {
      * @param Timestamp\Precision|int $precision The timestamp's precision.
      * @param Timestamp\Format|string|null $format The timestamp's format.
      * @param string|null $datetime The timestamp's value.
-     * @param \DateTimeZone|null $timezone The timestamp's timezone.
+     * @param \DateTimeZone|string|null $timezone The timestamp's timezone.
      */
     public function __construct(
         Timestamp\Precision|int $precision,
         Timestamp\Format|string|null $format = null,
         ?string $datetime = null,
-        ?\DateTimeZone $timezone = null,
+        \DateTimeZone|string|null $timezone = null,
     ) {}
 
     public function __toString() : string {}
@@ -1055,7 +1055,7 @@ class PHP implements \ion\Serializer {
         /**
          * Writer options.
          */
-        public readonly ?\ion\Writer\Options $writerOptions = null,
+        public readonly \ion\Writer\Options|array|null $writerOptions = null,
         /**
          * Whether to write the top level array as multiple ION sequences.
          */
@@ -1086,7 +1086,7 @@ class PHP implements \ion\Unserializer {
         /**
          * Reader options.
          */
-        public readonly ?\ion\Reader\Options $readerOptions = null,
+        public readonly \ion\Reader\Options|array|null $readerOptions = null,
         /**
          * Whether to continue reading multiple ION sequences after the first one.
          */