Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
8 changes: 5 additions & 3 deletions src/main/php/lang/FunctionType.class.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php namespace lang;

use Throwable as Any;

/**
* Represents function types
*
Expand Down Expand Up @@ -303,7 +305,7 @@ public function isAssignableFrom($type): bool {
* @param var[] $args
* @return var
* @throws lang.IllegalArgumentException in case the passed function is not an instance of this type
* @throws lang.reflect.TargetInvocationException for any exception raised from the invoked function
* @throws lang.Throwable for any exception raised from the invoked function
*/
public function invoke($func, $args= []) {
$closure= $this->verified($func, function($m) use($func) { throw new IllegalArgumentException(sprintf(
Expand All @@ -314,8 +316,8 @@ public function invoke($func, $args= []) {
)); });
try {
return $closure(...$args);
} catch (Throwable $e) {
throw new \lang\reflect\TargetInvocationException($this->getName(), $e);
} catch (Any $e) {
throw Throwable::wrap($e);
}
}
}
3 changes: 2 additions & 1 deletion src/main/php/lang/GenericTypes.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function newType(XPClass $base, array $arguments) {
public function newType0($base, $arguments) {

// Verify
$annotations= $base->getAnnotations();
$details= XPClass::detailsForClass($base->getName());
$annotations= $details ? $details['class'][DETAIL_ANNOTATIONS] : [];
if (!isset($annotations['generic']['self'])) {
throw new IllegalStateException('Class '.$base->name.' is not a generic definition');
}
Expand Down
Loading