Skip to content
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

Merged
merged 5 commits into from Mar 2, 2018

Conversation

rpkamp
Copy link
Contributor

@rpkamp rpkamp commented May 11, 2017

Q A
Branch? 2.0
Bug fix? no
New feature? no
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets discussion in #908 (comment)
License MIT

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.

@robfrawley
Copy link
Collaborator

robfrawley commented May 11, 2017

You need to create a PR against the 1.x branch with appropriate deprecations. Done in #932.

@robfrawley robfrawley changed the title Require fully instantiated Locator in FileSystemLoader Pass roots to FileSystemLocator during construction May 12, 2017
@robfrawley robfrawley added this to the 2.0.0 milestone May 12, 2017
@robfrawley robfrawley added Attn: BC Break This issue or PR results in a backwards-compatibility break and therefore requires a major release. Level: Enhancement ✨ This item involves an enhancement to existing functionality. State: Reviewing This item is being reviewed to determine if it should be accepted. labels May 12, 2017
@robfrawley robfrawley self-assigned this May 12, 2017
Copy link
Collaborator

@robfrawley robfrawley left a 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).

@robfrawley
Copy link
Collaborator

Aside from the requested changes, this looks great!

@rpkamp rpkamp changed the title Pass roots to FileSystemLocator during construction Pass roots to FileSystemLocator during construction [2.0 branch] May 20, 2017
@rpkamp
Copy link
Contributor Author

rpkamp commented Nov 27, 2017

This PR has been open for a long time (since May of this year).
Anything I can do to advance the merging of this PR?

@robfrawley robfrawley added State: Confirmed This item has been confirmed by maintainers as legitimate. Type: Source Code This item pertains to the source code of this project. and removed State: Reviewing This item is being reviewed to determine if it should be accepted. labels Jan 22, 2018
@robfrawley robfrawley changed the title Pass roots to FileSystemLocator during construction [2.0 branch] [Data Loader] [Data Locator] [Dependency Injection] Pass root paths to FileSystemLocator during construction Feb 16, 2018
@robfrawley
Copy link
Collaborator

robfrawley commented Mar 2, 2018

@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 2.0.0 release (scheduled to be tagged March 12), assuming conflicts are resolved.

@rpkamp
Copy link
Contributor Author

rpkamp commented Mar 2, 2018

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.

@rpkamp
Copy link
Contributor Author

rpkamp commented Mar 2, 2018

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;
Copy link
Collaborator

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.

@robfrawley robfrawley merged commit 13cdab6 into liip:2.0 Mar 2, 2018
@robfrawley
Copy link
Collaborator

Thanks @rpkamp!

@rpkamp rpkamp deleted the simplify-locators branch March 2, 2018 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attn: BC Break This issue or PR results in a backwards-compatibility break and therefore requires a major release. Level: Enhancement ✨ This item involves an enhancement to existing functionality. State: Confirmed This item has been confirmed by maintainers as legitimate. Type: Source Code This item pertains to the source code of this project.
Projects
2.x Sprint 001
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

3 participants