Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 3f07eb4

Browse files
committed
void
1 parent ca26811 commit 3f07eb4

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ add_filter('the_content', [$foo, 'filterSomething'])
101101
In WordPress plus container, the above is similar to:
102102

103103
```php
104-
add_action('admin_init', function ($arg) use ($container): void {
104+
add_action('admin_init', function ($arg) use ($container) {
105105
$bar = $container->get('bar');
106106
$bar->doSomething($arg);
107107
})

src/ContainerAwareInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface ContainerAwareInterface
1616
*
1717
* @return void
1818
*/
19-
public function setContainer(ContainerInterface $container): void;
19+
public function setContainer(ContainerInterface $container);
2020

2121
/**
2222
* Get the container.

src/ContainerAwareTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getContainer(): ContainerInterface
3939
*
4040
* @return void
4141
*/
42-
public function setContainer(ContainerInterface $container): void
42+
public function setContainer(ContainerInterface $container)
4343
{
4444
$this->container = $container;
4545
}

src/Hooks/Action.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Action extends AbstractHook
99
/**
1010
* {@inheritdoc}
1111
*/
12-
public function register(): void
12+
public function register()
1313
{
1414
add_action(
1515
$this->hook,
@@ -26,11 +26,11 @@ public function register(): void
2626
*
2727
* @return void
2828
*/
29-
public function run(...$args): void
29+
public function run(...$args)
3030
{
3131
$container = $this->getContainer();
3232
$instance = $container->get($this->classIdentifier);
3333

34-
call_user_func_array([$instance, $this->callbackMethod], $args);
34+
$instance->{$this->callbackMethod}(...$args);
3535
}
3636
}

src/Hooks/Filter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Filter extends AbstractHook
99
/**
1010
* {@inheritdoc}
1111
*/
12-
public function register(): void
12+
public function register()
1313
{
1414
add_filter(
1515
$this->hook,
@@ -31,6 +31,6 @@ public function run(...$args)
3131
$container = $this->getContainer();
3232
$instance = $container->get($this->classIdentifier);
3333

34-
return call_user_func_array([$instance, $this->callbackMethod], $args);
34+
return $instance->{$this->callbackMethod}(...$args);
3535
}
3636
}

src/Hooks/HookInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface HookInterface extends ContainerAwareInterface
1717
*
1818
* @return void
1919
*/
20-
public function register(): void;
20+
public function register();
2121

2222
/**
2323
* The actual callback that WordPress going to fire.

src/Loader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(ContainerInterface $container)
4242
*
4343
* @return void
4444
*/
45-
public function add(HookInterface ...$hooks): void
45+
public function add(HookInterface ...$hooks)
4646
{
4747
$this->hooks = array_values(
4848
array_unique(
@@ -57,7 +57,7 @@ public function add(HookInterface ...$hooks): void
5757
*
5858
* @return void
5959
*/
60-
public function run(): void
60+
public function run()
6161
{
6262
foreach ($this->hooks as $hook) {
6363
$hook->setContainer($this->container);

0 commit comments

Comments
 (0)