Skip to content

Commit

Permalink
Fix errors reported by phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 16, 2024
1 parent f52813b commit 9c8c8e9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tests export-ignore
.github export-ignore
phpstan.neon export-ignore
psalm.xml export-ignore
.phive export-ignore
34 changes: 5 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,10 @@ permissions:

jobs:
testsuite:
uses: cakephp/.github/.github/workflows/testsuite-with-db.yml@5.x
secrets: inherit
uses: ADmad/.github/workflows/testsuite-with-db.yml@5.x
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl
coverage: none
tools: cs2pr, vimeo/psalm:5, phpstan:1.10

- name: Composer Install
run: composer install

- name: Run phpcs
run: vendor/bin/phpcs --report=checkstyle src/ tests/ | cs2pr

- name: Run psalm
if: always()
run: psalm --output-format=github

- name: Run phpstan
if: always()
run: phpstan analyse
uses: cakephp/.github/.github/workflows/cs-stan.yml@5.x
secrets: inherit
5 changes: 5 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
</phive>
4 changes: 3 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
parameters:
level: 8
checkMissingIterableValueType: false
bootstrapFiles:
- tests/bootstrap.php
paths:
- src/
ignoreErrors:
-
identifier: missingType.iterableValue
2 changes: 1 addition & 1 deletion src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function installPackages(Arguments $args, ConsoleIo $io): void
$output = [];
$return = 0;
$this->_runNPMInstall($output, $return, $io, $args->getOption('latest') === true);
$io->out($output);
$io->out($output); // @phpstan-ignore argument.type

if ($return !== 0) {
$io->error('Package installation failed.');
Expand Down
4 changes: 1 addition & 3 deletions src/View/Helper/OptionsAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ public function removeClasses(array|string $classes, array $options): array
foreach ($classes as $class) {
$indices = array_keys($options['class'], $class);
foreach ($indices as $index) {
if ($index !== false) {
unset($options['class'][$index]);
}
unset($options['class'][$index]);
}
}

Expand Down

0 comments on commit 9c8c8e9

Please sign in to comment.