Skip to content

Commit 94300a4

Browse files
committed
release PHP 7.2 downgraded
1 parent 69e4d29 commit 94300a4

File tree

314 files changed

+417
-4943
lines changed

Some content is hidden

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

314 files changed

+417
-4943
lines changed

.editorconfig

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

build/rector-downgrade-php-72.php

Lines changed: 0 additions & 23 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 & 24 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: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,21 @@
44
"description": "Set of Symplify rules for PHPStan",
55
"license": "MIT",
66
"require": {
7-
"php": ">=8.1",
7+
"php": "^7.2|^8.0",
88
"nette/utils": "^3.2.9 || ^4.0",
9-
"webmozart/assert": "^1.11",
10-
"phpstan/phpstan": "^1.11",
11-
"symplify/rule-doc-generator-contracts": "^11.2"
12-
},
13-
"require-dev": {
14-
"nikic/php-parser": "^4.19",
15-
"symplify/phpstan-extensions": "^11.4",
16-
"symplify/rule-doc-generator": "^12.1",
17-
"phpunit/phpunit": "^10.5",
18-
"symfony/framework-bundle": "6.1.*",
19-
"rector/rector": "^1.1",
20-
"symplify/easy-coding-standard": "^12.2",
21-
"phpstan/extension-installer": "^1.3",
22-
"tomasvotruba/class-leak": "^0.2"
9+
"phpstan/phpstan": "^1.10.30",
10+
"webmozart/assert": "^1.11"
2311
},
2412
"autoload": {
2513
"psr-4": {
2614
"Symplify\\PHPStanRules\\": "src"
2715
}
2816
},
29-
"autoload-dev": {
30-
"psr-4": {
31-
"Symplify\\PHPStanRules\\Tests\\": "tests"
32-
},
33-
"classmap": [
34-
"stubs"
35-
],
36-
"files": [
37-
"tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/Fixture/SomePhpFeatureRector.php",
38-
"vendor/rector/rector/src/Contract/Rector/RectorInterface.php",
39-
"vendor/rector/rector/src/Contract/Rector/ConfigurableRectorInterface.php",
40-
"vendor/rector/rector/vendor/rector/rector-downgrade-php/src/Set/ValueObject/DowngradeSetList.php"
41-
]
42-
},
4317
"extra": {
4418
"phpstan": {
4519
"includes": [
4620
"config/services/services.neon"
4721
]
4822
}
49-
},
50-
"config": {
51-
"platform-check": false,
52-
"allow-plugins": {
53-
"phpstan/extension-installer": true
54-
}
55-
},
56-
"scripts": {
57-
"check-cs": "vendor/bin/ecs check --ansi",
58-
"fix-cs": "vendor/bin/ecs check --fix --ansi",
59-
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
60-
"rector": "vendor/bin/rector process --dry-run --ansi",
61-
"docs": "vendor/bin/rule-doc-generator generate src --output-file docs/rules_overview.md --ansi"
6223
}
6324
}

ecs.php

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

full-tool-build.sh

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

phpstan.neon

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

phpunit.xml

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

rector.php

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

src/Composer/ClassNamespaceMatcher.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010

1111
final class ClassNamespaceMatcher
1212
{
13-
public function __construct(
14-
private readonly DirectoryChecker $directoryChecker
15-
) {
13+
/**
14+
* @readonly
15+
* @var \Symplify\PHPStanRules\Location\DirectoryChecker
16+
*/
17+
private $directoryChecker;
18+
public function __construct(DirectoryChecker $directoryChecker)
19+
{
20+
$this->directoryChecker = $directoryChecker;
1621
}
1722

1823
/**
@@ -54,7 +59,7 @@ public function matchPossibleDirectoriesForClass(
5459
* @param string|string[] $items
5560
* @return string[]
5661
*/
57-
private function standardizeToArray(string | array $items): array
62+
private function standardizeToArray($items): array
5863
{
5964
if (! is_array($items)) {
6065
return [$items];

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/Location/DirectoryChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function isInDirectoryNamed(Scope $scope, string $directoryName): bool
1313
$normalized = $this->normalizePath($directoryName);
1414
$directoryName = rtrim($normalized, '\/');
1515

16-
return \str_contains($scope->getFile(), DIRECTORY_SEPARATOR . $directoryName . DIRECTORY_SEPARATOR);
16+
return strpos($scope->getFile(), DIRECTORY_SEPARATOR . $directoryName . DIRECTORY_SEPARATOR) !== false;
1717
}
1818

1919
private function normalizePath(string $directoryName): 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 = Strings::substring($parentType, 0, -strlen('Interface'));
3636
}
3737

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

42-
if (\str_starts_with($parentType, 'Abstract')) {
42+
if (strncmp($parentType, 'Abstract', strlen('Abstract')) === 0) {
4343
return Strings::substring($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);

0 commit comments

Comments
 (0)