Skip to content

Commit

Permalink
Merge pull request #35 from DaveLiddament/fix/phpstan-v2-support
Browse files Browse the repository at this point in the history
Fix PHPStan v2 support
  • Loading branch information
DaveLiddament authored Dec 16, 2024
2 parents c472adc + 874f9d5 commit 01bd4c3
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 4,542 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/full-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
matrix:
dependencies:
- "lowest"
- "locked"
- "highest"
php-version:
- "8.0"
Expand Down Expand Up @@ -56,10 +55,6 @@ jobs:
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"
Expand Down
7 changes: 6 additions & 1 deletion build/PHPStan/Rules/CheckRuleIsInExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace DaveLiddament\PhpstanPhpLanguageExtensions\Build\PHPStan\Rules;

use DaveLiddament\PhpstanPhpLanguageExtensions\Helpers\Assert;
use Nette\Neon\Neon;
use PhpParser\Node;
use PHPStan\Analyser\Scope;
Expand All @@ -24,13 +25,17 @@ public function __construct()
}

$services = $file['services'] ?? [];
Assert::assertArray($services);

$classes = [];
foreach ($services as $service) {
Assert::assertArray($service);
$class = $service['class'] ?? null;
if (null === $class) {
continue;
}

Assert::assertString($class);
$classes[] = $class;
}

Expand Down Expand Up @@ -68,7 +73,7 @@ public function processNode(Node $node, Scope $scope): array
}

return [
RuleErrorBuilder::message("Rule [$className] not in extension.neon.")->build(),
RuleErrorBuilder::message("Rule [$className] not in extension.neon.")->identifier('phpstanExtensionLibrary.misconfigured')->build(),
];
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"type": "phpstan-extension",
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"phpstan/phpstan": "^1.12 || ^2.0",
"phpstan/phpstan": "^1.12.19 || ^2.0",
"dave-liddament/php-language-extensions": "^0.8.0 || ^0.9.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6.12",
"friendsofphp/php-cs-fixer": "^3.26.1",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"dave-liddament/phpstan-rule-test-helper": "^0.4.0",
"dave-liddament/phpstan-rule-test-helper": "^0.5.0",
"nette/neon": "^3.4"
},
"license": "MIT",
Expand Down
Loading

0 comments on commit 01bd4c3

Please sign in to comment.