refactor: split phpstan-baseline into smaller files#9299
Merged
paulbalandan merged 3 commits intocodeigniter4:developfrom Dec 15, 2024
Merged
refactor: split phpstan-baseline into smaller files#9299paulbalandan merged 3 commits intocodeigniter4:developfrom
paulbalandan merged 3 commits intocodeigniter4:developfrom
Conversation
4f170cf to
823f364
Compare
michalsn
approved these changes
Dec 7, 2024
Member
michalsn
left a comment
There was a problem hiding this comment.
I like this idea. Smaller baseline files seem like easier to deal with.
datamweb
reviewed
Dec 7, 2024
kenjis
reviewed
Dec 9, 2024
Collaborator
|
@paulbalandan By the way, i see this another error. Can you update rector to RC3? cc @samsonasik DetailsRun vendor/bin/rector process --dry-run --no-progress-bar
{
"title": "_PHPStan_e6dc705b2\\Nette\\Schema\\ValidationException",
"type": "_PHPStan_e6dc705b2\\Nette\\Schema\\ValidationException",
"code": 500,
"message": "Unexpected item 'parameters › shipmonkBaselinePerIdentifier'.",
"file": "phar:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php",
"line": 75,
"trace": [
{
"file": "phar:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpstan/phpstan/phpstan.phar/vendor/nette/schema/src/Schema/Processor.php",
"line": 38,
"function": "throwsErrors",
"class": "_PHPStan_e6dc705b2\\Nette\\Schema\\Processor",
"type": "->"
},
{
"file": "phar:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ContainerFactory.php",
"line": 216,
"function": "process",
"class": "_PHPStan_e6dc705b2\\Nette\\Schema\\Processor",
"type": "->"
},
{
"file": "phar:///home/runner/work/CodeIgniter4/CodeIgniter4/vendor/phpstan/phpstan/phpstan.phar/src/DependencyInjection/ContainerFactory.php",
"line": 104,
"function": "validateParameters",
"class": "PHPStan\\DependencyInjection\\ContainerFactory",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php",
"line": 51,
"function": "create",
"class": "PHPStan\\DependencyInjection\\ContainerFactory",
"type": "->"
},
{
"function": "__construct",
"class": "Rector\\NodeTypeResolver\\DependencyInjection\\PHPStanServicesFactory",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 844,
"function": "newInstanceArgs",
"class": "ReflectionClass",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 705,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 652,
"function": "resolve",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/src/DependencyInjection/LazyContainerFactory.php",
"line": 273,
"function": "make",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 807,
"function": "Rector\\DependencyInjection\\{closure}",
"class": "Rector\\DependencyInjection\\LazyContainerFactory",
"type": "::"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 705,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 652,
"function": "resolve",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": [9](https://github.com/codeigniter4/CodeIgniter4/actions/runs/12204169604/job/34048691307?pr=9299#step:11:10)47,
"function": "make",
"class": "RectorPrefix2024[11](https://github.com/codeigniter4/CodeIgniter4/actions/runs/12204169604/job/34048691307?pr=9299#step:11:12)\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 873,
"function": "resolveClass",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 838,
"function": "resolveDependencies",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 705,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 652,
"function": "resolve",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 947,
"function": "make",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 873,
"function": "resolveClass",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 838,
"function": "resolveDependencies",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 705,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 652,
"function": "resolve",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 947,
"function": "make",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 873,
"function": "resolveClass",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 838,
"function": "resolveDependencies",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 277,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 807,
"function": "RectorPrefix202411\\Illuminate\\Container\\{closure}",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 705,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 652,
"function": "resolve",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 496,
"function": "make",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"function": "RectorPrefix202411\\Illuminate\\Container\\{closure}",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/ContextualBindingBuilder.php",
"line": 72,
"function": "iterator_to_array"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Util.php",
"line": 40,
"function": "RectorPrefix202411\\Illuminate\\Container\\{closure}",
"class": "RectorPrefix202411\\Illuminate\\Container\\ContextualBindingBuilder",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 923,
"function": "unwrapIfClosure",
"class": "RectorPrefix202411\\Illuminate\\Container\\Util",
"type": "::"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 873,
"function": "resolvePrimitive",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 838,
"function": "resolveDependencies",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 705,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 652,
"function": "resolve",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/src/DependencyInjection/LazyContainerFactory.php",
"line": 245,
"function": "make",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 807,
"function": "Rector\\DependencyInjection\\{closure}",
"class": "Rector\\DependencyInjection\\LazyContainerFactory",
"type": "::"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 705,
"function": "build",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/vendor/illuminate/container/Container.php",
"line": 662,
"function": "resolve",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/bin/rector.php",
"line": [12](https://github.com/codeigniter4/CodeIgniter4/actions/runs/12204169604/job/34048691307?pr=9299#step:11:13)9,
"function": "get",
"class": "RectorPrefix202411\\Illuminate\\Container\\Container",
"type": "->"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/bin/rector",
"line": 5,
"args": [
"/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/bin/rector.php"
],
"function": "require_once"
},
{
"file": "/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/bin/rector",
"line": 1[19](https://github.com/codeigniter4/CodeIgniter4/actions/runs/12204169604/job/34048691307?pr=9299#step:11:20),
"args": [
"/home/runner/work/CodeIgniter4/CodeIgniter4/vendor/rector/rector/bin/rector"
],
"function": "include"
}
]
}
Ref : https://github.com/codeigniter4/CodeIgniter4/actions/runs/12204169604/job/34048691307?pr=9299 |
Member
Author
|
Oh, I didn't notice that. But why does github actions not fail on that? |
Collaborator
|
Maybe shipmonk no catch exception, I think this related to shipmonk using |
35b2a34 to
17ca6ee
Compare
paulbalandan
commented
Dec 10, 2024
This comment was marked as outdated.
This comment was marked as outdated.
Member
|
@ddevsr the codeigniter phpstan extension needs to be updated to use phpstan v2 first before it can require rector v2. |
17ca6ee to
5978a9a
Compare
5978a9a to
4270d22
Compare
This comment was marked as outdated.
This comment was marked as outdated.
4270d22 to
7f62e0e
Compare
18d59a4 to
e8e2c9f
Compare
e8e2c9f to
8bceabc
Compare
Member
|
@ddevsr see PR: for upgrade to phpstan 2 and rector 2. |
5 tasks
Member
Author
|
Thanks all for the reviews. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR splits our existing enormous
phpstan-baseline.phpinto smaller baseline files named by their identifiers, thanks to https://github.com/shipmonk-rnd/phpstan-baseline-per-identifier/tree/2.0.0. Currently, the baseline contains 4,052 errors. That's very overwhelming to fix. TBH, when looking at the baseline I cannot continue further because of the bulk of technical debt we have.The pro of this approach is that we can attack the baseline by identifier, making the cleanup less overwhelming. The cleanup would be bite-sized. The con of this approach is that we have too many baselines now, but that is the consequence of having 4k+ errors.
Same command to generate the baseline:
composer phpstan:baselineP.S I have fixed some of the files as PHPStan complains of
No error to ignorestuff.Checklist: