Skip to content

Commit f41fc28

Browse files
authored
Merge pull request #66 from lucatume/php-84-compat
solve PHP 8.4 deprecation issues
2 parents 76c0c2a + d1aec79 commit f41fc28

File tree

13 files changed

+45
-36
lines changed

13 files changed

+45
-36
lines changed

.github/workflows/qa.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,38 @@ jobs:
77
steps:
88
- name: Checkout code
99
uses: actions/checkout@v3
10-
- name: Setup PHP 5.6
10+
- name: Setup PHP 7.1
1111
uses: shivammathur/setup-php@v2
1212
with:
13-
php-version: 5.6
13+
php-version: 7.1
1414
- name: Install dependencies
1515
uses: "ramsey/composer-install@v2"
1616
- name: Run phpcs
1717
run: make phpcs
1818
phpstan:
19-
name: phpstan on PHP 5.6
19+
name: phpstan on PHP 7.1
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout code
2323
uses: actions/checkout@v3
24-
- name: Setup PHP 5.6
24+
- name: Setup PHP 7.1
2525
uses: shivammathur/setup-php@v2
2626
with:
27-
php-version: 5.6
27+
php-version: 7.1
2828
- name: Install dependencies
2929
uses: "ramsey/composer-install@v2"
3030
- name: Run phpstan
3131
run: make phpstan
3232
phan:
33-
name: phan on PHP 5.6
33+
name: phan on PHP 7.1
3434
runs-on: ubuntu-latest
3535
steps:
3636
- name: Checkout code
3737
uses: actions/checkout@v3
38-
- name: Setup PHP 5.6
38+
- name: Setup PHP 7.1
3939
uses: shivammathur/setup-php@v2
4040
with:
41-
php-version: 5.6
41+
php-version: 7.1
4242
- name: Install dependencies
4343
uses: "ramsey/composer-install@v2"
4444
- name: Run phan

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
php: [ '5.6', '7.0' , '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
9+
php: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
1010
steps:
1111
- name: Checkout code
1212
uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ to [Semantic Versioning](http://semver.org/).
55

66
## [unreleased] Unreleased
77

8+
### Changed
9+
10+
- Bumped minimum supported version to PHP 7.1.
11+
- Fixed PHP 8.4 deprecation warnings.
12+
813
## [3.3.7] 2024-04-26;
914

1015
### Fixed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
},
1616
"require": {
17-
"php": ">=5.6",
17+
"php": ">=7.1",
1818
"psr/container": "^1.0",
1919
"ext-json": "*"
2020
},

config/phan-config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
// Note that the **only** effect of choosing `'5.6'` is to infer that functions removed in php 7.0 exist.
4444
// (See `backward_compatibility_checks` for additional options)
4545
// Automatically inferred from composer.json requirement for "php" of ">=5.6"
46-
'target_php_version' => '5.6',
46+
'target_php_version' => '7.1',
4747

4848
// If enabled, missing properties will be created when
4949
// they are first seen. If false, we'll report an

src/App.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static function container()
3838

3939
return static::$container;
4040
}
41-
41+
4242
/**
4343
* Sets the container instance the Application should use as a Service Locator.
4444
*
@@ -54,7 +54,7 @@ public static function setContainer(Container $container)
5454
{
5555
static::$container = $container;
5656
}
57-
57+
5858
/**
5959
* Sets a variable on the container.
6060
*
@@ -99,7 +99,7 @@ public static function offsetSet($offset, $value)
9999
*
100100
* @throws ContainerException If there's any issue reflecting on the class, interface or the implementation.
101101
*/
102-
public static function singleton($id, $implementation = null, array $afterBuildMethods = null)
102+
public static function singleton($id, $implementation = null, ?array $afterBuildMethods = null)
103103
{
104104
static::container()->singleton($id, $implementation, $afterBuildMethods);
105105
}
@@ -311,7 +311,7 @@ public static function register($serviceProviderClass, ...$alias)
311311
*
312312
* @throws ContainerException If there's an issue while trying to bind the implementation.
313313
*/
314-
public static function bind($id, $implementation = null, array $afterBuildMethods = null)
314+
public static function bind($id, $implementation = null, ?array $afterBuildMethods = null)
315315
{
316316
static::container()->bind($id, $implementation, $afterBuildMethods);
317317
}
@@ -346,7 +346,7 @@ public static function boot()
346346
* @return void This method does not return any value.
347347
* @throws ContainerException
348348
*/
349-
public static function singletonDecorators($id, $decorators, array $afterBuildMethods = null)
349+
public static function singletonDecorators($id, $decorators, ?array $afterBuildMethods = null)
350350
{
351351
static::container()->singletonDecorators($id, $decorators, $afterBuildMethods);
352352
}
@@ -367,7 +367,7 @@ public static function singletonDecorators($id, $decorators, array $afterBuildMe
367367
* @return void This method does not return any value.
368368
* @throws ContainerException If there's any issue binding the decorators.
369369
*/
370-
public static function bindDecorators($id, array $decorators, array $afterBuildMethods = null)
370+
public static function bindDecorators($id, array $decorators, ?array $afterBuildMethods = null)
371371
{
372372
static::container()->bindDecorators($id, $decorators, $afterBuildMethods);
373373
}
@@ -471,7 +471,7 @@ public static function callback($id, $method)
471471
* The callable will be a closure on PHP 5.3+ or a lambda function on PHP 5.2.
472472
*
473473
* @param string|class-string|mixed $id The fully qualified name of a class or an interface.
474-
* @param array<mixed> $buildArgs An array of arguments that should be used to build the
474+
* @param array<mixed>|null $buildArgs An array of arguments that should be used to build the
475475
* instance; note that any argument will be resolved using
476476
* the container itself and bindings will apply.
477477
* @param string[]|null $afterBuildMethods An array of methods that should be called on the built
@@ -480,9 +480,9 @@ public static function callback($id, $method)
480480
* @return callable A callable function that will return an instance of the specified class when
481481
* called.
482482
*/
483-
public static function instance($id, array $buildArgs = [], array $afterBuildMethods = null)
483+
public static function instance($id, ?array $buildArgs = [], ?array $afterBuildMethods = null)
484484
{
485-
return static::container()->instance($id, $buildArgs, $afterBuildMethods);
485+
return static::container()->instance($id, $buildArgs ?? [], $afterBuildMethods);
486486
}
487487

488488
/**

src/Builders/CallableBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class CallableBuilder implements BuilderInterface, ReinitializableBuilderInterfa
5353
public function __construct(
5454
Container $container,
5555
callable $callable,
56-
array $afterBuildMethods = null,
56+
?array $afterBuildMethods = null,
5757
...$buildArgs
5858
) {
5959
$this->container = $container;
@@ -86,7 +86,7 @@ public function build()
8686
*
8787
* @return void This method does not return any value.
8888
*/
89-
public function reinit(array $afterBuildMethods = null, ...$buildArgs)
89+
public function reinit(?array $afterBuildMethods = null, ...$buildArgs)
9090
{
9191
$this->afterBuildMethods = $afterBuildMethods ?: [];
9292
$this->buildArgs = $buildArgs;

src/Builders/ClassBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ClassBuilder implements BuilderInterface, ReinitializableBuilderInterface
7575
*
7676
* @throws NotFoundException If the class does not exist.
7777
*/
78-
public function __construct($id, Resolver $resolver, $className, array $afterBuildMethods = null, ...$buildArgs)
78+
public function __construct($id, Resolver $resolver, $className, ?array $afterBuildMethods = null, ...$buildArgs)
7979
{
8080
if (!class_exists($className)) {
8181
throw new NotFoundException(
@@ -236,7 +236,7 @@ protected function resolveParameter(Parameter $parameter)
236236
/**
237237
* {@inheritdoc}
238238
*/
239-
public function reinit(array $afterBuildMethods = null, ...$buildArgs)
239+
public function reinit(?array $afterBuildMethods = null, ...$buildArgs)
240240
{
241241
$this->afterBuildMethods = $afterBuildMethods;
242242
$this->buildArgs = $buildArgs;

src/Builders/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(Container $container, Resolver $resolver)
5656
*
5757
* @throws NotFoundException If a builder cannot find its implementation target.
5858
*/
59-
public function getBuilder($id, $implementation = null, array $afterBuildMethods = null, ...$buildArgs)
59+
public function getBuilder($id, $implementation = null, ?array $afterBuildMethods = null, ...$buildArgs)
6060
{
6161
if ($implementation === null) {
6262
$implementation = $id;

src/Builders/ReinitializableBuilderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ interface ReinitializableBuilderInterface
2222
*
2323
* @return void This method does not return any value.
2424
*/
25-
public function reinit(array $afterBuildMethods = null, ...$buildArgs);
25+
public function reinit(?array $afterBuildMethods = null, ...$buildArgs);
2626
}

0 commit comments

Comments
 (0)