Skip to content

Commit 6e8e24e

Browse files
laravel9: test cannot have null content returned. also message in exceptions cannot be null
update composer json fix header check fix tests, catch session not found exception update applicationStubs add application stubs for laravel 9 , update version check fix get check version fix passing null to trim as dingo#1 argument fix deprecation for getClass preg_replace(): Passing null to parameter dingo#2 ($replacement) of type array|string is deprecated in C:\laragon\www\api\src\Http\Validation\Domain.php on line 69 match signature bump laravel, phpdocumentor
1 parent 2f95090 commit 6e8e24e

20 files changed

+511
-49
lines changed

composer.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@
1414
}],
1515
"require": {
1616
"php": ">=7.2.5",
17-
"dingo/blueprint": "dev-master",
18-
"illuminate/routing": "^7.0|^8.0",
19-
"illuminate/support": "^7.0|^8.0",
20-
"league/fractal": "^0.19"
17+
"dingo/blueprint": "dev-laravel9",
18+
"illuminate/routing": "^7.0|^8.0|^9.0",
19+
"illuminate/support": "^7.0|^8.0|^9.0",
20+
"league/fractal": "^0.20"
2121
},
2222
"require-dev": {
23-
"phpdocumentor/reflection-docblock": "3.3.2",
24-
"friendsofphp/php-cs-fixer": "~2",
25-
"illuminate/auth": "^7.0|^8.0",
26-
"illuminate/cache": "^7.0|^8.0",
27-
"illuminate/console": "^7.0|^8.0",
28-
"illuminate/database": "^7.0|^8.0",
29-
"illuminate/events": "^7.0|^8.0",
30-
"illuminate/filesystem": "^7.0|^8.0",
31-
"illuminate/log": "^7.0|^8.0",
32-
"illuminate/pagination": "^7.0|^8.0",
33-
"laravel/lumen-framework": "^7.0|^8.0",
23+
"phpdocumentor/reflection-docblock": "3.3.2 || ^4.1 || ^5",
24+
"friendsofphp/php-cs-fixer": "~2|~3",
25+
"illuminate/auth": "^7.0|^8.0|^9.0",
26+
"illuminate/cache": "^7.0|^8.0|^9.0",
27+
"illuminate/console": "^7.0|^8.0|^9.0",
28+
"illuminate/database": "^7.0|^8.0|^9.0",
29+
"illuminate/events": "^7.0|^8.0|^9.0",
30+
"illuminate/filesystem": "^7.0|^8.0|^9.0",
31+
"illuminate/log": "^7.0|^8.0|^9.0",
32+
"illuminate/pagination": "^7.0|^8.0|^9.0",
33+
"laravel/lumen-framework": "^7.0|^8.0|^9.0",
3434
"mockery/mockery": "~1.0",
3535
"phpunit/phpunit": "^8.5|^9.0",
36-
"squizlabs/php_codesniffer": "~2.0",
36+
"squizlabs/php_codesniffer": "~2.0|^3.6",
3737
"tymon/jwt-auth": "1.0.*"
3838
},
3939
"suggest": {
@@ -72,8 +72,8 @@
7272
"prefer-stable": true,
7373
"repositories": [
7474
{
75-
"url": "https://github.com/EpsilonTelecommunications/blueprint",
76-
"type": "vcs"
75+
"url": "C:\\laragon\\www\\blueprint",
76+
"type": "path"
7777
}
7878
]
7979
}

