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 Sep 8, 2023
1 parent 380afa5 commit b92239b
Show file tree
Hide file tree
Showing 37 changed files with 132 additions and 814 deletions.
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/code_analysis.yaml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/downgraded_release.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/rector.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/various_php_install.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions build/composer-php-72.json

This file was deleted.

10 changes: 0 additions & 10 deletions build/rector-downgrade-php-72.php

This file was deleted.

28 changes: 1 addition & 27 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,15 @@
"description": "PHPStan rules to measure cognitive complexity of your classes and methods",
"license": "MIT",
"require": {
"php": "^8.1",
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.10",
"nette/utils": "^3.2"
},
"require-dev": {
"phpstan/extension-installer": "^1.3",
"phpunit/phpunit": "^10.3",
"symplify/easy-coding-standard": "^12.0",
"rector/rector": "^0.18",
"tracy/tracy": "^2.9",
"php-parallel-lint/php-parallel-lint": "^1.3",
"tomasvotruba/type-coverage": "^0.2",
"tomasvotruba/unused-public": "^0.3"
},
"autoload": {
"psr-4": {
"TomasVotruba\\CognitiveComplexity\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"TomasVotruba\\CognitiveComplexity\\Tests\\": "tests"
}
},
"scripts": {
"check-cs": "vendor/bin/ecs check --ansi",
"fix-cs": "vendor/bin/ecs check --fix --ansi",
"phpstan": "vendor/bin/phpstan --ansi",
"rector": "vendor/bin/rector --dry-run --ansi"
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"extra": {
"phpstan": {
"includes": [
Expand Down
17 changes: 0 additions & 17 deletions ecs.php

This file was deleted.

24 changes: 0 additions & 24 deletions phpstan.neon

This file was deleted.

12 changes: 0 additions & 12 deletions phpunit.xml

This file was deleted.

33 changes: 25 additions & 8 deletions src/AstCognitiveComplexityAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace TomasVotruba\CognitiveComplexity;

use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use TomasVotruba\CognitiveComplexity\DataCollector\CognitiveComplexityDataCollector;
use TomasVotruba\CognitiveComplexity\NodeTraverser\ComplexityNodeTraverserFactory;
use TomasVotruba\CognitiveComplexity\NodeVisitor\NestingNodeVisitor;
Expand All @@ -18,11 +16,29 @@
*/
final class AstCognitiveComplexityAnalyzer
{
public function __construct(
private readonly ComplexityNodeTraverserFactory $complexityNodeTraverserFactory,
private readonly CognitiveComplexityDataCollector $cognitiveComplexityDataCollector,
private readonly NestingNodeVisitor $nestingNodeVisitor
) {
/**
* @readonly
* @var \TomasVotruba\CognitiveComplexity\NodeTraverser\ComplexityNodeTraverserFactory
*/
private $complexityNodeTraverserFactory;

/**
* @readonly
* @var \TomasVotruba\CognitiveComplexity\DataCollector\CognitiveComplexityDataCollector
*/
private $cognitiveComplexityDataCollector;

/**
* @readonly
* @var \TomasVotruba\CognitiveComplexity\NodeVisitor\NestingNodeVisitor
*/
private $nestingNodeVisitor;

public function __construct(ComplexityNodeTraverserFactory $complexityNodeTraverserFactory, CognitiveComplexityDataCollector $cognitiveComplexityDataCollector, NestingNodeVisitor $nestingNodeVisitor)
{
$this->complexityNodeTraverserFactory = $complexityNodeTraverserFactory;
$this->cognitiveComplexityDataCollector = $cognitiveComplexityDataCollector;
$this->nestingNodeVisitor = $nestingNodeVisitor;
}

public function analyzeClassLike(Class_ $class): int
Expand All @@ -37,8 +53,9 @@ public function analyzeClassLike(Class_ $class): int

/**
* @api
* @param \PhpParser\Node\Stmt\Function_|\PhpParser\Node\Stmt\ClassMethod $functionLike
*/
public function analyzeFunctionLike(Function_ | ClassMethod $functionLike): int
public function analyzeFunctionLike($functionLike): int
{
$this->cognitiveComplexityDataCollector->reset();
$this->nestingNodeVisitor->reset();
Expand Down
12 changes: 9 additions & 3 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@

final class Configuration
{
/**
* @var array<string, mixed>
* @readonly
*/
private $parameters;

/**
* @param array<string, mixed> $parameters
*/
public function __construct(
private readonly array $parameters
) {
public function __construct(array $parameters)
{
$this->parameters = $parameters;
}

public function getMaxClassCognitiveComplexity(): int
Expand Down
Loading

0 comments on commit b92239b

Please sign in to comment.