Skip to content

Commit dc94f12

Browse files
authored
Merge pull request #21 from snapshotpl/php-8.1
Support for PHP 8.1
2 parents 5d57431 + a79609b commit dc94f12

29 files changed

+203
-150
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
}
2828
},
2929
"require": {
30-
"php": "^7.3 || ~8.0.0",
30+
"php": "^7.3 || ~8.0.0 || ~8.1.0",
3131
"ext-json": "*",
3232
"laminas/laminas-eventmanager": "^2.6.3 || ^3.0.1",
33-
"laminas/laminas-http": "^2.5.4",
33+
"laminas/laminas-http": "^2.15.1",
3434
"laminas/laminas-json": "^2.6.1 || ^3.0",
3535
"laminas/laminas-mvc": "^2.7.15 || ^3.0.4",
3636
"laminas/laminas-view": "^2.8.1",
3737
"laminas/laminas-zendframework-bridge": "^1.0"
3838
},
3939
"require-dev": {
40-
"laminas/laminas-coding-standard": "~2.2.0",
40+
"laminas/laminas-coding-standard": "~2.3.0",
4141
"phpspec/prophecy-phpunit": "^2.0",
4242
"phpunit/phpunit": "^9.3",
4343
"psalm/plugin-phpunit": "^0.16.0",

composer.lock

Lines changed: 128 additions & 137 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/module.config.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem;
46

57
return [

src/ApiProblem.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem;
46

57
use Exception;
@@ -136,7 +138,7 @@ class ApiProblem
136138
* if the status matches any known, the title field will be selected
137139
* from $problemStatusTitles as a result.
138140
*
139-
* @param int $status
141+
* @param int|string $status
140142
* @param string|Exception|Throwable $detail
141143
* @param string $type
142144
* @param string $title
@@ -165,7 +167,7 @@ public function __construct($status, $detail, $type = null, $title = null, array
165167
$status = 500;
166168
}
167169

168-
$this->status = $status;
170+
$this->status = (int) $status;
169171
$this->detail = $detail;
170172
$this->title = $title;
171173

src/ApiProblemResponse.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem;
46

57
use Laminas\Http\Headers;
@@ -29,7 +31,10 @@ public function __construct(ApiProblem $apiProblem)
2931
{
3032
$this->apiProblem = $apiProblem;
3133
$this->setCustomStatusCode($apiProblem->status);
32-
$this->setReasonPhrase($apiProblem->title);
34+
35+
if ($apiProblem->title !== null) {
36+
$this->setReasonPhrase($apiProblem->title);
37+
}
3338

3439
$this->jsonFlags = JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR;
3540
}

src/Exception/DomainException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem\Exception;
46

57
class DomainException extends \DomainException implements

src/Exception/ExceptionInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem\Exception;
46

57
/**

src/Exception/InvalidArgumentException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem\Exception;
46

57
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface

src/Exception/ProblemExceptionInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem\Exception;
46

57
use Traversable;

src/Factory/ApiProblemListenerFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Laminas\ApiTools\ApiProblem\Factory;
46

57
use Interop\Container\ContainerInterface;

0 commit comments

Comments
 (0)