Browse Source

removed compatibility code for older Doctrine Common versions

Johannes M. Schmitt 12 years ago
parent
commit
8be9e8b3ca

+ 0 - 19
Annotation/AccessType.php

@@ -15,23 +15,4 @@ final class AccessType
      * @var string
      */
     public $type;
-
-    public function __construct()
-    {
-        if (0 === func_num_args()) {
-            return;
-        }
-        $values = func_get_arg(0);
-
-        if (isset($values['value'])) {
-            $values['type'] = $values['value'];
-        }
-        if (!isset($values['type'])) {
-            throw new \InvalidArgumentException(sprintf('@AccessType requires the AccessType.'));
-        }
-        if (!is_string($values['type'])) {
-            throw new \InvalidArgumentException(sprintf('@AccessType expects a string type, but got %s.', json_encode($values['type'])));
-        }
-        $this->type = $values['type'];
-    }
 }

+ 0 - 25
Annotation/Accessor.php

@@ -19,29 +19,4 @@ final class Accessor
      * @var string
      */
     public $setter;
-
-    public function __construct()
-    {
-        if (0 === func_num_args()) {
-            return;
-        }
-        $values = func_get_arg(0);
-
-        if (isset($values['value'])) {
-            $values['getter'] = $values['value'];
-        }
-        if (isset($values['getter'])) {
-            if (!is_string($values['getter'])) {
-                throw new \InvalidArgumentException(sprintf('"getter" attribute of annotation @Accessor must be a string, but got %s.', json_encode($values['getter'])));
-            }
-            $this->getter = $values['getter'];
-        }
-
-        if (isset($values['setter'])) {
-            if (!is_string($values['setter'])) {
-                throw new \InvalidArgumentException(sprintf('"setter" attribute of annotation @Accessor must be a string, but got %s.', json_encode($values['setter'])));
-            }
-            $this->setter = $values['setter'];
-        }
-    }
 }

+ 0 - 13
Annotation/Groups.php

@@ -28,17 +28,4 @@ final class Groups
 {
     /** @var array<string> @Required */
     public $groups;
-
-    public function __construct()
-    {
-        if (0 === func_num_args()) {
-            return;
-        }
-        $values = func_get_arg(0);
-
-        if (!isset($values['value'])) {
-            throw new InvalidArgumentException('The "groups" attribute must be set.');
-        }
-        $this->groups = (array) $values['value'];
-    }
 }

+ 4 - 9
Annotation/Type.php

@@ -26,14 +26,9 @@ use JMS\SerializerBundle\Exception\RuntimeException;
  */
 final class Type
 {
+    /**
+     * @Required
+     * @var string
+     */
     public $name;
-
-    public function __construct(array $values)
-    {
-        if (!is_string($values['value'])) {
-            throw new RuntimeException('"value" must be a string.');
-        }
-
-        $this->name = $values['value'];
-    }
 }

+ 4 - 9
Annotation/Version.php

@@ -22,14 +22,9 @@ use JMS\SerializerBundle\Exception\RuntimeException;
 
 abstract class Version
 {
+    /**
+     * @Required
+     * @var string
+     */
     public $version;
-
-    public function __construct(array $values)
-    {
-        if (!isset($values['value']) || !is_scalar($values['value'])) {
-            throw new RuntimeException('$version must be a scalar.');
-        }
-
-        $this->version = $values['value'];
-    }
 }

+ 7 - 17
Annotation/XmlCollection.php

@@ -22,23 +22,13 @@ use JMS\SerializerBundle\Exception\InvalidArgumentException;
 
 abstract class XmlCollection
 {
-    public $inline = false;
+    /**
+     * @var string
+     */
     public $entry = 'entry';
 
-    public function __construct(array $values)
-    {
-        if (isset($values['entry'])) {
-            if (!is_string($values['entry'])) {
-                throw new InvalidArgumentException(sprintf('Value for attribute "entry" must be a string, but got %s.', json_encode($values['entry'])));
-            }
-            $this->entry = $values['entry'];
-        }
-
-        if (isset($values['inline'])) {
-            if (!is_bool($values['inline'])) {
-                throw new InvalidArgumentException(sprintf('Value for attribute "inline" must be a boolean, but got %s.', json_encode($values['inline'])));
-            }
-            $this->inline = $values['inline'];
-        }
-    }
+    /**
+     * @var boolean
+     */
+    public $inline = false;
 }

+ 3 - 12
Annotation/XmlMap.php

@@ -26,17 +26,8 @@ use JMS\SerializerBundle\Exception\InvalidArgumentException;
  */
 final class XmlMap extends XmlCollection
 {
+    /**
+     * @var string
+     */
     public $keyAttribute = '_key';
-
-    public function __construct(array $values)
-    {
-        parent::__construct($values);
-
-        if (isset($values['keyAttribute'])) {
-            if (!is_string($values['keyAttribute'])) {
-                throw new InvalidArgumentException(sprintf('The attribute "keyAttribute" of @XmlMap must be a string, but got %s.', json_encode($values['keyAttribute'])));
-            }
-            $this->keyAttribute = $values['keyAttribute'];
-        }
-    }
 }

+ 4 - 12
Annotation/XmlRoot.php

@@ -26,17 +26,9 @@ use JMS\SerializerBundle\Exception\RuntimeException;
  */
 final class XmlRoot
 {
+    /**
+     * @Required
+     * @var string
+     */
     public $name;
-
-    public function __construct(array $values)
-    {
-        if (!isset($values['value'])) {
-            throw new RuntimeException('You must define a name for @XmlRoot.');
-        }
-        if (!is_string($values['value'])) {
-            throw new RuntimeException('"value" must be a string, but got '.json_encode($values['value']));
-        }
-
-        $this->name = $values['value'];
-    }
 }