Skip to content

Commit

Permalink
Fork off phpstan CI in another job
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jul 11, 2024
1 parent bbc50e2 commit 41eadc3
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/phpunit.xml.dist export-ignore
/phpunit-phpstan.xml.dist export-ignore
/tests export-ignore
/CONTRIBUTING.md export-ignore
45 changes: 42 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
- pull_request

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"

jobs:
Expand Down Expand Up @@ -49,9 +48,49 @@ jobs:

- name: "Install latest dependencies"
run: |
# Remove PHPStan as it requires a newer PHP
composer remove phpstan/phpstan phpstan/phpstan-strict-rules --dev --no-update
composer update ${{ env.COMPOSER_FLAGS }}
- name: "Run tests"
run: "vendor/bin/simple-phpunit --verbose"

phpstan_tests:
name: "CI PHPStan Ext"

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- "7.3"
- "8.3"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

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

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: "Install latest dependencies"
run: |
# Require PHPUnit directly bypassing the symfony bridge
composer remove symfony/phpunit-bridge --dev --no-update
composer require phpunit/phpunit:^9 --dev --no-update
composer update ${{ env.COMPOSER_FLAGS }}
- name: "Run tests"
run: vendor/bin/phpunit -c phpunit-phpstan.xml.dist
20 changes: 20 additions & 0 deletions phpunit-phpstan.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="PCRE Test Suite">
<directory>tests/PHPStanTests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
</phpunit>
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
>
<testsuites>
<testsuite name="PCRE Test Suite">
<directory>tests</directory>
<directory>tests/PregTests</directory>
<directory>tests/RegexTests</directory>
</testsuite>
</testsuites>

Expand Down
2 changes: 1 addition & 1 deletion src/PHPStan/PregMatchTypeSpecifyingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function specifyTypes(MethodReflection $methodReflection, StaticCall $nod
$context,
$overwrite,
$scope,
$node,
$node
);
}
}

0 comments on commit 41eadc3

Please sign in to comment.