Skip to content

Commit

Permalink
release PHP 7.2 downgraded
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 23, 2024
1 parent ef82114 commit c117396
Show file tree
Hide file tree
Showing 315 changed files with 417 additions and 4,956 deletions.
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

File renamed without changes.
23 changes: 0 additions & 23 deletions build/rector-downgrade-php-72.php

This file was deleted.

3 changes: 0 additions & 3 deletions build/target-repository/.github/FUNDING.yml

This file was deleted.

24 changes: 0 additions & 24 deletions build/target-repository/composer.json

This file was deleted.

9 changes: 0 additions & 9 deletions build/target-repository/phpstan-for-tests.neon

This file was deleted.

13 changes: 0 additions & 13 deletions build/target-repository/tests/SomeClass.php.inc

This file was deleted.

47 changes: 3 additions & 44 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,21 @@
"description": "Set of Symplify rules for PHPStan",
"license": "MIT",
"require": {
"php": ">=8.1",
"php": "^7.2|^8.0",
"nette/utils": "^3.2.9 || ^4.0",
"webmozart/assert": "^1.11",
"phpstan/phpstan": "^1.11",
"symplify/rule-doc-generator-contracts": "^11.2"
},
"require-dev": {
"nikic/php-parser": "^4.19",
"symplify/phpstan-extensions": "^11.4",
"symplify/rule-doc-generator": "^12.2",
"phpunit/phpunit": "^10.5",
"symfony/framework-bundle": "6.1.*",
"rector/rector": "^1.2.3",
"symplify/easy-coding-standard": "^12.3",
"phpstan/extension-installer": "^1.4",
"tomasvotruba/class-leak": "^0.2",
"tomasvotruba/unused-public": "^0.3.10",
"tomasvotruba/type-coverage": "^0.3.1"
"phpstan/phpstan": "^1.10.30",
"webmozart/assert": "^1.11"
},
"autoload": {
"psr-4": {
"Symplify\\PHPStanRules\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Symplify\\PHPStanRules\\Tests\\": "tests"
},
"classmap": [
"stubs"
],
"files": [
"tests/Rules/Rector/PhpUpgradeImplementsMinPhpVersionInterfaceRule/Fixture/SomePhpFeatureRector.php",
"vendor/rector/rector/src/Contract/Rector/RectorInterface.php",
"vendor/rector/rector/src/Contract/Rector/ConfigurableRectorInterface.php",
"vendor/rector/rector/vendor/rector/rector-downgrade-php/src/Set/ValueObject/DowngradeSetList.php"
]
},
"extra": {
"phpstan": {
"includes": [
"config/services/services.neon"
]
}
},
"config": {
"platform-check": false,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"scripts": {
"check-cs": "vendor/bin/ecs check --ansi",
"fix-cs": "vendor/bin/ecs check --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
"rector": "vendor/bin/rector process --dry-run --ansi",
"docs": "vendor/bin/rule-doc-generator generate src --readme --ansi"
}
}
18 changes: 0 additions & 18 deletions ecs.php

This file was deleted.

15 changes: 0 additions & 15 deletions full-tool-build.sh

This file was deleted.

54 changes: 0 additions & 54 deletions phpstan.neon

This file was deleted.

7 changes: 0 additions & 7 deletions phpunit.xml

This file was deleted.

41 changes: 0 additions & 41 deletions rector.php

This file was deleted.

13 changes: 9 additions & 4 deletions src/Composer/ClassNamespaceMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@

final class ClassNamespaceMatcher
{
public function __construct(
private readonly DirectoryChecker $directoryChecker
) {
/**
* @readonly
* @var \Symplify\PHPStanRules\Location\DirectoryChecker
*/
private $directoryChecker;
public function __construct(DirectoryChecker $directoryChecker)
{
$this->directoryChecker = $directoryChecker;
}

/**
Expand Down Expand Up @@ -54,7 +59,7 @@ public function matchPossibleDirectoriesForClass(
* @param string|string[] $items
* @return string[]
*/
private function standardizeToArray(string | array $items): array
private function standardizeToArray($items): array
{
if (! is_array($items)) {
return [$items];
Expand Down
7 changes: 5 additions & 2 deletions src/Contract/PhpDocParser/PhpDocNodeVisitorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ interface PhpDocNodeVisitorInterface
{
public function beforeTraverse(Node $node): void;

public function enterNode(Node $node): int|Node|null;
/**
* @return int|\PHPStan\PhpDocParser\Ast\Node|null
*/
public function enterNode(Node $node);

/**
* @return null|int|\PhpParser\Node|Node[] Replacement node (or special return)
*/
public function leaveNode(Node $node): int|\PhpParser\Node|array|null;
public function leaveNode(Node $node);

public function afterTraverse(Node $node): void;
}
2 changes: 1 addition & 1 deletion src/Location/DirectoryChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function isInDirectoryNamed(Scope $scope, string $directoryName): bool
$normalized = $this->normalizePath($directoryName);
$directoryName = rtrim($normalized, '\/');

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

private function normalizePath(string $directoryName): string
Expand Down
8 changes: 4 additions & 4 deletions src/Naming/ClassToSuffixResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class ClassToSuffixResolver
{
public function resolveFromClass(string $parentClass): string
{
$expectedSuffix = \str_contains($parentClass, '\\') ? (string) Strings::after(
$expectedSuffix = strpos($parentClass, '\\') !== false ? (string) Strings::after(
$parentClass,
'\\',
-1
Expand All @@ -31,15 +31,15 @@ public function resolveFromClass(string $parentClass): string

private function removeAbstractInterfacePrefixSuffix(string $parentType): string
{
if (\str_ends_with($parentType, 'Interface')) {
if (substr_compare($parentType, 'Interface', -strlen('Interface')) === 0) {
$parentType = Strings::substring($parentType, 0, -strlen('Interface'));
}

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

if (\str_starts_with($parentType, 'Abstract')) {
if (strncmp($parentType, 'Abstract', strlen('Abstract')) === 0) {
return Strings::substring($parentType, strlen('Abstract'));
}

Expand Down
Loading

0 comments on commit c117396

Please sign in to comment.