diff --git a/composer.json b/composer.json index 83462d56..1fc09e47 100755 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "keywords": ["module", "xp"], "require" : { "xp-framework/core": "^11.0 | ^10.0", - "xp-framework/ast": "^9.2", + "xp-framework/ast": "dev-feature/unchecked-types as 9.3.0", "php" : ">=7.0.0" }, "require-dev" : { diff --git a/src/main/php/lang/ast/emit/PHP70.class.php b/src/main/php/lang/ast/emit/PHP70.class.php index 14009e53..8c5533a6 100755 --- a/src/main/php/lang/ast/emit/PHP70.class.php +++ b/src/main/php/lang/ast/emit/PHP70.class.php @@ -2,7 +2,18 @@ use lang\ast\Node; use lang\ast\nodes\{InstanceExpression, ScopeExpression, Literal, Variable}; -use lang\ast\types\{IsUnion, IsIntersection, IsFunction, IsArray, IsMap, IsNullable, IsValue, IsLiteral, IsGeneric}; +use lang\ast\types\{ + IsArray, + IsFunction, + IsGeneric, + IsIntersection, + IsLiteral, + IsMap, + IsNullable, + IsUnchecked, + IsUnion, + IsValue +}; /** * PHP 7.0 syntax @@ -56,7 +67,8 @@ public function __construct() { $l= $t->literal(); return (1 === ($r= $rewrite[$l] ?? $l)) ? null : $r; }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } diff --git a/src/main/php/lang/ast/emit/PHP71.class.php b/src/main/php/lang/ast/emit/PHP71.class.php index 1c416f31..c58efaf5 100755 --- a/src/main/php/lang/ast/emit/PHP71.class.php +++ b/src/main/php/lang/ast/emit/PHP71.class.php @@ -1,6 +1,17 @@ literal(); return (1 === ($r= $rewrite[$l] ?? $l)) ? null : $r; }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } } \ No newline at end of file diff --git a/src/main/php/lang/ast/emit/PHP72.class.php b/src/main/php/lang/ast/emit/PHP72.class.php index 769faff8..d6291ff5 100755 --- a/src/main/php/lang/ast/emit/PHP72.class.php +++ b/src/main/php/lang/ast/emit/PHP72.class.php @@ -1,6 +1,17 @@ literal(); return (1 === ($r= $rewrite[$l] ?? $l)) ? null : $r; }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } } \ No newline at end of file diff --git a/src/main/php/lang/ast/emit/PHP73.class.php b/src/main/php/lang/ast/emit/PHP73.class.php index d0e32976..221e56bc 100755 --- a/src/main/php/lang/ast/emit/PHP73.class.php +++ b/src/main/php/lang/ast/emit/PHP73.class.php @@ -1,6 +1,17 @@ literal(); return (1 === ($r= $rewrite[$l] ?? $l)) ? null : $r; }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } diff --git a/src/main/php/lang/ast/emit/PHP74.class.php b/src/main/php/lang/ast/emit/PHP74.class.php index e54d5615..cd3047b8 100755 --- a/src/main/php/lang/ast/emit/PHP74.class.php +++ b/src/main/php/lang/ast/emit/PHP74.class.php @@ -1,6 +1,17 @@ literal(); return (1 === ($r= $rewrite[$l] ?? $l)) ? null : $r; }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } } \ No newline at end of file diff --git a/src/main/php/lang/ast/emit/PHP80.class.php b/src/main/php/lang/ast/emit/PHP80.class.php index af43f354..2bfdaaea 100755 --- a/src/main/php/lang/ast/emit/PHP80.class.php +++ b/src/main/php/lang/ast/emit/PHP80.class.php @@ -1,7 +1,18 @@ literal(); return (1 === ($r= $rewrite[$l] ?? $l)) ? null : $r; }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } } \ No newline at end of file diff --git a/src/main/php/lang/ast/emit/PHP81.class.php b/src/main/php/lang/ast/emit/PHP81.class.php index 607e1e68..32de2e38 100755 --- a/src/main/php/lang/ast/emit/PHP81.class.php +++ b/src/main/php/lang/ast/emit/PHP81.class.php @@ -1,7 +1,18 @@ literal(); return (1 === ($r= $rewrite[$l] ?? $l)) ? null : $r; }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } } \ No newline at end of file diff --git a/src/main/php/lang/ast/emit/PHP82.class.php b/src/main/php/lang/ast/emit/PHP82.class.php index 8a784cd9..9f8ed93b 100755 --- a/src/main/php/lang/ast/emit/PHP82.class.php +++ b/src/main/php/lang/ast/emit/PHP82.class.php @@ -1,7 +1,18 @@ function($t) { return $t->literal(); }, - IsGeneric::class => function($t) { return null; } + IsGeneric::class => function($t) { return null; }, + IsUnchecked::class => function($t) { return null; }, ]; } } \ No newline at end of file diff --git a/src/test/php/lang/ast/unittest/emit/ParameterTest.class.php b/src/test/php/lang/ast/unittest/emit/ParameterTest.class.php index 46f6d985..dde8b919 100755 --- a/src/test/php/lang/ast/unittest/emit/ParameterTest.class.php +++ b/src/test/php/lang/ast/unittest/emit/ParameterTest.class.php @@ -139,4 +139,12 @@ public function trailing_comma_allowed() { ; Assert::equals(1, sizeof($p), 'number of parameters'); } + + #[Test] + public function soft_string_typed() { + $param= $this->param('@string $param'); + + Assert::null($param->getTypeRestriction()); + Assert::equals(Primitive::$STRING, $param->getType()); + } } \ No newline at end of file