Skip to content

Commit

Permalink
release PHP 7.4 downgraded
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 10, 2025
1 parent d4ae6c8 commit 549607d
Show file tree
Hide file tree
Showing 305 changed files with 303 additions and 4,742 deletions.
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

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

This file was deleted.

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

This file was deleted.

27 changes: 0 additions & 27 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.

38 changes: 2 additions & 36 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,10 @@
"description": "Set of Symplify rules for PHPStan",
"license": "MIT",
"require": {
"php": ">=8.2",
"webmozart/assert": "^1.11",
"php": "^7.4|^8.0",
"phpstan/phpstan": "^2.0",
"nette/utils": "^3.2|^4.0",
"phpstan/phpdoc-parser": "^2.0"
},
"require-dev": {
"nikic/php-parser": "^5.3",
"phpunit/phpunit": "^11.5",
"symfony/framework-bundle": "6.1.*",
"symplify/easy-coding-standard": "^12.5",
"tomasvotruba/class-leak": "^2.0",
"rector/rector": "^2.0.6",
"phpstan/extension-installer": "^1.4",
"symplify/phpstan-extensions": "^12.0",
"tomasvotruba/unused-public": "^2.0",
"tomasvotruba/type-coverage": "^2.0",
"shipmonk/composer-dependency-analyser": "^1.8"
"webmozart/assert": "^1.11"
},
"autoload": {
"psr-4": {
Expand All @@ -31,26 +17,6 @@
"src/functions/fast-functions.php"
]
},
"autoload-dev": {
"psr-4": {
"Symplify\\PHPStanRules\\Tests\\": "tests"
},
"classmap": [
"stubs"
]
},
"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",
"rector": "vendor/bin/rector process --dry-run --ansi"
},
"extra": {
"phpstan": {
"includes": [
Expand Down
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.

51 changes: 0 additions & 51 deletions phpstan.neon

This file was deleted.

15 changes: 0 additions & 15 deletions phpunit.xml

This file was deleted.

22 changes: 0 additions & 22 deletions rector.php

This file was deleted.

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;
}
4 changes: 2 additions & 2 deletions src/Doctrine/DoctrineEntityDocumentAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use PHPStan\PhpDoc\ResolvedPhpDocBlock;
use PHPStan\Reflection\ClassReflection;

final readonly class DoctrineEntityDocumentAnalyser
final class DoctrineEntityDocumentAnalyser
{
/**
* @var string[]
Expand All @@ -22,7 +22,7 @@ public static function isEntityClass(ClassReflection $classReflection): bool
}

foreach (self::ENTITY_DOCBLOCK_MARKERS as $entityDocBlockMarkers) {
if (str_contains($resolvedPhpDocBlock->getPhpDocString(), $entityDocBlockMarkers)) {
if (strpos($resolvedPhpDocBlock->getPhpDocString(), $entityDocBlockMarkers) !== false) {
return true;
}
}
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 = substr($parentType, 0, -strlen('Interface'));
}

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

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

Expand Down
13 changes: 10 additions & 3 deletions src/NodeAnalyzer/AttributeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@

final class AttributeFinder
{
public function hasAttribute(ClassLike | ClassMethod | Property | Param $node, string $desiredAttributeClass): bool
/**
* @param \PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Param $node
*/
public function hasAttribute($node, string $desiredAttributeClass): bool
{
return (bool) $this->findAttribute($node, $desiredAttributeClass);
}

/**
* @return Attribute[]
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Param $node
*/
private function findAttributes(ClassMethod | Property | ClassLike | Param $node): array
private function findAttributes($node): array
{
$attributes = [];

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

/**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Param $node
*/
private function findAttribute(
ClassMethod | Property | ClassLike | Param $node,
$node,
string $desiredAttributeClass
): ?Attribute {
$attributes = $this->findAttributes($node);
Expand Down
14 changes: 9 additions & 5 deletions src/NodeAnalyzer/EnumAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
use PHPStan\Reflection\ClassReflection;
use Symplify\PHPStanRules\PhpDoc\BarePhpDocParser;

final readonly class EnumAnalyzer
final class EnumAnalyzer
{
public function __construct(
private BarePhpDocParser $barePhpDocParser
) {
/**
* @readonly
*/
private BarePhpDocParser $barePhpDocParser;
public function __construct(BarePhpDocParser $barePhpDocParser)
{
$this->barePhpDocParser = $barePhpDocParser;
}

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

// is in /Enum/ namespace
return str_contains($classReflection->getName(), '\\Enum\\');
return strpos($classReflection->getName(), '\\Enum\\') !== false;
}

private function hasEnumAnnotation(Class_ $class): bool
Expand Down
2 changes: 1 addition & 1 deletion src/NodeAnalyzer/SymfonyRequiredMethodAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public static function detect(ClassMethod $classMethod): bool
return false;
}

return str_contains($docComment->getText(), '@required');
return strpos($docComment->getText(), '@required') !== false;
}
}
Loading

0 comments on commit 549607d

Please sign in to comment.