-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Finder] Deprecate adapters and related classes #15805
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
Conversation
nicolas-grekas
commented
Sep 15, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | - |
License | MIT |
Doc PR | - |
c86cf65
to
473330c
Compare
@@ -282,7 +284,7 @@ public function testFilter($adapter) | |||
public function testFollowLinks($adapter) | |||
{ | |||
if ('\\' == DIRECTORY_SEPARATOR) { | |||
return; | |||
$this->markTestSkipped('symlinks are not supported on Windows'); |
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.
this should be done in older branches
I suggest doing the change of the way adapters are covered in the 2.3 branch instead:
Tests which don't use the adapter data providers currently should also stay in a separate FinderTest instead of running several times (once per adapter testcase) |
$this->markTestSkipped(get_class($this).' is not supported.'); | ||
} | ||
|
||
return array($adapter); |
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.
Instead of a method returning an array of adapters with a single element, and then using this to build a dataProvider providing the adapter, I suggest you to use a protected method getAdapter
returning the adapter being used for tests and using it in buildFinder()
(which would not need an argument anymore). It would make tests much easier to understand
btw, the change in the way tests for unsupported adapters are ignored is something I wanted to do after looking at the finder testsuite today while reviewing your other PR. Knowing what is running or no is hard in the current setup |
@stof would you like to do the PR on 2.3 then? |
Regarding the deprecation, should we actually deprecate it yet ? the comparison in #15802 (comment) still shows a significant difference between them, which means this introduces a potential slowdown for people using |
@nicolas-grekas not immediately, but I can, yes. |
I think we should deprecate the other adapter for several reasons:
|
btw, the finder-benchmark has a bunch of other cases which have not been run when you compared it (they are commented in the latest commit of the finder benchmark repo but you can uncomment it). It would be great to run them too. @fabpot we know we can optimize the PHP adapter further. but shouldn't we do it before deprecating things ? Btw, if we deprecate adapters, we should also deprecate adapter-related methods in the Finder class |
I'm all for removing everything related to the adapters in the Finder. I wouldn't want this code in 3.0 if possible. It was a mistake back then to introduce such a complex layer. |
From what I understand by reading quickly the code, the Gnu and Bsd adapters are never used by default. The only way to use them is to enabled them explicitly. Which means almost everyone uses the PhpAdapter. I'd be in favor of deprecating to have 3.0 cleaned from them. |
@nicolas-grekas they would be used when using Note that I fully agree with you about the need to deprecate it and clean it. The question is whether we should work on optimization first or no. |
Given that the feature freeze is in a few days, I'd be in favor of deprecating now, and optimize later |
f758dd8
to
0163796
Compare
Status: needs work |
should we reopen #5951 until more optimization work is done ? |
This PR was merged into the 2.3 branch. Discussion ---------- Improve the structure of the Finder testsuite | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Testing against different adapters is now handled by multiple subclasses of a common test case rather than using data providers. This allows tests to be marked as skipped for unsupported adapters instead of making them disappear from the testsuite. This will also make it much easier to mark tests for the find-based adapters as legacy ones when deprecating them. This correspond to changes done by @nicolas-grekas in #15805, backported to 2.3 and with the data providers removed (his PR was keeping data providers for the adapter but making it return a single adapter all the time, hence the much bigger diff in my PR). All tests in AbstractFinderTest are just moved from the FinderTest (they are all the tests running against multiple adapters). FinderTest itself runs the PhpAdapter (as this is the logic we want to keep in the finder in 3.0). I also tried to have a PhpFinderTest and keeping FinderTest only with the extra tests, but this would make things harder to merge branches between 2.8 and 3.0 in the future (once we remove other adapter tests) as we could simply keep the AbstractFinderTest in 3.0 for now to ease merging PRs adding new tests for bug fixes. Commits ------- 20f2d03 Improve the structure of the Finder testsuite
@nicolas-grekas you can now work again on this (after merging branches together) |
a0002a7
to
55fb6b3
Compare
PR updated with all the adapter layer being deprecated. |
55fb6b3
to
58b6c29
Compare
$iterator = $iteratorAggregate->getIterator(); | ||
} | ||
|
||
return $iterator; |
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.
We should find a way to avoid duplicating the PhpAdapter codebase. It would be a maintenance pain otherwise as we would have to think about duplicating any change when merging branches into 2.8
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.
I thought the same at first, but this would require some indirection that would be just boilerplate for the shake of synchronization.
Instead, I propose to add a test (here) that just checks that the source code is kept in sync.
Given that all 2.x branches are going to be moved to maintenance only mode, this code won't move that much now.
I think this new test + the test suite is enough as a safe guard. Don't you?
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.
@nicolas-grekas given that Finder optimization are currently considered as being suited for maintenance releases, it might still change :)
but yeah, the test is a good idea.
Status: needs review |
58b6c29
to
d243913
Compare
@@ -771,11 +792,7 @@ private function sortAdapters() | |||
} | |||
|
|||
/** | |||
* @param $dir |
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.
the param should be kept (but we should add the missing type in a 2.3+ PR)
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.
that's a private function...
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.
but ok, reverted
👍 Status: reviewed |
d243913
to
c08cf4b
Compare
Thank you @nicolas-grekas. |
…as-grekas) This PR was merged into the 2.8 branch. Discussion ---------- [Finder] Deprecate adapters and related classes | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- c08cf4b [Finder] Deprecate adapters and related classes
This PR was merged into the 3.3-dev branch. Discussion ---------- [Finder] Deprecate ExceptionInterface | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A This interface was missed in #15805, and should have been removed in 3.0. Ideally, the component should have such an interface, though, as other components does. But the only domain exception in this component is an `AccessDeniedException` used by the `RecursiveDirectoryIterator`. So it isn't worth it right now. I think this interface was almost internal actually, but anyway the `\Symfony\Component\Finder\Adapter\AdapterInterface` interface does not exist anymore. So the `ExceptionInterface::getAdapter()` signature cannot be satisfied anyway. I guess anyone relying on this interface in any way should have notice that and removed anything related to Symfony Finder's adapters when upgrading to 3.0. Should we consider removing it directly in the 3.1 branch instead? Commits ------- 1b600b0 [Finder] Deprecate ExceptionInterface
This PR was merged into the 2.3 branch. Discussion ---------- Improve the structure of the Finder testsuite | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Testing against different adapters is now handled by multiple subclasses of a common test case rather than using data providers. This allows tests to be marked as skipped for unsupported adapters instead of making them disappear from the testsuite. This will also make it much easier to mark tests for the find-based adapters as legacy ones when deprecating them. This correspond to changes done by @nicolas-grekas in symfony/symfony#15805, backported to 2.3 and with the data providers removed (his PR was keeping data providers for the adapter but making it return a single adapter all the time, hence the much bigger diff in my PR). All tests in AbstractFinderTest are just moved from the FinderTest (they are all the tests running against multiple adapters). FinderTest itself runs the PhpAdapter (as this is the logic we want to keep in the finder in 3.0). I also tried to have a PhpFinderTest and keeping FinderTest only with the extra tests, but this would make things harder to merge branches between 2.8 and 3.0 in the future (once we remove other adapter tests) as we could simply keep the AbstractFinderTest in 3.0 for now to ease merging PRs adding new tests for bug fixes. Commits ------- 12f0f55 Improve the structure of the Finder testsuite