Skip to content

Commit

Permalink
bump downgrade to 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Dec 12, 2024
1 parent 5ee17d1 commit d3df81d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/downgraded_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

- uses: "ramsey/composer-install@v2"

# downgrade /src to PHP 7.2
- run: vendor/bin/rector process src --config build/rector-downgrade-php-72.php --ansi
# downgrade /src to PHP 7.4
- run: vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi
- run: vendor/bin/ecs check src --fix --ansi

# copy PHP 7.2 composer
- run: cp build/composer-php-72.json composer.json
# copy PHP 7.4 composer
- run: cp build/composer-php-74.json composer.json

# clear the dev files
- run: rm -rf build .github tests stubs ecs.php phpstan.neon phpunit.xml composer-dependency-analyser.php
Expand All @@ -42,7 +42,7 @@ jobs:
run: |
# separate a "git add" to add untracked (new) files too
git add --all
git commit -m "release PHP 7.2 downgraded"
git commit -m "release PHP 7.4 downgraded"
# force push tag, so there is only 1 version
git tag "${GITHUB_REF#refs/tags/}" --force
Expand Down
4 changes: 2 additions & 2 deletions build/composer-php-72.json → build/composer-php-74.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"keywords": ["static analysis", "phpstan-extension"],
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.10.19",
"php": "^7.4 || ^8.0",
"phpstan/phpstan": "^2.0.3",
"webmozart/assert": "^1.11"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
use Rector\Set\ValueObject\DowngradeLevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72]);
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_74]);
};
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@
"keywords": ["static analysis", "phpstan-extension"],
"require": {
"php": "^8.2",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan": "^2.0.3",
"webmozart/assert": "^1.11",
"nikic/php-parser": "^5.0"
"nikic/php-parser": "^5.3"
},
"require-dev": {
"phpstan/extension-installer": "^1.4",
"tracy/tracy": "^2.10",
"symplify/easy-coding-standard": "^12.3",
"symplify/easy-coding-standard": "^12.4",
"rector/rector": "^2.0.0",
"phpunit/phpunit": "^11.5",
"tomasvotruba/class-leak": "^1.2",
"symplify/easy-ci": "^12.1",
"symplify/phpstan-rules": "^14.0",
"shipmonk/composer-dependency-analyser": "^1.7"
},
"autoload": {
Expand Down
8 changes: 8 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ parameters:
# removes important type knowledge
-
identifier: phpstanApi.instanceofType

# not useful - we need to check reflection instance
-
path: src/MethodTypeDetector.php
identifier: phpstanApi.instanceofAssumption
-
path: src/MethodTypeDetector.php
identifier: phpstanApi.class
1 change: 1 addition & 0 deletions src/Collectors/Callable_/AttributeCallableCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use PhpParser\Node\Scalar\String_;
use PHPStan\Analyser\Scope;
use PHPStan\Collectors\Collector;
use PHPStan\Type\Constant\ConstantStringType;
use TomasVotruba\UnusedPublic\Configuration;
use TomasVotruba\UnusedPublic\ValueObject\ClassAndMethodArrayExprs;

Expand Down
5 changes: 3 additions & 2 deletions src/Collectors/FormTypeClassCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PhpParser\Node\Scalar\String_;
use PHPStan\Analyser\Scope;
use PHPStan\Collectors\Collector;
use PHPStan\Type\Constant\ConstantStringType;
use TomasVotruba\UnusedPublic\Configuration;

/**
Expand Down Expand Up @@ -46,10 +47,10 @@ public function processNode(Node $node, Scope $scope): ?array
}

$valueType = $scope->getType($node->value);
if (count($valueType->getConstantStrings()) !== 1) {
if (! $valueType instanceof ConstantStringType) {
return null;
}

return [$valueType->getConstantStrings()[0]->getValue()];
return [$valueType->getValue()];
}
}

0 comments on commit d3df81d

Please sign in to comment.