This repository has been archived by the owner on Feb 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Replace container-interop with PSR-11 container interface #187
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
779d532
Replace `container-interop` with PSR-11
michaelmoussa 3adaf58
Update docs for container-interop -> PSR-11 change
michaelmoussa e4b93d3
Add v4 migration guide for PSR-11
michaelmoussa 946ff63
Updated test assets factories to PSR-11 container
michalbundyra 37d67f6
Fixed order of use statements
michalbundyra f4942fd
Updated exception - all library exceptions extend ExceptionInterface
michalbundyra 2eff858
ServiceNotFoundException implements PSR-11 NotFoundExceptionInterface
michalbundyra c800b99
Updated migration guide
michalbundyra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Migration Guide | ||
|
||
Migration guide for Zend Service version 4.0.0. | ||
|
||
## PSR-11: Container Interface | ||
|
||
[`container-interop/container-interop`](https://github.com/container-interop/container-interop) | ||
was officially deprecated in favor of [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) | ||
on February 13, 2017. As such, all uses of the interop-container interfaces | ||
have been replaced with PSR-11 containers interfaces as follows: | ||
- `Interop\Container\ContainerInterface` to `Psr\Container\ContainerInterface`, | ||
- `Interop\Container\Exception\ContainerException` to `Psr\Container\ContainerExceptionInterface`, | ||
- `Interop\Container\Exception\NotFoundException` to `Psr\Container\NotFoundExceptionInterface`. | ||
|
||
Further, installs of `container-interop/container-interop` below version `1.2.0` | ||
is prohibited via Composer's `conflicts` configuration. Version `1.2.0` _does_ | ||
extend the PSR-11 interfaces, and is thus still usable. | ||
|
||
If your project typehints any `Interop\ContainerInterop\*` interfaces where any | ||
`Zend\ServiceManager\*` classes are expected, you _**must**_ update your code to | ||
expect `Zend\ServiceManager\*` or `Psr\Container\*` classes or interfaces instead. | ||
The latter is preferred, unless your code utilizes any additional functionality | ||
provided by the `Zend\ServiceManager\*` classes that are not declared in the | ||
PSR-11 interfaces. | ||
|
||
To do this, use your favorite find-and-replace tool to update the following: | ||
- `use Interop\Container\ContainerInterface;` -> `use Psr\Container\ContainerInterface;` | ||
- `use Interop\Container\Exception\ContainerException;` -> `use Psr\Container\ContainerExceptionInterface;` | ||
- `use Interop\Container\Exception\NotFoundException;` -> `use Psr\Container\NotFoundExceptionInterface;` | ||
- **Note:** You will also need to replace `ContainerException` with `ContainerExceptionInterface` | ||
and `NotFoundException` with `NotFoundExceptionInterface` where it is used | ||
throughout your code. If you _don't_ want to do that, you can include | ||
`as ContainerException`/`as NotFoundException` in the find-and-replace, | ||
and any existing use of `ContainerException`/`NotFoundException` will | ||
continue to work. | ||
|
||
> ### Note | ||
> | ||
> If you use fully-qualified class names in your typehints, rather than taking | ||
> advantage of `use` statements, you will need to run additional find-and-replace | ||
> commands to update those class paths within your code. The exact finds and | ||
> replaces to run for those scenarios are not covered in this migration guide, as | ||
> they can vary greatly and are not a generally recommended practice. | ||
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.
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.
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 migration process is very basic, but I think it would be nice to have migration tool. I think it could be done later on, so I'd like to leave just a note for that. Unless you have another idea?
I think delivering migration tools will help to migrate quicker to newer version.