Skip to content

Commit 8411b9a

Browse files
committed
release PHP 7.4 downgraded
1 parent adc4f08 commit 8411b9a

File tree

505 files changed

+429
-7737
lines changed

Some content is hidden

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

505 files changed

+429
-7737
lines changed

.editorconfig

Lines changed: 0 additions & 9 deletions
This file was deleted.

build/rector-downgrade-php.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

build/target-repository/.github/FUNDING.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

build/target-repository/composer.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

build/target-repository/phpstan-for-tests.neon

Lines changed: 0 additions & 9 deletions
This file was deleted.

build/target-repository/tests/SomeClass.php.inc

Lines changed: 0 additions & 13 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,10 @@
44
"description": "Set of Symplify rules for PHPStan",
55
"license": "MIT",
66
"require": {
7-
"php": ">=8.2",
8-
"webmozart/assert": "^1.11",
7+
"php": "^7.4|^8.0",
98
"phpstan/phpstan": "^2.1.8",
109
"nette/utils": "^3.2|^4.0",
11-
"phpstan/phpdoc-parser": "^2.1"
12-
},
13-
"require-dev": {
14-
"nikic/php-parser": "^5.4",
15-
"phpunit/phpunit": "^11.5",
16-
"symfony/framework-bundle": "6.1.*",
17-
"phpecs/phpecs": "^2.1",
18-
"tomasvotruba/class-leak": "^2.0",
19-
"rector/rector": "^2.0.11",
20-
"phpstan/extension-installer": "^1.4",
21-
"symplify/phpstan-extensions": "^12.0",
22-
"tomasvotruba/unused-public": "^2.0",
23-
"tomasvotruba/type-coverage": "^2.0",
24-
"shipmonk/composer-dependency-analyser": "^1.8"
10+
"webmozart/assert": "^1.11"
2511
},
2612
"autoload": {
2713
"psr-4": {
@@ -31,26 +17,6 @@
3117
"src/functions/fast-functions.php"
3218
]
3319
},
34-
"autoload-dev": {
35-
"psr-4": {
36-
"Symplify\\PHPStanRules\\Tests\\": "tests"
37-
},
38-
"classmap": [
39-
"stubs"
40-
]
41-
},
42-
"config": {
43-
"platform-check": false,
44-
"allow-plugins": {
45-
"phpstan/extension-installer": true
46-
}
47-
},
48-
"scripts": {
49-
"check-cs": "vendor/bin/ecs check --ansi",
50-
"fix-cs": "vendor/bin/ecs check --fix --ansi",
51-
"phpstan": "vendor/bin/phpstan analyse --ansi",
52-
"rector": "vendor/bin/rector process --dry-run --ansi"
53-
},
5420
"extra": {
5521
"phpstan": {
5622
"includes": [

ecs.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

phpstan.neon

Lines changed: 0 additions & 54 deletions
This file was deleted.

phpunit.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

rector.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/Contract/PhpDocParser/PhpDocNodeVisitorInterface.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ interface PhpDocNodeVisitorInterface
1313
{
1414
public function beforeTraverse(Node $node): void;
1515

16-
public function enterNode(Node $node): int|Node|null;
16+
/**
17+
* @return int|\PHPStan\PhpDocParser\Ast\Node|null
18+
*/
19+
public function enterNode(Node $node);
1720

1821
/**
1922
* @return null|int|\PhpParser\Node|Node[] Replacement node (or special return)
2023
*/
21-
public function leaveNode(Node $node): int|\PhpParser\Node|array|null;
24+
public function leaveNode(Node $node);
2225

2326
public function afterTraverse(Node $node): void;
2427
}

src/Doctrine/DoctrineEntityDocumentAnalyser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use PHPStan\PhpDoc\ResolvedPhpDocBlock;
88
use PHPStan\Reflection\ClassReflection;
99

10-
final readonly class DoctrineEntityDocumentAnalyser
10+
final class DoctrineEntityDocumentAnalyser
1111
{
1212
/**
1313
* @var string[]
@@ -22,7 +22,7 @@ public static function isEntityClass(ClassReflection $classReflection): bool
2222
}
2323

2424
foreach (self::ENTITY_DOCBLOCK_MARKERS as $entityDocBlockMarkers) {
25-
if (str_contains($resolvedPhpDocBlock->getPhpDocString(), $entityDocBlockMarkers)) {
25+
if (strpos($resolvedPhpDocBlock->getPhpDocString(), $entityDocBlockMarkers) !== false) {
2626
return true;
2727
}
2828
}

src/Doctrine/RepositoryClassResolver.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
use PHPStan\Reflection\ReflectionProvider;
1010
use Rector\Exception\ShouldNotHappenException;
1111

12-
final readonly class RepositoryClassResolver
12+
final class RepositoryClassResolver
1313
{
14+
/**
15+
* @readonly
16+
*/
17+
private ReflectionProvider $reflectionProvider;
1418
/**
1519
* @var string
1620
*/
@@ -35,9 +39,9 @@
3539
self::USE_REPOSITORY_REGEX,
3640
];
3741

38-
public function __construct(
39-
private ReflectionProvider $reflectionProvider
40-
) {
42+
public function __construct(ReflectionProvider $reflectionProvider)
43+
{
44+
$this->reflectionProvider = $reflectionProvider;
4145
}
4246

4347
public function resolveFromEntityClass(string $entityClassName): ?string

src/Naming/ClassToSuffixResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class ClassToSuffixResolver
1313
{
1414
public function resolveFromClass(string $parentClass): string
1515
{
16-
$expectedSuffix = \str_contains($parentClass, '\\') ? (string) Strings::after(
16+
$expectedSuffix = strpos($parentClass, '\\') !== false ? (string) Strings::after(
1717
$parentClass,
1818
'\\',
1919
-1
@@ -31,15 +31,15 @@ public function resolveFromClass(string $parentClass): string
3131

3232
private function removeAbstractInterfacePrefixSuffix(string $parentType): string
3333
{
34-
if (\str_ends_with($parentType, 'Interface')) {
34+
if (substr_compare($parentType, 'Interface', -strlen('Interface')) === 0) {
3535
$parentType = substr($parentType, 0, -strlen('Interface'));
3636
}
3737

38-
if (\str_ends_with($parentType, 'Abstract')) {
38+
if (substr_compare($parentType, 'Abstract', -strlen('Abstract')) === 0) {
3939
$parentType = substr($parentType, 0, -strlen('Abstract'));
4040
}
4141

42-
if (\str_starts_with($parentType, 'Abstract')) {
42+
if (strncmp($parentType, 'Abstract', strlen('Abstract')) === 0) {
4343
return substr($parentType, strlen('Abstract'));
4444
}
4545

src/NodeAnalyzer/AttributeFinder.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313

1414
final class AttributeFinder
1515
{
16-
public function hasAttribute(ClassLike | ClassMethod | Property | Param $node, string $desiredAttributeClass): bool
16+
/**
17+
* @param \PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Param $node
18+
*/
19+
public function hasAttribute($node, string $desiredAttributeClass): bool
1720
{
1821
return (bool) $this->findAttribute($node, $desiredAttributeClass);
1922
}
2023

2124
/**
2225
* @return Attribute[]
26+
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Param $node
2327
*/
24-
private function findAttributes(ClassMethod | Property | ClassLike | Param $node): array
28+
private function findAttributes($node): array
2529
{
2630
$attributes = [];
2731

@@ -32,8 +36,11 @@ private function findAttributes(ClassMethod | Property | ClassLike | Param $node
3236
return $attributes;
3337
}
3438

39+
/**
40+
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Param $node
41+
*/
3542
private function findAttribute(
36-
ClassMethod | Property | ClassLike | Param $node,
43+
$node,
3744
string $desiredAttributeClass
3845
): ?Attribute {
3946
$attributes = $this->findAttributes($node);

src/NodeAnalyzer/EnumAnalyzer.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@
1212
use PHPStan\Reflection\ClassReflection;
1313
use Symplify\PHPStanRules\PhpDoc\BarePhpDocParser;
1414

15-
final readonly class EnumAnalyzer
15+
final class EnumAnalyzer
1616
{
17-
public function __construct(
18-
private BarePhpDocParser $barePhpDocParser
19-
) {
17+
/**
18+
* @readonly
19+
*/
20+
private BarePhpDocParser $barePhpDocParser;
21+
public function __construct(BarePhpDocParser $barePhpDocParser)
22+
{
23+
$this->barePhpDocParser = $barePhpDocParser;
2024
}
2125

2226
public function detect(Scope $scope, ClassLike $classLike): bool
@@ -39,7 +43,7 @@ public function detect(Scope $scope, ClassLike $classLike): bool
3943
}
4044

4145
// is in /Enum/ namespace
42-
return str_contains($classReflection->getName(), '\\Enum\\');
46+
return strpos($classReflection->getName(), '\\Enum\\') !== false;
4347
}
4448

4549
private function hasEnumAnnotation(Class_ $class): bool

0 commit comments

Comments
 (0)