-
Notifications
You must be signed in to change notification settings - Fork 3
Upgrades to Laravel 10 and PHP 8.2, plus fixes from static analysis and code styles #7
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
36cf89f
Drop support for PHP 8.0 and Laravel 8.x. Add support for PHP 8.2
e317a0a
Adds Netsells Code Standards into the project
90b6377
Update the style with phpcsfixer
a4693bd
Use Collection directly instead of relying on the helper function
0b9a88c
Fixes PHPstan errors
c896ff3
Adds github action workflows with quality tools
c4c7436
Fixes to keep the codebase working on Laravel 9, but make it ready fo…
c385d25
Sorted out new line
2e63488
Switch to released version of Netsells Code Standards
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,26 @@ | ||
name: Format with PHP CS Fixer | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
php-cs-fixer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
extensions: zip | ||
coverage: none | ||
|
||
- name: Install Dependencies | ||
run: composer install --no-ansi --no-interaction --no-scripts --prefer-dist | ||
|
||
- run: composer run format | ||
|
||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Apply php-cs-fixer changes |
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,22 @@ | ||
name: Perform static analysis with PHPStan | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.2' | ||
extensions: zip | ||
coverage: none | ||
|
||
- name: Install Dependencies | ||
run: composer install --no-ansi --no-interaction --no-scripts --prefer-dist | ||
|
||
- run: composer run phpstan |
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
composer.lock | ||
.idea | ||
.phpunit.result.cache | ||
.phpunit.cache | ||
.phpunit.cache | ||
.php-cs-fixer.cache |
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,25 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Config; | ||
use PhpCsFixer\Finder; | ||
|
||
/** @var Config $config */ | ||
$config = require_once join(DIRECTORY_SEPARATOR, [__DIR__, 'vendor', 'netsells', 'code-standards-laravel', 'phpcsfixer', 'config.php']); | ||
|
||
$rules = array_merge_recursive($config->getRules(), [ | ||
// set project specific rules here | ||
]); | ||
|
||
$finder = Finder::create() | ||
->in([ | ||
__DIR__ . '/src', | ||
__DIR__ . '/tests', | ||
]) | ||
->name('*.php') | ||
->notName('*.blade.php') | ||
->ignoreDotFiles(true) | ||
->ignoreVCS(true); | ||
|
||
return $config | ||
->setFinder($finder) | ||
->setRules($rules); |
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,15 @@ | ||
includes: | ||
- ./vendor/netsells/code-standards-laravel/phpstan/extension.neon | ||
|
||
parameters: | ||
paths: | ||
- src | ||
- tests | ||
|
||
# The level 9 is the highest level | ||
level: 5 | ||
|
||
ignoreErrors: | ||
excludePaths: | ||
|
||
checkMissingIterableValueType: false |
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
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.
Is
collect()
deprecated?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.
It's not and is still available. I thought that it would be nice not to depend on a global function included from the Laravel helpers file, so I switched to using Collection class directly. However it was a bit of a 'half assed' attempt because there are still calls to data_get (which is only available as such global helper, and not a class I can hook into). So all in all, not a massive improvement and probably a bit of a useless change :D
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.
Does
Illuminate\Support\Arr::get()
not cut the mustard?Uh oh!
There was an error while loading. Please reload this page.
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.
Hard to say. Arr::get passes the tests, but looking at the implementation of both, I am not sure if Arr::get covers all the use cases that data_get does. The 'relation' string is controlled by the users of this package, so I can't be sure that it never gets called with e.g. '*' which is valid segment for data_get but not for Arr:get. In theory it shouldn't be, and the only supported 'relation' strings should be compatible with the Laravel Eloquent relation syntax. I think this change would require a new major version of this package just in case, and then I would also like to look at improved handling of the relation string in general - so would prefer to leave it as is, and then do the switch to Arr::get as part of this work. However, thanks for throwing that excellent suggestion, as I would definitely want to switch to that in the future! :D
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.
Agreed, they do look a little different.