Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/PHPStan/Build/RequiredPhpVersionVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function enterNode(Node $node): ?Node
}

if ($node instanceof Node\UnionType) {
$this->require(self::PHP_8_0, 'union types', $node);
foreach ($node->types as $innerType) {
if ($innerType instanceof Node\IntersectionType) {
$this->require(self::PHP_8_2, 'disjunctive normal form types', $innerType);
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/data/bug-9860.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php declare(strict_types = 1); // lint >= 8.0

namespace Bug9860;

Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/nsrt/bug-11703.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types = 1);

<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug11703;

use function PHPStan\Testing\assertType;
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/nsrt/bug-12125.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types = 1);

<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug12125;

use ArrayAccess;
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/nsrt/bug-13358.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types = 1);

<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug13358;

use function PHPStan\Testing\assertType;
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/nsrt/bug-14319.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace Bug14319;

Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/nsrt/bug-14710.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types = 1);

<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug14710;

use function PHPStan\Testing\assertType;
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/nsrt/bug-7259.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types = 1);

<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug7259;

use function PHPStan\Testing\assertType;
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/nsrt/bug-7987.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types=1);

<?php // lint >= 8.0
declare(strict_types=1);
namespace Bug7987;

use function PHPStan\Testing\assertType;
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/nsrt/bug-9208.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace Bug9208;

Expand Down
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/nsrt/bug-9360.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php declare(strict_types = 1);

<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug9360;

use function PHPStan\Testing\assertType;
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/nsrt/bug-9404.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace Bug9404;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/nsrt/date-format.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace DateFormatReturnType;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/nsrt/native-expressions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace NativeExpressions;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/nsrt/preg_split.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace PregSplit;

Expand Down
3 changes: 3 additions & 0 deletions tests/PHPStan/Build/RequiredPhpVersionCommentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ public static function dataDetectedVersion(): iterable
yield 'enum' => ['<?php enum Foo { case A; }', 80100];
yield 'readonly property' => ['<?php class Foo { public readonly int $x; }', 80100];
yield 'readonly promoted property' => ['<?php class Foo { public function __construct(public readonly int $x) {} }', 80100];
yield 'union type' => ['<?php function foo(A|B $x) {}', 80000];
yield 'union return type' => ['<?php function foo(): A|B {}', 80000];
yield 'nullable union type' => ['<?php function foo(A|null $x) {}', 80000];
yield 'intersection type' => ['<?php function foo(A&B $x) {}', 80100];
yield 'first-class callable' => ['<?php strlen(...);', 80100];
yield 'readonly class' => ['<?php readonly class Foo {}', 80200];
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Functions/data/bug-5760.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php declare(strict_types=1); // lint >= 8.0

namespace Bug5760;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Functions/data/bug-6448.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace Bug6448;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Functions/data/bug-7138.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace Bug7138;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Functions/data/bug-9652.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php declare(strict_types = 1); // lint >= 8.0

namespace Bug9652;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Methods/data/bug-11663.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php declare(strict_types = 1); // lint >= 8.0

namespace Bug11663;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Methods/data/bug-12558.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php declare(strict_types = 1); // lint >= 8.0

namespace Bug12558;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Methods/data/bug-12884.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php declare(strict_types = 1); // lint >= 8.0

namespace Bug12884;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Methods/data/bug-14617.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php declare(strict_types = 1); // lint >= 8.0

namespace Bug14617;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Methods/data/bug-8071.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace Bug8071;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types = 1);
<?php declare(strict_types = 1); // lint >= 8.0

namespace InvalidCallablePropertyType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php declare(strict_types=1); // lint >= 8.0

namespace InvalidUnionWithNever;

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Types/data/invalid-union-with-void.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php declare(strict_types=1); // lint >= 8.0

namespace InvalidUnionWithVoid;

Expand Down
Loading