Skip to content

Commit d1354d3

Browse files
committed
Use fn and object type hint
1 parent 73f098d commit d1354d3

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/main/php/web/rest/MethodsIn.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
class MethodsIn extends Delegates {
99

1010
/** @param object $instance */
11-
public function __construct($instance) {
11+
public function __construct(object $instance) {
1212
$class= Reflection::type($instance);
1313
if ($annotation= $class->annotation(Resource::class)) {
1414
$this->with($instance, (string)$annotation->argument(0));
1515
} else {
1616
$this->with($instance, '/');
1717
}
18-
uksort($this->patterns, function($a, $b) { return strlen($b) - strlen($a); });
18+
uksort($this->patterns, fn($a, $b) => strlen($b) - strlen($a));
1919
}
2020
}

src/main/php/web/rest/Response.class.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ public static function error($code= 500, $cause= null) {
123123
$self= new self($code);
124124
if (null !== $cause) {
125125
$error= ['status' => $code, 'message' => $cause instanceof Throwable ? $cause->getMessage() : $cause];
126-
$self->body= function($res, $format) use($error) {
127-
$format->write($res, $error);
128-
};
126+
$self->body= fn($res, $format, $marshalling) => $format->write($res, $error);
129127
}
130128
return $self;
131129
}

0 commit comments

Comments
 (0)