-
Notifications
You must be signed in to change notification settings - Fork 378
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
Increase PHPStan level to 6 #1432
Merged
Merged
Changes from all commits
Commits
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
Large diffs are not rendered by default.
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
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
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.
are the exceptions really an array of LoaderInterface and not of an exception class?
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.
yeah, this is where is called:
LiipImagineBundle/src/Binary/Loader/ChainLoader.php
Lines 36 to 49 in fec3726
where
loaders
are:LiipImagineBundle/src/Binary/Loader/ChainLoader.php
Lines 28 to 30 in fec3726
and the
array_walk
is receivingLoaderInterface
:LiipImagineBundle/src/Binary/Loader/ChainLoader.php
Lines 56 to 62 in fec3726
But, based on the name, maybe it was a mistake.
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.
@dbu: The
ChainLoader
was thrown together without much thought, with no real planning, and no refactoring since, as we had needed to quickly resolve a dozen or so issues and feature requests at that time and, while not elegant, "it worked (TM)". ;-) That said, I must admit that the above handling is definitely hard to follow and conflates more responsibilities onto the loader class than it should have knowledge of.Do you find an implementation such as github.com/liip/LiipImagineBundle/compare/3.x...robfrawley:3.x to be clearer? Essentially, I wrapped any failures into their own exception class and also refactored the final thrown error handling logic (like message compilation) into its own Exception class, as well. Seems to work as expected; all the
Binary\Loader
tests continue to pass with these changes (I'll have to check the whole test sweet later, though, to be sure nothing is inadvertently affected). The refactored code above needs some additional love itself, too, but I'll tackle that depending on the reception.I can create a PR if the consensus is that the change is worthwhile, or feel free to discuss alternative approaches to cleaning it up. Either way, I try to take responsibility for any subpar code I introduced myself. :-) The real question is whether we'd prefer the code to be concise and cryptic (as it is) or verbose and readable (as I've outlined).
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.
Forgot to ping @franmomu relating to the above comment: #1432 (comment).
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.
thanks for the explanation @franmomu , i will merge the phpstan cleanups then, as that was the only question.
thanks @robfrawley for the refactoring suggestion. i like the direction this is taking! please do make a PR for it, and lets look at the details in that PR. (i myself have not contributed much to this bundle before taking up maintenance a few weeks ago, so i am not too familiar with its history. that also means i am not attached to any particular solution but very open to improve things ;-) )
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.
Sounds good; see #1434. 👍
By the way, I'm so glad you all finally cleaned up the directory structure of this bundle by adding root
src
,test
directories, etc. I tried to make that happen years ago, but it was rejected at the time to minimize merge and rebase issues. ;-)Anyway, my point is, having gone through a cursory review of your recent maintenance work, it looks like you guys have been doing wonders updating and modernizing this bundle.