-
Notifications
You must be signed in to change notification settings - Fork 379
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
[Data Loader] [Data Locator] [Dependency Injection] Pass root paths to FileSystemLocator during construction #930
Conversation
|
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.
Remove unused use
statements from FileSystemLocator
, specifically:
Symfony\Component\OptionsResolver\Exception\ExceptionInterface;
Symfony\Component\OptionsResolver\OptionsResolver;
Using PHP CS Fixer would resolve this as well: #932 (review).
Aside from the requested changes, this looks great! |
This PR has been open for a long time (since May of this year). |
@rpkamp Your merge commit is very broken; please review. Better yet, don't use merges to re-align with upstream: use rebase! :-) Merging is awfully error-prone, as it results in "other people's code" being merged into "your code", which causes you to handle merge conflicts for "other people's code". Inversely, rebasing results in "your code" being merged into "other people's code", causing all merge conflicts to be directly related to your code as it applies on top of the upstream HEAD. This PR is planned for the |
I know, I usually use rebasing, but I thought I'd use github's merge conflict editor instead this time. Turns out that doesn't work very well for me 😉 I'll trash that merge commit and do a manual rebase onto 2.0 instead. |
Rebased against 2.0 and all tests are green again 😃 |
use Liip\ImagineBundle\DependencyInjection\Factory\Loader\FileSystemLoaderFactory; | ||
use Liip\ImagineBundle\DependencyInjection\Factory\Loader\LoaderFactoryInterface; | ||
use Liip\ImagineBundle\Tests\DependencyInjection\Factory\FactoryTestCase; | ||
use Liip\ImagineBundle\Tests\Functional\Fixtures\BarBundle\LiipBarBundle; | ||
use Liip\ImagineBundle\Tests\Functional\Fixtures\FooBundle\LiipFooBundle; | ||
use ReflectionProperty; |
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.
Our root namespace usages are resolved inline, ie use \ReflectionProperty
when used and remove use
statement.
Thanks @rpkamp! |
The point of this PR is to require a fully instantiated Locator in FileSystemLoader.
Before, you would need to pass a LocatorInterface and rootpaths to the FilesystemLoader, and the FilesystemLoader would then pass the rootpaths to the LocatorInterface, making the FilesystemLoader aware of the inner workings of LocatorInterface which it should not be.
By requiring a LocatorInterface with rootpaths set, this knowledge about inner workings of the LocatorInterface is removed.
This also removed the need for setOptions on the LocatorInterface, which did not really belong the main purpose of the interface (locating files) anyway.
It also removed the dependency on OptionsResolver from FileSystemLocator since the rootpaths can now be passed directly to the constructor, making the rootpaths a hard dependency instead of an optional one - which was incorrect.
Update by @robfrawley: Ran
php-cs-fixer
using new style rules and added types to locator interface/class method signatures.