src/Auth/Provider/Authorization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class Authorization implements \Dingo\Api\Contract\Auth\Provider
2626
*/
2727
public function validateAuthorizationHeader(Request $request)
2828
{
29-
if (Str::startsWith(strtolower($request->headers->get('authorization')), $this->getAuthorizationMethod())) {
29+
if ($request->headers->has('authorization') && Str::startsWith(strtolower($request->headers->get('authorization')), $this->getAuthorizationMethod())) {
3030
return true;
3131
}
3232

src/Exception/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ protected function handlerHint(callable $callback)
371371

372372
$exception = $reflection->getParameters()[0];
373373

374-
return $exception->getClass()->getName();
374+
return $exception->getType()->getName();
375375
}
376376

377377
/**

src/Exception/InternalHttpException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(Response $response, $message = null, Exception $prev
3030
{
3131
$this->response = $response;
3232

33-
parent::__construct($response->getStatusCode(), $message, $previous, $headers, $code);
33+
parent::__construct($response->getStatusCode(), $message ?? '', $previous, $headers, $code);
3434
}
3535

3636
/**

src/Exception/ResourceException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct($message = null, $errors = null, Exception $previous
3535
$this->errors = is_array($errors) ? new MessageBag($errors) : $errors;
3636
}
3737

38-
parent::__construct(422, $message, $previous, $headers, $code);
38+
parent::__construct(422, $message ?? '', $previous, $headers, $code);
3939
}
4040

4141
/**

src/Http/Request.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Dingo\Api\Http\Parser\Accept;
66
use Illuminate\Http\Request as IlluminateRequest;
77
use Dingo\Api\Contract\Http\Request as RequestInterface;
8+
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
89

910
class Request extends IlluminateRequest implements RequestInterface
1011
{
@@ -35,9 +36,11 @@ public function createFromIlluminate(IlluminateRequest $old)
3536
$old->query->all(), $old->request->all(), $old->attributes->all(),
3637
$old->cookies->all(), $old->files->all(), $old->server->all(), $old->content
3738
);
38-
39-
if ($session = $old->getSession()) {
40-
$new->setLaravelSession($old->getSession());
39+
try {
40+
if ($session = $old->getSession()) {
41+
$new->setLaravelSession($session);
42+
}
43+
} catch (SessionNotFoundException $exception) {
4144
}
4245

4346
$new->setRouteResolver($old->getRouteResolver());

src/Http/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ protected function fireMorphingEvent()
190190
/**
191191
* {@inheritdoc}
192192
*/
193-
public function setContent($content)
193+
public function setContent($content): static
194194
{
195195
// Attempt to set the content string, if we encounter an unexpected value
196196
// then we most likely have an object that cannot be type cast. In that

src/Http/Validation/Domain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function stripProtocol($domain)
6666
*/
6767
protected function stripPort($domain)
6868
{
69-
if ($domainStripped = preg_replace(self::PATTERN_STRIP_PROTOCOL, null, $domain)) {
69+
if ($domainStripped = preg_replace(self::PATTERN_STRIP_PROTOCOL, '', $domain)) {
7070
return $domainStripped;
7171
}
7272

src/Http/Validation/Prefix.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ class Prefix implements Validator
2121
*
2222
* @return void
2323
*/
24-
public function __construct($prefix)
24+
public function __construct(?string $prefix = null)
2525
{
26-
$this->prefix = $prefix;
26+
$this->prefix = $prefix ?? '';
2727
}
2828

2929
/**
@@ -40,7 +40,7 @@ public function validate(Request $request)
4040

4141
$path = $this->filterAndExplode($request->getPathInfo());
4242

43-
return ! is_null($this->prefix) && $prefix == array_slice($path, 0, count($prefix));
43+
return ! empty($this->prefix) && $prefix == array_slice($path, 0, count($prefix));
4444
}
4545

4646
/**

src/Provider/LaravelServiceProvider.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Illuminate\Http\Request as IlluminateRequest;
1717
use Dingo\Api\Routing\Adapter\Laravel as LaravelAdapter;
1818
use Illuminate\Contracts\Validation\ValidatesWhenResolved;
19+
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
1920

2021
class LaravelServiceProvider extends DingoServiceProvider
2122
{
@@ -201,8 +202,11 @@ protected function initializeRequest(FormRequest $form, IlluminateRequest $curre
201202

202203
$form->setJson($current->json());
203204

204-
if ($session = $current->getSession()) {
205-
$form->setLaravelSession($session);
205+
try {
206+
if ($session = $current->getSession()) {
207+
$form->setLaravelSession($session);
208+
}
209+
} catch (SessionNotFoundException $exception) {
206210
}
207211

208212
$form->setUserResolver($current->getUserResolver());

0 commit comments

Comments
 (0)