Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/php/lang/ast/syntax/PHP.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
IsLiteral,
IsMap,
IsNullable,
IsUnchecked,
IsUnion,
IsValue
};
Expand Down Expand Up @@ -1115,6 +1116,11 @@ public function list($parse, $end, $kind) {
}

public function type($parse, $optional= true) {
if ('@' === $parse->token->value) {
$parse->forward();
return new IsUnchecked($this->type($parse, false));
}

$t= $this->type0($parse, $optional);

// Check for union and intersection types (which cannot be mixed
Expand Down
32 changes: 32 additions & 0 deletions src/main/php/lang/ast/types/IsUnchecked.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php namespace lang\ast\types;

use lang\ast\Type;

class IsUnchecked extends Type {
public $element;

/**
* Creates a new element
*
* @param parent $element
*/
public function __construct(Type $element) {
$this->element= $element;
}

/** @return string */
public function literal() { return $this->element->literal(); }

/** @return string */
public function name() { return $this->element->name(); }

/**
* Compare
*
* @param var $value
* @return int
*/
public function compareTo($value) {
return $value instanceof self ? $this->element->compareTo($value->element) : 1;
}
}