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

Commit 9602382

Browse files
committed
Downgrade to PHP 7.0
Because wp.org svn pre-commit hook rejects PHP 7.1 syntax.
1 parent 0601190 commit 9602382

File tree

10 files changed

+22
-20
lines changed

10 files changed

+22
-20
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@ jobs:
4545
after_success: bash <(curl -s https://codecov.io/bash) -s "$TRAVIS_BUILD_DIR/tests/_output/"
4646
- stage: test
4747
php: 7.1
48+
- stage: test
49+
php: 7.0
4850
- stage: test
4951
php: nightly

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
})

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030
],
3131
"require": {
32-
"php": "^7.1",
32+
"php": "^7.0",
3333
"psr/container": "^1.0",
3434
"psr/container-implementation": "^1.0"
3535
},

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/AbstractHook.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,24 @@ abstract class AbstractHook implements HookInterface
4848
/**
4949
* Filter constructor.
5050
*
51-
* @param string $hook The name of the WordPress hook that is being registered.
52-
* @param string $classIdentifier Identifier of the entry to look for from container.
53-
* @param string $callbackMethod The callback method name.
54-
* @param int|null $priority Optional.The priority at which the function should be fired. Default is 10.
55-
* @param int|null $acceptedArgs Optional. The number of arguments that should be passed to the $callback.
56-
* Default is 1.
51+
* @param string $hook The name of the WordPress hook that is being registered.
52+
* @param string $classIdentifier Identifier of the entry to look for from container.
53+
* @param string $callbackMethod The callback method name.
54+
* @param int $priority Optional.The priority at which the function should be fired. Default is 10.
55+
* @param int $acceptedArgs Optional. The number of arguments that should be passed to the $callback.
56+
* Default is 1.
5757
*/
5858
public function __construct(
5959
string $hook,
6060
string $classIdentifier,
6161
string $callbackMethod,
62-
?int $priority = null,
63-
?int $acceptedArgs = null
62+
$priority = null,
63+
$acceptedArgs = null
6464
) {
6565
$this->hook = $hook;
6666
$this->classIdentifier = $classIdentifier;
6767
$this->callbackMethod = $callbackMethod;
68-
$this->priority = $priority ?? 10;
69-
$this->acceptedArgs = $acceptedArgs ?? 1;
68+
$this->priority = (int) ($priority ?? 10);
69+
$this->acceptedArgs = (int) ($acceptedArgs ?? 1);
7070
}
7171
}

src/Hooks/Action.php

Lines changed: 2 additions & 2 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,7 +26,7 @@ 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);

src/Hooks/Filter.php

Lines changed: 1 addition & 1 deletion
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,

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)