Skip to content

Commit 79f837d

Browse files
author
Alexander Miertsch
authored
Merge pull request #7 from event-engine/feature/PHP-7.4
Use PHP 7.4 property type hints
2 parents f49843a + 7ba24b1 commit 79f837d

16 files changed

+29
-137
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.2",
20-
"event-engine/php-data": "^1.0",
19+
"php": "^7.4",
20+
"event-engine/php-data": "^2.0-dev",
2121
"event-engine/php-engine-utils": "^0.1",
2222
"event-engine/php-schema": "^0.1",
2323
"ramsey/uuid": "^3.6"

tests/Stub/ArrayItemRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ private static function arrayPropItemTypeMap(): array
1818
/**
1919
* @var string[]
2020
*/
21-
private $friends;
21+
private array $friends;
2222

2323
/**
2424
* @return string[]

tests/Stub/CollectionItemAllowNestedRecord.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ final class CollectionItemAllowNestedRecord implements JsonSchemaAwareRecord
1010
{
1111
use JsonSchemaAwareRecordLogic;
1212

13-
/**
14-
* @var ScalarPropsRecordAllowNestedCollection
15-
*/
16-
private $friends;
13+
private ScalarPropsRecordAllowNestedCollection $friends;
1714

18-
/**
19-
* @return ScalarPropsRecordAllowNestedCollection
20-
*/
2115
public function friends(): ScalarPropsRecordAllowNestedCollection
2216
{
2317
return $this->friends;

tests/Stub/CollectionItemRecord.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ final class CollectionItemRecord implements JsonSchemaAwareRecord
1010
{
1111
use JsonSchemaAwareRecordLogic;
1212

13-
/**
14-
* @var ScalarPropsRecordCollection
15-
*/
16-
private $friends;
13+
private ScalarPropsRecordCollection $friends;
1714

18-
/**
19-
* @return ScalarPropsRecordCollection
20-
*/
2115
public function friends(): ScalarPropsRecordCollection
2216
{
2317
return $this->friends;

tests/Stub/NullableArrayItemRecordAllowNestedRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private static function __allowNestedSchema(): bool
2424
/**
2525
* @var ScalarPropsRecord[]|null
2626
*/
27-
private $friends;
27+
private ?array $friends;
2828

2929
/**
3030
* @return ScalarPropsRecord[]|null

tests/Stub/NullableArrayItemRecordRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ private static function arrayPropItemTypeMap(): array
1818
/**
1919
* @var ScalarPropsRecord[]|null
2020
*/
21-
private $friends;
21+
private ?array $friends;
2222

2323
/**
2424
* @return ScalarPropsRecord[]|null

tests/Stub/NullableScalarPropsRecord.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,29 @@ final class NullableScalarPropsRecord implements JsonSchemaAwareRecord
1010
{
1111
use JsonSchemaAwareRecordLogic;
1212

13-
/**
14-
* @var string|null
15-
*/
16-
private $userId;
13+
private ?string $userId;
1714

18-
/**
19-
* @var int|null
20-
*/
21-
private $age;
15+
private ?int $age;
2216

23-
/**
24-
* @var bool|null
25-
*/
26-
private $member;
17+
private ?bool $member;
2718

28-
/**
29-
* @var float|null
30-
*/
31-
private $score;
19+
private ?float $score;
3220

33-
/**
34-
* @return string|null
35-
*/
3621
public function userId(): ?string
3722
{
3823
return $this->userId;
3924
}
4025

41-
/**
42-
* @return int|null
43-
*/
4426
public function age(): ?int
4527
{
4628
return $this->age;
4729
}
4830

49-
/**
50-
* @return bool|null
51-
*/
5231
public function member(): ?bool
5332
{
5433
return $this->member;
5534
}
5635

57-
/**
58-
* @return float|null
59-
*/
6036
public function score(): ?float
6137
{
6238
return $this->score;

tests/Stub/ScalarPropsRecord.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,29 @@ final class ScalarPropsRecord implements JsonSchemaAwareRecord
1010
{
1111
use JsonSchemaAwareRecordLogic;
1212

13-
/**
14-
* @var string
15-
*/
16-
private $userId;
13+
private string $userId;
1714

18-
/**
19-
* @var int
20-
*/
21-
private $age;
15+
private int $age;
2216

23-
/**
24-
* @var bool
25-
*/
26-
private $member;
17+
private bool $member;
2718

28-
/**
29-
* @var float
30-
*/
31-
private $score;
19+
private float $score;
3220

33-
/**
34-
* @return string
35-
*/
3621
public function userId(): string
3722
{
3823
return $this->userId;
3924
}
4025

41-
/**
42-
* @return int
43-
*/
4426
public function age(): int
4527
{
4628
return $this->age;
4729
}
4830

49-
/**
50-
* @return bool
51-
*/
5231
public function member(): bool
5332
{
5433
return $this->member;
5534
}
5635

57-
/**
58-
* @return float
59-
*/
6036
public function score(): float
6137
{
6238
return $this->score;

tests/Stub/ScalarPropsRecordAllowNestedCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private static function __allowNestedSchema(): bool
2323
/**
2424
* @var ScalarPropsRecord[]
2525
*/
26-
private $items;
26+
private array $items;
2727

2828
public static function fromArray(array $items): self
2929
{

tests/Stub/ScalarPropsRecordCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function validationRules(): array
2525
/**
2626
* @var ScalarPropsRecord[]
2727
*/
28-
private $items;
28+
private array $items;
2929

3030
public static function fromArray(array $items): self
3131
{

0 commit comments

Comments
 (0)