Skip to content

Commit

Permalink
Add phpstan check and fix level 0 issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Oct 10, 2023
1 parent d4766d0 commit 7997989
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,22 @@ jobs:
with:
flags: php-${{ matrix.php-version }}-${{ matrix.os }}
name: php-${{ matrix.php-version }}-${{ matrix.os }}

static-analysis:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use php 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
- name: Cache module
uses: actions/cache@v3
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install phpstan
run: composer require --dev phpstan/phpstan
- name: Analyse files
run: ./vendor/bin/phpstan analyse src test
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.29
1.7.31
12 changes: 8 additions & 4 deletions test/TestUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,35 @@ class TestUtil extends TestCase
public function bcAssertEqualsWithDelta($expected, $actual, $delta = 0.01, $message = '')
{
if (\is_callable([self::class, 'assertEqualsWithDelta'])) {
return parent::assertEqualsWithDelta($expected, $actual, $delta, $message);
parent::assertEqualsWithDelta($expected, $actual, $delta, $message);
return;
}
return $this->assertEquals($expected, $actual, $message, $delta);
}

public function bcExpectException($exception)
{
if (\is_callable([self::class, 'expectException'])) {
return parent::expectException($exception);
parent::expectException($exception);
return;
}
return parent::setExpectedException($exception);
}

public function bcAssertIsResource($res)
{
if (\is_callable([self::class, 'assertIsResource'])) {
return parent::assertIsResource($res);
parent::assertIsResource($res);
return;
}
return parent::assertInternalType('resource', $res);
}

public function bcAssertMatchesRegularExpression($pattern, $string, $message = '')
{
if (\is_callable([self::class, 'assertMatchesRegularExpression'])) {
return parent::assertMatchesRegularExpression($pattern, $string, $message);
parent::assertMatchesRegularExpression($pattern, $string, $message);
return;
}
return parent::assertRegExp($pattern, $string, $message);
}
Expand Down

0 comments on commit 7997989

Please sign in to comment.