8000 Deprecate ResourceInterface::getResource() by mpdude · Pull Request #15719 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Deprecate ResourceInterface::getResource() #15719

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

Merged
merged 1 commit into from
Sep 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Deprecate ResourceInterface::getResource()
The return value of this method does not make sense if you do not exactly know
about the type of resource at hand. For example, it may be [an array](https://github.com/symfony/symfony/blob/b49fa129bdb3c0aa970a006b16dd1ca63a9d7ebd/src/Symfony/Component/HttpKernel/Config/EnvParametersResource.php#L57)
or a [file path](https://github.com/symfony/symfony/blob/87800ae47e64429f2544b798575d1cc1d4e5464a/src/Symfony/Component/Config/Resource/FileResource.php#L51).

As all usages of getResource() within Symfony are in tests of particular Resource implementations anyway, deprecating and later removing this interface
helps us with simplifying the ResourceInterface (#7176).
  • Loading branch information
mpdude committed Sep 25, 2015
commit 87c0c7d40041117f59025e1866bf20052561d6e8
4 changes: 4 additions & 0 deletions src/Symfony/Component/Config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ After: the code will work as expected and it will restrict the values of the

* deprecated the `ResourceInterface::isFresh()` method. If you implement custom resource types and they
can be validated that way, make them implement the new `SelfCheckingResourceInterface`.
* deprecated the getResource() method in ResourceInterface. You can still call this method
on concrete classes implementing the interface, but it does not make sense at the interface
level as you need to know about the particular type of resource at hand to understand the
semantics of the returned value.

2.7.0
-----
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/Config/Resource/ResourceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public function isFresh($timestamp);
* Returns the tied resource.
*
* @return mixed The resource
*
* @deprecated since 2.8, to be removed in 3.0. As there are many different kinds of resource,
* a single getResource() method does not make sense at the interface level. You
* can still call getResource() on implementing classes, probably after performing
* a type check. If you know the concrete type of Resource at hand, the return value
* of this method may make sense to you.
*/
public function getResource();
}
0