This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
split cases for different injectors #47
Merged
weierophinney
merged 3 commits into
zendframework:master
from
SlayerBirden:bugfix/fix_fatal_error_during_package_uninstall
Jan 11, 2018
Merged
split cases for different injectors #47
weierophinney
merged 3 commits into
zendframework:master
from
SlayerBirden:bugfix/fix_fatal_error_during_package_uninstall
Jan 11, 2018
Conversation
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
weierophinney
suggested changes
Jan 10, 2018
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.
A few comments:
- Please add a
@todo
annotation to theInjectorInterface
to add agetConfigFile()
method in the next major version. - Add a
@todo
annotation togetInjectorConfigFileName()
to remove it for the next major version in favor of the definedgetConfigFile()
method on the interface. - Please add unit tests so we can validate the fix.
Thanks!
src/ComponentInstaller.php
Outdated
} elseif ($injector instanceof AbstractInjector) { | ||
// default flow | ||
$fileName = $injector->getConfigFile(); | ||
} |
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.
Please split each of these cases into its own method, and return the results of calling that method.
As an example:
private function getInjectorConfigFileName(InjectorInterface $injector)
{
if ($injector instanceof ConfigInjectorChain) {
return $this->getConfigFileNameFromInjectorChain($injector);
}
// etc.
return '';
}
private function getConfigFileNameFromInjectorChain(ConfigInjectorChain $injector)
{
$names = [];
foreach ($injector->getCollection() as $item) {
$names[] = $this->getInjectorConfigFileName($item);
}
return implode(', ', $names);
}
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.
@weierophinney done; removed the noop case as it's not actually possible to reach it with current ConfigDiscovery logic
refactor getConfigName calls - divide into smaller methods; add testing for different injector types;
@weierophinney ^ test results |
weierophinney
approved these changes
Jan 11, 2018
weierophinney
added a commit
that referenced
this pull request
Jan 11, 2018
weierophinney
added a commit
that referenced
this pull request
Jan 11, 2018
Forward port #47 Conflicts: CHANGELOG.md
Thanks, @SlayerBirden |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Method
getConfigFile
is not defined in the InjectorInterface hence it's missing from some injectors.Adjusted logic to apply different "get" logic based on different injector types with default fallback.
This fixes #39