Skip to content

Commit a0b6bbc

Browse files
committed
Downgrade to php 7.3
1 parent 8ea4d87 commit a0b6bbc

21 files changed

+484
-485
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.4 || ^8.0",
13+
"php": "^7.3 || ^8.0",
1414
"phpdocumentor/reflection-common": "^2.0",
1515
"phpstan/phpdoc-parser": "^1.13",
1616
"doctrine/deprecations": "^1.0"
@@ -42,7 +42,7 @@
4242
},
4343
"config": {
4444
"platform": {
45-
"php": "7.4.0"
45+
"php": "7.3.0"
4646
},
4747
"allow-plugins": {
4848
"phpstan/extension-installer": true

composer.lock

+343-412
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rector.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
66
use Rector\Config\RectorConfig;
7+
use Rector\Set\ValueObject\DowngradeLevelSetList;
78
use Rector\Set\ValueObject\LevelSetList;
89

910
return static function (RectorConfig $rectorConfig): void {
@@ -21,6 +22,6 @@
2122

2223
// define sets of rules
2324
$rectorConfig->sets([
24-
LevelSetList::UP_TO_PHP_74
25+
DowngradeLevelSetList::DOWN_TO_PHP_73
2526
]);
2627
};

src/PseudoTypes/ArrayShape.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class ArrayShape implements PseudoType
2626
{
2727
/** @var ArrayShapeItem[] */
28-
private array $items;
28+
private $items;
2929

3030
public function __construct(ArrayShapeItem ...$items)
3131
{

src/PseudoTypes/ArrayShapeItem.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@
2020

2121
final class ArrayShapeItem
2222
{
23-
private ?string $key;
24-
private Type $value;
25-
private bool $optional;
23+
/**
24+
* @var string|null
25+
*/
26+
private $key;
27+
/**
28+
* @var Type
29+
*/
30+
private $value;
31+
/**
32+
* @var bool
33+
*/
34+
private $optional;
2635

2736
public function __construct(?string $key, ?Type $value, bool $optional)
2837
{

src/PseudoTypes/ConstExpression.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@
2222
/** @psalm-immutable */
2323
final class ConstExpression implements PseudoType
2424
{
25-
private Type $owner;
26-
private string $expression;
25+
/**
26+
* @var Type
27+
*/
28+
private $owner;
29+
/**
30+
* @var string
31+
*/
32+
private $expression;
2733

2834
public function __construct(Type $owner, string $expression)
2935
{

src/PseudoTypes/FloatValue.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
/** @psalm-immutable */
2121
class FloatValue implements PseudoType
2222
{
23-
private float $value;
23+
/**
24+
* @var float
25+
*/
26+
private $value;
2427

2528
public function __construct(float $value)
2629
{

src/PseudoTypes/IntegerRange.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@
2424
*/
2525
final class IntegerRange extends Integer implements PseudoType
2626
{
27-
private string $minValue;
27+
/**
28+
* @var string
29+
*/
30+
private $minValue;
2831

29-
private string $maxValue;
32+
/**
33+
* @var string
34+
*/
35+
private $maxValue;
3036

3137
public function __construct(string $minValue, string $maxValue)
3238
{

src/PseudoTypes/IntegerValue.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
/** @psalm-immutable */
2121
final class IntegerValue implements PseudoType
2222
{
23-
private int $value;
23+
/**
24+
* @var int
25+
*/
26+
private $value;
2427

2528
public function __construct(int $value)
2629
{

src/PseudoTypes/StringValue.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
/** @psalm-immutable */
2323
class StringValue implements PseudoType
2424
{
25-
private string $value;
25+
/**
26+
* @var string
27+
*/
28+
private $value;
2629

2730
public function __construct(string $value)
2831
{

src/TypeResolver.php

+43-42
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ final class TypeResolver
115115
* @var array<string, string> List of recognized keywords and unto which Value Object they map
116116
* @psalm-var array<string, class-string<Type>>
117117
*/
118-
private array $keywords = [
118+
private $keywords = [
119119
'string' => String_::class,
120120
'class-string' => ClassString::class,
121121
'interface-string' => InterfaceString::class,
@@ -159,12 +159,15 @@ final class TypeResolver
159159
'non-empty-list' => NonEmptyList::class,
160160
];
161161

162-
/** @psalm-readonly */
163-
private FqsenResolver $fqsenResolver;
164-
/** @psalm-readonly */
165-
private TypeParser $typeParser;
166-
/** @psalm-readonly */
167-
private Lexer $lexer;
162+
/** @psalm-readonly
163+
* @var FqsenResolver */
164+
private $fqsenResolver;
165+
/** @psalm-readonly
166+
* @var TypeParser */
167+
private $typeParser;
168+
/** @psalm-readonly
169+
* @var Lexer */
170+
private $lexer;
168171

169172
/**
170173
* Initializes this TypeResolver with the means to create and resolve Fqsen objects.
@@ -227,11 +230,13 @@ public function createType(?TypeNode $type, Context $context): Type
227230
case ArrayShapeNode::class:
228231
return new ArrayShape(
229232
...array_map(
230-
fn (ArrayShapeItemNode $item) => new ArrayShapeItem(
231-
(string) $item->keyName,
232-
$this->createType($item->valueType, $context),
233-
$item->optional
234-
),
233+
function (ArrayShapeItemNode $item) use ($context) : ArrayShapeItem {
234+
return new ArrayShapeItem(
235+
(string) $item->keyName,
236+
$this->createType($item->valueType, $context),
237+
$item->optional
238+
);
239+
},
235240
$type->items
236241
)
237242
);
@@ -252,7 +257,7 @@ public function createType(?TypeNode $type, Context $context): Type
252257
return new Intersection(
253258
array_filter(
254259
array_map(
255-
function (TypeNode $nestedType) use ($context) {
260+
function (TypeNode $nestedType) use ($context): Type {
256261
$type = $this->createType($nestedType, $context);
257262
if ($type instanceof AggregatedType) {
258263
return new Expression($type);
@@ -274,7 +279,7 @@ function (TypeNode $nestedType) use ($context) {
274279
return new Compound(
275280
array_filter(
276281
array_map(
277-
function (TypeNode $nestedType) use ($context) {
282+
function (TypeNode $nestedType) use ($context): Type {
278283
$type = $this->createType($nestedType, $context);
279284
if ($type instanceof AggregatedType) {
280285
return new Expression($type);
@@ -343,16 +348,15 @@ private function createFromGeneric(GenericTypeNode $type, Context $context): Typ
343348
throw new RuntimeException('int<min,max> has not the correct format');
344349
}
345350

346-
return new IntegerRange(
347-
(string) $type->genericTypes[0],
348-
(string) $type->genericTypes[1],
349-
);
351+
return new IntegerRange((string) $type->genericTypes[0], (string) $type->genericTypes[1]);
350352

351353
case 'iterable':
352354
return new Iterable_(
353355
...array_reverse(
354356
array_map(
355-
fn (TypeNode $genericType) => $this->createType($genericType, $context),
357+
function (TypeNode $genericType) use ($context) : Type {
358+
return $this->createType($genericType, $context);
359+
},
356360
$type->genericTypes
357361
)
358362
)
@@ -368,7 +372,9 @@ private function createFromGeneric(GenericTypeNode $type, Context $context): Typ
368372
$collectionType->getFqsen(),
369373
...array_reverse(
370374
array_map(
371-
fn (TypeNode $genericType) => $this->createType($genericType, $context),
375+
function (TypeNode $genericType) use ($context) : Type {
376+
return $this->createType($genericType, $context);
377+
},
372378
$type->genericTypes
373379
)
374380
)
@@ -378,21 +384,18 @@ private function createFromGeneric(GenericTypeNode $type, Context $context): Typ
378384

379385
private function createFromCallable(CallableTypeNode $type, Context $context): Callable_
380386
{
381-
return new Callable_(
382-
array_map(
383-
function (CallableTypeParameterNode $param) use ($context) {
384-
return new CallableParameter(
385-
$this->createType($param->type, $context),
386-
$param->parameterName !== '' ? trim($param->parameterName, '$') : null,
387-
$param->isReference,
388-
$param->isVariadic,
389-
$param->isOptional
390-
);
391-
},
392-
$type->parameters
393-
),
394-
$this->createType($type->returnType, $context),
395-
);
387+
return new Callable_(array_map(
388+
function (CallableTypeParameterNode $param) use ($context): CallableParameter {
389+
return new CallableParameter(
390+
$this->createType($param->type, $context),
391+
$param->parameterName !== '' ? trim($param->parameterName, '$') : null,
392+
$param->isReference,
393+
$param->isVariadic,
394+
$param->isOptional
395+
);
396+
},
397+
$type->parameters
398+
), $this->createType($type->returnType, $context));
396399
}
397400

398401
private function createFromConst(ConstTypeNode $type, Context $context): Type
@@ -542,7 +545,9 @@ private function createArray(array $typeNodes, Context $context): Array_
542545
{
543546
$types = array_reverse(
544547
array_map(
545-
fn (TypeNode $node) => $this->createType($node, $context),
548+
function (TypeNode $node) use ($context) : Type {
549+
return $this->createType($node, $context);
550+
},
546551
$typeNodes
547552
)
548553
);
@@ -592,12 +597,8 @@ private function tryParseRemainingCompoundTypes(TokenIterator $tokenIterator, Co
592597
$tokenIterator->isCurrentTokenType(Lexer::TOKEN_UNION) ||
593598
$tokenIterator->isCurrentTokenType(Lexer::TOKEN_INTERSECTION)
594599
) {
595-
Deprecation::trigger(
596-
'phpdocumentor/type-resolver',
597-
'https://github.com/phpDocumentor/TypeResolver/issues/184',
598-
'Legacy nullable type detected, please update your code as
599-
you are using nullable types in a docblock. support will be removed in v2.0.0',
600-
);
600+
Deprecation::trigger('phpdocumentor/type-resolver', 'https://github.com/phpDocumentor/TypeResolver/issues/184', 'Legacy nullable type detected, please update your code as
601+
you are using nullable types in a docblock. support will be removed in v2.0.0');
601602
}
602603

603604
$continue = true;

src/Types/AggregatedType.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ abstract class AggregatedType implements Type, IteratorAggregate
3434
* @psalm-allow-private-mutation
3535
* @var array<int, Type>
3636
*/
37-
private array $types = [];
37+
private $types = [];
3838

39-
private string $token;
39+
/**
40+
* @var string
41+
*/
42+
private $token;
4043

4144
/**
4245
* @param array<Type> $types

src/Types/CallableParameter.php

+20-5
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,30 @@
2121
*/
2222
final class CallableParameter
2323
{
24-
private Type $type;
24+
/**
25+
* @var Type
26+
*/
27+
private $type;
2528

26-
private bool $isReference;
29+
/**
30+
* @var bool
31+
*/
32+
private $isReference;
2733

28-
private bool $isVariadic;
34+
/**
35+
* @var bool
36+
*/
37+
private $isVariadic;
2938

30-
private bool $isOptional;
39+
/**
40+
* @var bool
41+
*/
42+
private $isOptional;
3143

32-
private ?string $name;
44+
/**
45+
* @var string|null
46+
*/
47+
private $name;
3348

3449
public function __construct(
3550
Type $type,

src/Types/Callable_.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222
*/
2323
final class Callable_ implements Type
2424
{
25-
private ?Type $returnType;
25+
/**
26+
* @var Type|null
27+
*/
28+
private $returnType;
2629
/** @var CallableParameter[] */
27-
private array $parameters;
30+
private $parameters;
2831

2932
/**
3033
* @param CallableParameter[] $parameters

src/Types/ClassString.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
*/
2525
final class ClassString extends String_ implements PseudoType
2626
{
27-
private ?Fqsen $fqsen;
27+
/**
28+
* @var Fqsen|null
29+
*/
30+
private $fqsen;
2831

2932
/**
3033
* Initializes this representation of a class string with the given Fqsen.

src/Types/Collection.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
*/
3232
final class Collection extends AbstractList
3333
{
34-
private ?Fqsen $fqsen;
34+
/**
35+
* @var Fqsen|null
36+
*/
37+
private $fqsen;
3538

3639
/**
3740
* Initializes this representation of an array with the given Type or Fqsen.

0 commit comments

Comments
 (0)