Less specific date type detection
[plcapi.git] / src / Encoder.php
index 220ce88..dfec15d 100644 (file)
@@ -63,11 +63,11 @@ class Encoder
                         $out = strtotime($out);
                     }
                     if (is_int($out)) {
-                        $result = new \Datetime();
+                        $result = new \DateTime();
                         $result->setTimestamp($out);
 
                         return $result;
-                    } elseif (is_a($out, 'Datetime')) {
+                    } elseif (is_a($out, 'DateTimeInterface')) {
                         return $out;
                     }
                 }
@@ -179,7 +179,7 @@ class Encoder
             case 'object':
                 if (is_a($phpVal, 'PhpXmlRpc\Value')) {
                     $xmlrpcVal = $phpVal;
-                } elseif (is_a($phpVal, 'DateTime')) {
+                } elseif (is_a($phpVal, 'DateTimeInterface')) {
                     $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
                 } else {
                     $arr = array();