Renamed IStrategy to StrategyInterface updated Truncation #580
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.
The previous
IStrategy
interface suffers from a few issues.<name>Interface
for all other interfaces while it usesI<name>
.@return
tag forIStrategy::applies()
specifies the return type asarray
. However, all the classes that implement the interface abool
is returned. Additionally, abool
is clearly expected when theapplies()
method is called...rollbar-php/src/Truncation/Truncation.php
Line 49 in 169cee9
Description of the change
These core issues perpetuated themselves through the implementations of the
IStrategy
interface. To resolve all of this, I have done the following...IStrategy
toStrategyInterface
.StrategyInterface
starting with theAbstractStrategy
.The updates to the interface would cause a BC since some user's custom truncation classes may not be complient with the interface anymore.
I also took the opportunity to clean up and document what each truncation strategy does and how payload truncation itself works. While doing so I also cleaned up some minor code quality issues. (This PR is mostly adding method PHPDocs). However, there are a few important code changes...
AbstractStrategy
to now require it implementStrategyInterface
. Any class that extendsAbstractStrategy
will still pass the validation.FramesStrategy::selectFrames()
is now a static method. This change was introduced because an instance ofFramesStrategy
was being instantiated byMinBodyStrategy
just soselectFrames()
could be called.Type of change
Related issues
None
Checklists
Development
Code review