Skip to content

Commit

Permalink
Add Support for PHP 8.4 (#201)
Browse files Browse the repository at this point in the history
Add support for PHP 8.4

Fixes various minor 8.4 compatibility issues in tests

Signed-off-by: Nishant Rana <[email protected]>
  • Loading branch information
nishant04412 authored Oct 25, 2024
1 parent 562e02b commit e8dedb5
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 139 deletions.
5 changes: 5 additions & 0 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ignore_php_platform_requirements": {
"8.4": true
}
}
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
"homepage": "https://laminas.dev",
"license": "BSD-3-Clause",
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0"
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0"
},
"require-dev": {
"ext-phar": "*",
"doctrine/annotations": "^2.0.1",
"laminas/laminas-coding-standard": "^2.5.0",
"laminas/laminas-stdlib": "^3.17.0",
"phpunit/phpunit": "^10.3.3",
"laminas/laminas-stdlib": "^3.18.0",
"phpunit/phpunit": "^10.5.37",
"psalm/plugin-phpunit": "^0.19.0",
"vimeo/psalm": "^5.15.0"
},
Expand Down
267 changes: 138 additions & 129 deletions composer.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/book/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ $parameterGenerator->setType('*'); // invalid (throws exception)
$parameterGenerator->setType('\\'); // invalid (throws exception)
```


## Generated type-hints are now prefixed by `"\"`

Generated type-hints are now prefixed with the `NAMESPACE_SEPARATOR`,
Expand Down
2 changes: 1 addition & 1 deletion test/Generator/TestAsset/ParameterClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function defaultConstant($con = self::FOO)

}

public function defaultObjectEqualsNullAndNotOptional(\stdClass $a = null, $b)
public function nullableAndRequired(?\stdClass $a, $b)
{

}
Expand Down
2 changes: 1 addition & 1 deletion test/Generator/TestAsset/TestSampleSingleClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function someMethod()
protected function withParamsAndReturnType(
$mixed,
array $array,
callable $callable = null,
?callable $callable = null,
?int $int = 0
): bool {
/* test test */
Expand Down
4 changes: 2 additions & 2 deletions test/Reflection/TestAsset/TestSampleClass5.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TestSampleClass5
* which spans multiple lines
* @return mixed Some return descr
*/
public function doSomething($one, $two = 2, $three = 'three', array $array = array(), TestSampleClass $class = null)
public function doSomething($one, $two = 2, $three = 'three', array $array = array(), ?TestSampleClass $class = null)
{
return 'mixedValue';
}
Expand Down Expand Up @@ -63,7 +63,7 @@ public function doSomethingElse($one, $two = 2, $three = 'three')
public function methodWithNotAllParamsDeclared(
string $one,
$two = null,
int $three = null,
?int $three = null,
string $four = '',
$five = null
) {
Expand Down
2 changes: 1 addition & 1 deletion test/TestAsset/IterableHintsClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function nullableIterableParameter(?iterable $foo)
{
}

public function nullDefaultIterableParameter(iterable $foo = null)
public function nullDefaultIterableParameter(?iterable $foo = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion test/TestAsset/ObjectHintsClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function nullableObjectParameter(?object $foo)
{
}

public function nullDefaultObjectParameter(object $foo = null)
public function nullDefaultObjectParameter(?object $foo = null)
{
}

Expand Down

0 comments on commit e8dedb5

Please sign in to comment.