-
-
Notifications
You must be signed in to change notification settings - Fork 169
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
feat: phpstan level 5 #446
Open
SRWieZ
wants to merge
19
commits into
NativePHP:main
Choose a base branch
from
SRWieZ:feature/phpstan
base: main
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.
+95
−68
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
933c8e5
feat: phpstan level 5
SRWieZ 91c5275
fix: $database undefined
SRWieZ 5be8381
fix: Unsafe usage of new static()
SRWieZ f009309
fix: ignore NativeAppServiceProvider not existing
SRWieZ cc1cb87
fix: FreshCommand constructor invoked with 1 parameter, 0 required
SRWieZ 03bd832
fix: MenuBuilder facade function duplicates and arguments
SRWieZ 3c7e958
fix: Type void cannot be part of a union type declaration.
SRWieZ f0a5baf
fix: Php compactor missing imports and return statement
SRWieZ 7ebe7f9
fix: missing SeedDatabaseCommand@handle return statement
SRWieZ 585fb47
Fix: cannot assign a value to a public readonly property outside of t…
SRWieZ 8fb93e9
Fix: PowerMonitor invoked Client::get() with 2 parameters, 1 required
SRWieZ cac9ea1
fix: alternative for FreshCommand migrator argument
SRWieZ 7aa74f1
Revert "fix: alternative for FreshCommand migrator argument"
SRWieZ d1a90f4
Revert "fix: FreshCommand constructor invoked with 1 parameter, 0 req…
SRWieZ 6b88d13
fix: trying something
SRWieZ 36ff261
fix: phpstan.yml
SRWieZ c3c2e63
Revert "fix: trying something"
SRWieZ 2ce6334
fix: trying to lower the minimum laravel 10 dependency
SRWieZ b9dc748
fix: final fix 🎉
SRWieZ 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 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 |
---|---|---|
@@ -1,26 +1,42 @@ | ||
name: PHPStan | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- '**.php' | ||
- 'phpstan.neon.dist' | ||
branches-ignore: | ||
- 'dependabot/npm_and_yarn/*' | ||
|
||
jobs: | ||
phpstan: | ||
name: phpstan | ||
runs-on: ubuntu-latest | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
php: [8.3] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
coverage: none | ||
php-version: ${{ matrix.php }} | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache Composer dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer- | ||
|
||
- name: Install composer dependencies | ||
uses: ramsey/composer-install@v3 | ||
- name: Install Dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | ||
|
||
- name: Run PHPStan | ||
run: ./vendor/bin/phpstan --error-format=github | ||
- name: Run analysis | ||
run: ./vendor/bin/phpstan analyse --error-format=github |
This file contains 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 |
---|---|---|
|
@@ -5,7 +5,6 @@ composer.lock | |
coverage | ||
docs | ||
phpunit.xml | ||
phpstan.neon | ||
testbench.yaml | ||
vendor | ||
node_modules | ||
|
This file contains 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
Empty file.
This file contains 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,17 @@ | ||
parameters: | ||
|
||
paths: | ||
- src/ | ||
- config/ | ||
# - tests/ | ||
|
||
|
||
# Level 9 is the highest level | ||
level: 5 | ||
|
||
ignoreErrors: | ||
- '#Class App\\Providers\\NativeAppServiceProvider not found#' | ||
# - '#PHPDoc tag @var#' | ||
# | ||
# excludePaths: | ||
# - ./*/*/FileToBeExcluded.php |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes feel like a regression. Readonly here ensures these values don't get changed. They shouldn't change as they represent immutable state rather than being a mutable object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPStan informed me that we cannot update a readonly property outside of its constructor. I initially thought this might be an issue in PHP 8.4, but I just tested it in both PHP 8.3 and 8.4, and we can assign a value without any problems.
I reviewed the documentation, and it does not state that assignments outside of the constructor are prohibited. A readonly property simply needs to be initialized once from within the class.
According to the documentation
So..
→ I can revert this commit and add a phpstanignore tag instead! Agree?