Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: drop psalm #70

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml.dist export-ignore
/renovate.json export-ignore
/tests export-ignore
26 changes: 0 additions & 26 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,3 @@ jobs:

- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan --error-format=checkstyle | cs2pr"

static-analysis-psalm:
name: "Static Analysis with Psalm"
runs-on: "ubuntu-22.04"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"

- name: "Run a static analysis with vimeo/psalm"
run: "vendor/bin/psalm --output-format=github --shepherd --taint-analysis --report=results.sarif"

- name: Upload Security Analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
/phpcs.xml
/phpstan.neon
/phpunit.xml
/psalm.xml
/vendor/
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^10.4",
"psalm/plugin-phpunit": "^0.19.0",
"vimeo/psalm": "^5.0"
"phpunit/phpunit": "^10.4"
},
"autoload": {
"psr-4": {
Expand Down
15 changes: 0 additions & 15 deletions psalm.xml.dist

This file was deleted.

2 changes: 1 addition & 1 deletion src/ClassExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@
$count = count($tokens);

foreach ($tokens as $i => $token) {
if ($i < 2) {

Check warning on line 34 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ $tokens = token_get_all($code); $count = count($tokens); foreach ($tokens as $i => $token) { - if ($i < 2) { + if ($i <= 2) { continue; } if ($token[0] === T_NAMESPACE) {
continue;
}

if ($token[0] === T_NAMESPACE) {
for ($j = $i + 1; $j < $count; ++$j) {

Check warning on line 39 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ continue; } if ($token[0] === T_NAMESPACE) { - for ($j = $i + 1; $j < $count; ++$j) { + for ($j = $i + 0; $j < $count; ++$j) { if ($tokens[$j][0] === T_NAME_QUALIFIED) { $namespace = $tokens[$j][1]; break;

Check warning on line 39 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ continue; } if ($token[0] === T_NAMESPACE) { - for ($j = $i + 1; $j < $count; ++$j) { + for ($j = $i + 2; $j < $count; ++$j) { if ($tokens[$j][0] === T_NAME_QUALIFIED) { $namespace = $tokens[$j][1]; break;

Check warning on line 39 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "Plus": --- Original +++ New @@ @@ continue; } if ($token[0] === T_NAMESPACE) { - for ($j = $i + 1; $j < $count; ++$j) { + for ($j = $i - 1; $j < $count; ++$j) { if ($tokens[$j][0] === T_NAME_QUALIFIED) { $namespace = $tokens[$j][1]; break;

Check warning on line 39 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ continue; } if ($token[0] === T_NAMESPACE) { - for ($j = $i + 1; $j < $count; ++$j) { + for ($j = $i + 1; $j <= $count; ++$j) { if ($tokens[$j][0] === T_NAME_QUALIFIED) { $namespace = $tokens[$j][1]; break;
if ($tokens[$j][0] === T_NAME_QUALIFIED) {
$namespace = $tokens[$j][1];

break;

Check warning on line 43 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "Break_": --- Original +++ New @@ @@ for ($j = $i + 1; $j < $count; ++$j) { if ($tokens[$j][0] === T_NAME_QUALIFIED) { $namespace = $tokens[$j][1]; - break; + continue; } if ($tokens[$j][0] === T_STRING) { $namespace .= '\\' . $tokens[$j][1];
}

if ($tokens[$j][0] === T_STRING) {

Check warning on line 46 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ $namespace = $tokens[$j][1]; break; } - if ($tokens[$j][0] === T_STRING) { + if ($tokens[$j][1] === T_STRING) { $namespace .= '\\' . $tokens[$j][1]; continue; }

Check warning on line 46 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "Identical": --- Original +++ New @@ @@ $namespace = $tokens[$j][1]; break; } - if ($tokens[$j][0] === T_STRING) { + if ($tokens[$j][0] !== T_STRING) { $namespace .= '\\' . $tokens[$j][1]; continue; }
$namespace .= '\\' . $tokens[$j][1];

continue;
}

if ($tokens[$j] === '{' || $tokens[$j] === ';') {

Check warning on line 52 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ $namespace .= '\\' . $tokens[$j][1]; continue; } - if ($tokens[$j] === '{' || $tokens[$j] === ';') { + if ($tokens[$j] === '{' && $tokens[$j] === ';') { $namespace = ltrim($namespace, '\\'); break; }
$namespace = ltrim($namespace, '\\');

break;
Expand All @@ -61,14 +61,14 @@

if (
$tokens[$i - 2][0] !== T_CLASS
|| $tokens[$i - 1][0] !== T_WHITESPACE

Check warning on line 64 in src/ClassExtractor.php

View workflow job for this annotation

GitHub Actions / Infection

Escaped Mutant for Mutator "Minus": --- Original +++ New @@ @@ } continue; } - if ($tokens[$i - 2][0] !== T_CLASS || $tokens[$i - 1][0] !== T_WHITESPACE || $token[0] !== T_STRING) { + if ($tokens[$i - 2][0] !== T_CLASS || $tokens[$i + 1][0] !== T_WHITESPACE || $token[0] !== T_STRING) { continue; } $className = $tokens[$i][1];
|| $token[0] !== T_STRING
) {
continue;
}

$className = $tokens[$i][1];
/** @psalm-var class-string $fqn */
/** @phpstan-var class-string $fqn */
$fqn = $namespace . '\\' . $className;
$classes[] = $fqn;
}
Expand Down
2 changes: 1 addition & 1 deletion src/EnumExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function all(string $filePathName): array
}

$enumName = $tokens[$i][1];
/** @psalm-var class-string $fqn */
/** @phpstan-var class-string $fqn */
$fqn = $namespace . '\\' . $enumName;
$enums[] = $fqn;
}
Expand Down
Loading