Esempio n. 1
0
 public function add($element)
 {
     if (!$this->isCorrectType($element)) {
         throw new IllegalArgumentException("Tried to add element of type " . TypeUtil::getType($element) . " to list of type " . $this->type);
     }
     $this->elements[$element] = $element;
 }
Esempio n. 2
0
 private function isCorrectValueType($value)
 {
     if ($this->valueType === "?") {
         return true;
     }
     return $this->valueType === TypeUtil::getType($value);
 }
Esempio n. 3
0
 protected function isCorrectType($element)
 {
     if ($this->type === "?") {
         return true;
     }
     return $this->type === TypeUtil::getType($element);
 }