Skip to content

Commit ba29ce3

Browse files
committed
Migrate to PHP 7.4 syntax with Rector
1 parent 96afca0 commit ba29ce3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+102
-234
lines changed

src/Acl/Acl.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ class Acl extends \Laminas\Permissions\Acl\Acl
1212
{
1313
/**
1414
* The message explaining the last denial.
15-
*
16-
* @var null|string
1715
*/
18-
private $message;
16+
private ?string $message = null;
1917

2018
/**
2119
* @var string[]
2220
*/
23-
private $reasons = [];
21+
private array $reasons = [];
2422

2523
protected function createModelResource(string $class): ModelResource
2624
{
@@ -88,7 +86,7 @@ private function buildMessage(ModelResource $resource, ?string $privilege, strin
8886

8987
$user = CurrentUser::get();
9088
$userName = $user ? 'User "' . $user->getLogin() . '"' : 'Non-logged user';
91-
$privilege = $privilege === null ? 'NULL' : $privilege;
89+
$privilege ??= 'NULL';
9290

9391
$message = "$userName with role $role is not allowed on resource \"$resource\" with privilege \"$privilege\"";
9492

src/Acl/Assertion/All.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class All implements AssertionInterface
1414
/**
1515
* @var AssertionInterface[]
1616
*/
17-
private $asserts;
17+
private array $asserts;
1818

1919
/**
2020
* Check if all asserts are true.

src/Acl/Assertion/One.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class One implements AssertionInterface
1414
/**
1515
* @var AssertionInterface[]
1616
*/
17-
private $asserts;
17+
private array $asserts;
1818

1919
/**
2020
* Check if at least one assert is true.

src/Acl/ModelResource.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ final class ModelResource extends GenericResource
2222
{
2323
/**
2424
* Unique id of the instance of resource.
25-
*
26-
* @var null|Model
2725
*/
28-
private $instance;
26+
private ?Model $instance;
2927

3028
/**
3129
* Sets the Resource identifier.

src/Api/FilteredFieldResolver.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
*/
1515
final class FilteredFieldResolver
1616
{
17-
/**
18-
* @var DefaultFieldResolver
19-
*/
20-
private $resolver;
17+
private DefaultFieldResolver $resolver;
2118

2219
public function __construct()
2320
{

src/Api/Input/PaginationInputType.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,23 @@ public function __construct()
2626
{
2727
$config = [
2828
'description' => 'Describe what page we want',
29-
'fields' => function (): array {
30-
return [
31-
'offset' => [
32-
'type' => self::int(),
33-
'defaultValue' => null,
34-
'description' => 'The zero-based index of first item of the page. If given a value greater than zero, then `pageIndex` is ignored.',
35-
],
36-
'pageIndex' => [
37-
'type' => self::int(),
38-
'defaultValue' => 0,
39-
'description' => 'The zero-based index of the page. If given negative value, then fallback to 0.',
40-
],
41-
'pageSize' => [
42-
'type' => self::int(),
43-
'defaultValue' => 50,
44-
'description' => 'Number of items to display on a page. If given negative value, then fallback to 0.',
45-
],
46-
];
47-
},
29+
'fields' => fn (): array => [
30+
'offset' => [
31+
'type' => self::int(),
32+
'defaultValue' => null,
33+
'description' => 'The zero-based index of first item of the page. If given a value greater than zero, then `pageIndex` is ignored.',
34+
],
35+
'pageIndex' => [
36+
'type' => self::int(),
37+
'defaultValue' => 0,
38+
'description' => 'The zero-based index of the page. If given negative value, then fallback to 0.',
39+
],
40+
'pageSize' => [
41+
'type' => self::int(),
42+
'defaultValue' => 50,
43+
'description' => 'Number of items to display on a page. If given negative value, then fallback to 0.',
44+
],
45+
],
4846
];
4947

5048
parent::__construct($config);

src/Api/Server.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@
2020
*/
2121
class Server
2222
{
23-
/**
24-
* @var StandardServer
25-
*/
26-
private $server;
23+
private StandardServer $server;
2724

28-
/**
29-
* @var ServerConfig
30-
*/
31-
private $config;
25+
private ServerConfig $config;
3226

3327
public function __construct(Schema $schema, bool $debug, array $rootValue = [])
3428
{
@@ -61,7 +55,7 @@ public function execute(ServerRequestInterface $request)
6155
{
6256
if (!$request->getParsedBody()) {
6357
/** @var array $parsedBody */
64-
$parsedBody = json_decode($request->getBody()->getContents(), true);
58+
$parsedBody = json_decode($request->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
6559
$request = $request->withParsedBody($parsedBody);
6660
}
6761

src/DBAL/Types/ChronosType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
use Cake\Chronos\Chronos;
88
use DateTimeInterface;
99
use Doctrine\DBAL\Platforms\AbstractPlatform;
10+
use Doctrine\DBAL\Types\DateTimeType;
1011

11-
final class ChronosType extends \Doctrine\DBAL\Types\DateTimeType
12+
final class ChronosType extends DateTimeType
1213
{
1314
/**
1415
* @param null|DateTimeInterface|int|string $value

src/Handler/FileHandler.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
final class FileHandler extends AbstractHandler
1414
{
15-
/**
16-
* @var ObjectRepository
17-
*/
18-
private $fileRepository;
15+
private ObjectRepository $fileRepository;
1916

2017
public function __construct(ObjectRepository $fileRepository)
2118
{

src/Handler/GraphQLHandler.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
final class GraphQLHandler implements RequestHandlerInterface
1414
{
15-
/**
16-
* @var Server
17-
*/
18-
private $server;
15+
private Server $server;
1916

2017
public function __construct(Server $server)
2118
{

0 commit comments

Comments
 (0)