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 Jun 16, 2024
1 parent 4b2b573 commit 81f215a
Show file tree
Hide file tree
Showing 156 changed files with 229 additions and 2,682 deletions.
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

File renamed without changes.
12 changes: 0 additions & 12 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.

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

This file was deleted.

30 changes: 1 addition & 29 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,20 @@
"description": "Next level type declaration checks",
"license": "MIT",
"require": {
"php": "^8.2",
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.11",
"webmozart/assert": "^1.11"
},
"require-dev": {
"nikic/php-parser": "^4.19",
"symplify/phpstan-extensions": "^11.4",
"symplify/rule-doc-generator": "^12.1",
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.1",
"symplify/easy-coding-standard": "^12.1",
"phpstan/extension-installer": "^1.3",
"tomasvotruba/class-leak": "^0.2",
"tracy/tracy": "^2.10"
},
"autoload": {
"psr-4": {
"Rector\\TypePerfect\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Rector\\TypePerfect\\Tests\\": "tests"
}
},
"extra": {
"phpstan": {
"includes": [
"config/extension.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"
}
}
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.

File renamed without changes.
22 changes: 0 additions & 22 deletions phpstan.neon

This file was deleted.

12 changes: 0 additions & 12 deletions phpunit.xml

This file was deleted.

28 changes: 0 additions & 28 deletions rector.php

This file was deleted.

27 changes: 21 additions & 6 deletions src/Collector/ClassMethod/PublicClassMethodParamTypesCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,28 @@
/**
* @implements Collector<ClassMethod, array{class-string, string, string, int}|null>
*/
final readonly class PublicClassMethodParamTypesCollector implements Collector
final class PublicClassMethodParamTypesCollector implements Collector
{
public function __construct(
private ApiDocStmtAnalyzer $apiDocStmtAnalyzer,
private PublicClassMethodMatcher $publicClassMethodMatcher,
private CollectorMetadataPrinter $collectorMetadataPrinter
) {
/**
* @readonly
* @var \Rector\TypePerfect\PhpDoc\ApiDocStmtAnalyzer
*/
private $apiDocStmtAnalyzer;
/**
* @readonly
* @var \Rector\TypePerfect\Matcher\Collector\PublicClassMethodMatcher
*/
private $publicClassMethodMatcher;
/**
* @readonly
* @var \Rector\TypePerfect\Printer\CollectorMetadataPrinter
*/
private $collectorMetadataPrinter;
public function __construct(ApiDocStmtAnalyzer $apiDocStmtAnalyzer, PublicClassMethodMatcher $publicClassMethodMatcher, CollectorMetadataPrinter $collectorMetadataPrinter)
{
$this->apiDocStmtAnalyzer = $apiDocStmtAnalyzer;
$this->publicClassMethodMatcher = $publicClassMethodMatcher;
$this->collectorMetadataPrinter = $collectorMetadataPrinter;
}

public function getNodeType(): string
Expand Down
21 changes: 15 additions & 6 deletions src/Collector/MethodCall/MethodCallArgTypesCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@
/**
* @implements Collector<MethodCall, array<string>|null>
*/
final readonly class MethodCallArgTypesCollector implements Collector
final class MethodCallArgTypesCollector implements Collector
{
public function __construct(
private ClassMethodCallReferenceResolver $classMethodCallReferenceResolver,
private CollectorMetadataPrinter $collectorMetadataPrinter,
) {
/**
* @readonly
* @var \Rector\TypePerfect\Matcher\ClassMethodCallReferenceResolver
*/
private $classMethodCallReferenceResolver;
/**
* @readonly
* @var \Rector\TypePerfect\Printer\CollectorMetadataPrinter
*/
private $collectorMetadataPrinter;
public function __construct(ClassMethodCallReferenceResolver $classMethodCallReferenceResolver, CollectorMetadataPrinter $collectorMetadataPrinter)
{
$this->classMethodCallReferenceResolver = $classMethodCallReferenceResolver;
$this->collectorMetadataPrinter = $collectorMetadataPrinter;
}

public function getNodeType(): string
{
return MethodCall::class;
Expand Down
14 changes: 9 additions & 5 deletions src/Collector/MethodCallableNode/MethodCallableCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
*
* @see https://github.com/phpstan/phpstan-src/blob/511c1e435fb43b8eb0ac310e6aa3230147963790/src/Analyser/NodeScopeResolver.php#L1936
*/
final readonly class MethodCallableCollector implements Collector
final class MethodCallableCollector implements Collector
{
public function __construct(
private ClassMethodCallReferenceResolver $classMethodCallReferenceResolver,
) {
/**
* @readonly
* @var \Rector\TypePerfect\Matcher\ClassMethodCallReferenceResolver
*/
private $classMethodCallReferenceResolver;
public function __construct(ClassMethodCallReferenceResolver $classMethodCallReferenceResolver)
{
$this->classMethodCallReferenceResolver = $classMethodCallReferenceResolver;
}

public function getNodeType(): string
{
return MethodCallableNode::class;
Expand Down
7 changes: 6 additions & 1 deletion src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@

final class Configuration
{
/**
* @var array<string, mixed>
*/
private $parameters;
/**
* @param array<string, mixed> $parameters
*/
public function __construct(
private array $parameters
array $parameters
) {
$this->parameters = $parameters;
// enabed by default in tests
if (defined('PHPUNIT_COMPOSER_INSTALL')) {
$this->parameters['narrow_param'] = true;
Expand Down
5 changes: 4 additions & 1 deletion src/Matcher/ClassMethodCallReferenceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

final class ClassMethodCallReferenceResolver
{
public function resolve(MethodCall|MethodCallableNode $methodCallOrMethodCallable, Scope $scope, bool $allowThisType): ?MethodCallReference
/**
* @param \PhpParser\Node\Expr\MethodCall|\PHPStan\Node\MethodCallableNode $methodCallOrMethodCallable
*/
public function resolve($methodCallOrMethodCallable, Scope $scope, bool $allowThisType): ?MethodCallReference
{
if ($methodCallOrMethodCallable instanceof MethodCallableNode) {
$methodName = $methodCallOrMethodCallable->getName();
Expand Down
2 changes: 1 addition & 1 deletion src/Matcher/Collector/PublicClassMethodMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ public function shouldSkipClassMethod(ClassMethod $classMethod): bool
$doc = $classMethod->getDocComment();

// skip symfony action
return $doc instanceof Doc && str_contains($doc->getText(), '@Route');
return $doc instanceof Doc && strpos($doc->getText(), '@Route') !== false;
}
}
14 changes: 9 additions & 5 deletions src/NodeFinder/ClassMethodNodeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@
use PHPStan\Reflection\ClassReflection;
use Rector\TypePerfect\Reflection\ReflectionParser;

final readonly class ClassMethodNodeFinder
final class ClassMethodNodeFinder
{
public function __construct(
private ReflectionParser $reflectionParser,
) {
/**
* @readonly
* @var \Rector\TypePerfect\Reflection\ReflectionParser
*/
private $reflectionParser;
public function __construct(ReflectionParser $reflectionParser)
{
$this->reflectionParser = $reflectionParser;
}

public function findByMethodCall(MethodCall $methodCall, Scope $scope): ?ClassMethod
{
$classReflection = $scope->getClassReflection();
Expand Down
26 changes: 20 additions & 6 deletions src/NodeFinder/MethodCallNodeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,28 @@
use Rector\TypePerfect\Reflection\ReflectionParser;
use Webmozart\Assert\Assert;

final readonly class MethodCallNodeFinder
final class MethodCallNodeFinder
{
private NodeFinder $nodeFinder;
/**
* @readonly
* @var \Rector\TypePerfect\Reflection\ReflectionParser
*/
private $reflectionParser;
/**
* @readonly
* @var \Rector\TypePerfect\Printer\NodeComparator
*/
private $nodeComparator;
/**
* @readonly
* @var \PhpParser\NodeFinder
*/
private $nodeFinder;

public function __construct(
private ReflectionParser $reflectionParser,
private NodeComparator $nodeComparator,
) {
public function __construct(ReflectionParser $reflectionParser, NodeComparator $nodeComparator)
{
$this->reflectionParser = $reflectionParser;
$this->nodeComparator = $nodeComparator;
$this->nodeFinder = new NodeFinder();
}

Expand Down
4 changes: 2 additions & 2 deletions src/NodeFinder/ReturnNodeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
use PhpParser\NodeTraverser;
use Rector\TypePerfect\NodeVisitor\CallableNodeVisitor;

final readonly class ReturnNodeFinder
final class ReturnNodeFinder
{
public function findOnlyReturnsExpr(ClassMethod $classMethod): Expr|null
public function findOnlyReturnsExpr(ClassMethod $classMethod): ?\PhpParser\Node\Expr
{
$returns = $this->findReturnsWithValues($classMethod);
if (count($returns) !== 1) {
Expand Down
Loading

0 comments on commit 81f215a

Please sign in to comment.