Skip to content

Commit

Permalink
nikic/PHP-Parser v5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsuh committed Apr 7, 2024
1 parent c89822d commit 5ab38b3
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bin/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
}

if ($outputFiles->count() !== count($result->getConcreteClasses())) {
$success = false;
$allTestsSuccess = false;
printf("%s - [skip failed]\n", $directory->getBasename());
continue;
}

Expand Down
8 changes: 7 additions & 1 deletion src/Compiler/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,20 @@ public static function setNodeName(Node &$node, string $type): void
public static function isBuiltinType(string $type): bool
{
$builtinTypes = [
'array' => true,
'callable' => true,
'bool' => true,
'int' => true,
'float' => true,
'string' => true,
'iterable' => true,
'void' => true,
'object' => true,
'null' => true,
'false' => true,
'mixed' => true,
'array' => true,
'never' => true,
'true' => true,
];

return isset($builtinTypes[strtolower($type)]);
Expand Down
12 changes: 12 additions & 0 deletions tests/monomorphic/230-builtin-types/input/Command/Usage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Test\Command;

use Test\Generic\Box;
use Test\Entity\Bird;
use Test\Entity\Cat;

class Usage extends Box<array,callable,bool,int,float,string,iterable,void,object,null,false,mixed,never,true,Bird,Cat>
{

}
8 changes: 8 additions & 0 deletions tests/monomorphic/230-builtin-types/input/Entity/Bird.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Test\Entity;

class Bird
{

}
8 changes: 8 additions & 0 deletions tests/monomorphic/230-builtin-types/input/Entity/Cat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Test\Entity;

class Cat
{

}
13 changes: 13 additions & 0 deletions tests/monomorphic/230-builtin-types/input/Generic/Box.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Test\Generic;

use Test\Entity\Bird;
use Test\Entity\Cat;

class Box<A,B,C,D,E,F,G,H,I,G,K,L,M,N,O,P> {

public function test($obj): void {
var_dump(Container<A,B,C,D,E,F,G,H,I,G,K,L,M,N,O,P>::class);
}
}
12 changes: 12 additions & 0 deletions tests/monomorphic/230-builtin-types/input/Generic/Container.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Test\Generic;

class Container<A,B,C,D,E,F,G,H,I,G,K,L,M,N,O,P> {

private readonly A|B|C|D|E|F|G|H|I|G|K|L|M|N|O|P $content = null;

public function setContent(A|B|C|D|E|F|G|H|I|G|K|L|M|N|O|P $content): A|B|C|D|E|F|G|H|I|G|K|L|M|N|O|P {

}
}
10 changes: 10 additions & 0 deletions tests/monomorphic/230-builtin-types/output/Command/Usage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Test\Command;

use Test\Generic\Box;
use Test\Entity\Bird;
use Test\Entity\Cat;
class Usage extends \Test\Generic\BoxForArrayAndCallableAndBoolAndIntAndFloatAndStringAndNullAndVoidAndObjectAndFalseAndMixedAndNeverAndTrueAndTestEntityBirdAndTestEntityCat
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Test\Generic;

use Test\Entity\Bird;
use Test\Entity\Cat;
class BoxForArrayAndCallableAndBoolAndIntAndFloatAndStringAndNullAndVoidAndObjectAndFalseAndMixedAndNeverAndTrueAndTestEntityBirdAndTestEntityCat
{
public function test($obj): void
{
var_dump(\Test\Generic\ContainerForArrayAndCallableAndBoolAndIntAndFloatAndStringAndNullAndVoidAndObjectAndFalseAndMixedAndNeverAndTrueAndTestEntityBirdAndTestEntityCat::class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Test\Generic;

class ContainerForArrayAndCallableAndBoolAndIntAndFloatAndStringAndNullAndVoidAndObjectAndFalseAndMixedAndNeverAndTrueAndTestEntityBirdAndTestEntityCat
{
private readonly array|callable|bool|int|float|string|null|void|object|null|false|mixed|never|true|\Test\Entity\Bird|\Test\Entity\Cat $content = null;
public function setContent(array|callable|bool|int|float|string|null|void|object|null|false|mixed|never|true|\Test\Entity\Bird|\Test\Entity\Cat $content): array|callable|bool|int|float|string|null|void|object|null|false|mixed|never|true|\Test\Entity\Bird|\Test\Entity\Cat
{
}
}

0 comments on commit 5ab38b3

Please sign in to comment.