Skip to content

Commit 7987576

Browse files
committed
Simplify test code by using arrow functions
1 parent 9cf6410 commit 7987576

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/test/php/lang/reflection/unittest/InstantiationTest.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ class InstantiationTest {
1111

1212
/** @return iterable */
1313
private function memberInitializers() {
14-
yield [function($t, $args) { return $t->constructor()->newInstance($args); }];
15-
yield [function($t, $args) { return $t->initializer('__construct')->newInstance($args); }];
14+
yield [fn($t, $args) => $t->constructor()->newInstance($args)];
15+
yield [fn($t, $args) => $t->initializer('__construct')->newInstance($args)];
1616
}
1717

1818
/** @return iterable */
1919
private function allInitializers() {
20-
yield [function($t, $args) { return $t->newInstance(...$args); }];
21-
yield [function($t, $args) { return $t->constructor()->newInstance($args); }];
22-
yield [function($t, $args) { return $t->initializer('__construct')->newInstance($args); }];
20+
yield [fn($t, $args) => $t->newInstance(...$args)];
21+
yield [fn($t, $args) => $t->constructor()->newInstance($args)];
22+
yield [fn($t, $args) => $t->initializer('__construct')->newInstance($args)];
2323
}
2424

2525
#[Test]

src/test/php/lang/reflection/unittest/VirtualPropertiesTest.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function readonly_modifier_shown_in_string_representation($type) {
3232
public function virtual_property_included_in_list($type) {
3333
Assert::equals(
3434
['fixture' => 'public readonly'],
35-
array_map(function($p) { return $p->modifiers()->names(); }, iterator_to_array($type->properties()))
35+
array_map(fn($p) => $p->modifiers()->names(), iterator_to_array($type->properties()))
3636
);
3737
}
3838

0 commit comments

Comments
 (0)