-
-
Notifications
You must be signed in to change notification settings - Fork 245
Add PHPStan static analysis for the modules #1512
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
Open
austinderrick
wants to merge
9
commits into
wintercms:wip/1.3
Choose a base branch
from
austinderrick:feat/modules-phpstan
base: wip/1.3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4fd6498
Add PHPStan static analysis for the modules at level 0
austinderrick 2d4f7b2
Make the analysis environment reproducible in CI
austinderrick d7499cc
Use larastan, matching storm
austinderrick d37b346
Address review: real ClassLoader in the bootstrap, and a smaller base…
austinderrick 1671c6a
Resolve every baseline entry; delete the baseline
austinderrick b8593e1
Return the save result from CmsObject::save()
austinderrick 40212de
Move the analysis job to a Tests-grouped code-analysis workflow
austinderrick bfa971e
Trigger the analysis on pushes to wip/1.3
austinderrick 69981d3
Only run the analysis on branches that will have PHPStan
austinderrick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - 1.0 | ||
| - 1.1 | ||
| - 1.2 | ||
| - wip/1.3 | ||
| - develop | ||
|
|
||
| concurrency: | ||
| group: phpstan-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| codeAnalysis: | ||
| runs-on: ubuntu-latest | ||
| name: Code Analysis | ||
| env: | ||
| extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip | ||
| steps: | ||
| - name: Checkout changes | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Install PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.4' | ||
| extensions: ${{ env.extensions }} | ||
| coverage: none | ||
|
|
||
| - name: Configure Composer GitHub token | ||
| run: composer config --global --auth github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }} | ||
|
|
||
| - name: Install Composer dependencies | ||
| run: composer install --no-interaction --no-progress --no-scripts | ||
|
|
||
| # composer/installers places the module packages into modules/, which clobbers the | ||
| # checked-out module changes; restore the working tree the same way tests.yml does. | ||
| - name: Reset modules | ||
| run: | | ||
| git reset --hard | ||
| git clean -fd | ||
|
|
||
| - name: Clear phpstan cache | ||
| run: vendor/bin/phpstan clear-result-cache | ||
|
|
||
| - name: Analyse code | ||
| run: vendor/bin/phpstan analyse --memory-limit=2G --no-progress | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * Analysis bootstrap for PHPStan. | ||
| * | ||
| * The modules are loaded through Winter's own class loader rather than composer, so the same | ||
| * loader is registered here, mirroring modules/system/tests/bootstrap/app.php. Winter also | ||
| * registers global class aliases (Model, BackendAuth, and friends) while the application boots, | ||
| * and module code references the aliases directly, so the alias map is registered as well. | ||
| */ | ||
| require __DIR__ . '/vendor/autoload.php'; | ||
|
|
||
| $classLoader = new Winter\Storm\Support\ClassLoader( | ||
| new Winter\Storm\Filesystem\Filesystem(), | ||
| __DIR__, | ||
| __DIR__ . '/storage/framework/classes.php' | ||
| ); | ||
|
|
||
| $classLoader->register(); | ||
|
|
||
| foreach (glob(__DIR__ . '/modules/*', GLOB_ONLYDIR) as $modulePath) { | ||
| $classLoader->autoloadPackage(basename($modulePath), $modulePath); | ||
| } | ||
|
|
||
| Illuminate\Foundation\AliasLoader::getInstance( | ||
| require __DIR__ . '/modules/system/aliases.php' | ||
| )->register(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| includes: | ||
| - vendor/larastan/larastan/extension.neon | ||
|
|
||
| parameters: | ||
| paths: | ||
| - modules/system/classes | ||
| - modules/system/models | ||
| - modules/backend/classes | ||
| - modules/backend/models | ||
| - modules/cms/classes | ||
| - modules/cms/models | ||
| level: 0 | ||
| bootstrapFiles: | ||
| - phpstan-bootstrap.php | ||
| scanDirectories: | ||
| - modules | ||
| treatPhpDocTypesAsCertain: false | ||
| disableSchemaScan: true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.