Skip to content

Commit

Permalink
Use new reflection API
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 28, 2024
1 parent f59cad2 commit b74ec9a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use io\{File, Files, Folder};
use lang\ast\CompilingClassLoader;
use lang\{ClassFormatException, ClassLoader, ClassNotFoundException, ElementNotFoundException, Environment};
use lang\{ClassFormatException, ClassLoader, ClassNotFoundException, ElementNotFoundException, Environment, Reflection};
use test\{Action, Assert, Expect, Test, Values};

class CompilingClassLoaderTest {
Expand Down Expand Up @@ -108,11 +108,11 @@ public function load_dependencies() {
'Feature' => '<?php namespace %s; trait Feature { }'
];

$c= $this->compile($source, fn($loader, $types) => $loader->loadClass($types['Child']));
$n= fn($class) => $class->getSimpleName();
$t= Reflection::type($this->compile($source, fn($loader, $types) => $loader->loadClass($types['Child'])));
$n= fn($class) => $class->declaredName();
Assert::equals(
['Child', 'Base', ['Impl'], ['Feature']],
[$n($c), $n($c->getParentClass()), array_map($n, $c->getInterfaces()), array_map($n, $c->getTraits())]
[$n($t), $n($t->parent()), array_map($n, $t->interfaces()), array_map($n, $t->traits())]
);
}

Expand Down

0 comments on commit b74ec9a

Please sign in to comment.