Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit e4b93d3

Browse files
michaelmoussamichalbundyra
authored andcommitted
Add v4 migration guide for PSR-11
1 parent 3adaf58 commit e4b93d3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/book/migration-v4.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Migration Guide
2+
3+
Migration guide for Zend Service version 4.0.0.
4+
5+
## PSR-11: Container Interface
6+
7+
[`container-interop/container-interop`](https://github.com/container-interop/container-interop)
8+
was officially deprecated in favor of [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md)
9+
on February 13, 2017. As such, all uses of the `Interop\Container\*` interfaces
10+
have been replaced with `Psr\Container\ContainerInterface`. Further, installs of
11+
`container-interop/container-interop` below version `1.2.0` is prohibited via
12+
Composer's `conflicts` configuration. Version `1.2.0` _does_ extend the PSR-11
13+
interfaces, and is thus still usable.
14+
15+
If your project typehints any `Interop\ContainerInterop\*` interfaces where any
16+
`Zend\ServiceManager\*` classes are expected, you _**must**_ update your code to
17+
expect `Zend\ServiceManager\*` or `Psr\Container\*` classes or interfaces instead.
18+
The latter is preferred, unless your code utilizes any additional functionality
19+
provided by the `Zend\ServiceManager\*` classes that are not declared in the
20+
PSR-11 interfaces.
21+
22+
To do this, use your favorite find-and-replace tool to update the following:
23+
- `use Interop\Container\ContainerInterface;` -> `use Psr\Container\ContainerInterface;`
24+
- `use Interop\Container\ContainerException;` -> `use Psr\Container\ContainerExceptionInterface;`
25+
- **Note:** You will also need to replace `ContainerException` with `ContainerExceptionInterface`
26+
where it is used throughout your code. If you _don't_ want to do that, you can include
27+
` as ContainerException` in the find-and-replace, and any existing use of `ContainerException`
28+
will continue to work.
29+
30+
> ### Note
31+
>
32+
> If you use fully-qualified class names in your typehints, rather than taking
33+
> advantage of `use` statements, you will need to run additional find-and-replace
34+
> commands to update those class paths within your code. The exact finds and
35+
> replaces to run for those scenarios are not covered in this migration guide, as
36+
> they can vary greatly and are not a generally recommended practice.

0 commit comments

Comments
 (0)