annotate vendor/zendframework/zend-stdlib/doc/book/migration.md @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
rev   line source
Chris@0 1 # Migration Guide
Chris@0 2
Chris@0 3 ## From v2 to v3
Chris@0 4
Chris@0 5 The changes made going from v2 to v3 were:
Chris@0 6
Chris@0 7 - Removal of the Hydrator subcomponent.
Chris@0 8 - Removal of the `CallbackHandler` class.
Chris@0 9 - Removal of `Zend\Stdlib\Guard\GuardUtils`.
Chris@0 10
Chris@0 11 ### Hydrators
Chris@0 12
Chris@0 13 The biggest single change from version 2 to version 3 is that the hydrator
Chris@0 14 subcomponent, which was deprecated in v2.7.0, is now removed. This means that if
Chris@0 15 you were using zend-stdlib principally for the hydrators, you need to convert
Chris@0 16 your code to use [zend-hydrator](https://github.com/zendframework/zend-hydrator).
Chris@0 17
Chris@0 18 This will also mean a multi-step migration. zend-stdlib v3 pre-dates
Chris@0 19 zend-hydrator v2.1, which will be the first version that supports zend-stdlib v3
Chris@0 20 and zend-servicemanager v3. If you are using Composer, the migration should be
Chris@0 21 seamless:
Chris@0 22
Chris@0 23 - Remove your zend-stdlib dependency:
Chris@0 24
Chris@0 25 ```bash
Chris@0 26 $ composer remove zendframework/zend-stdlib
Chris@0 27 ```
Chris@0 28
Chris@0 29 - Update to use zend-hydrator:
Chris@0 30
Chris@0 31 ```bash
Chris@0 32 $ composer require zendframework/zend-hydrator
Chris@0 33 ```
Chris@0 34
Chris@0 35 When zend-hydrator updates to newer versions of zend-stdlib and
Chris@0 36 zend-servicemanager, you will either automatically get those versions, or you
Chris@0 37 can tell composer to use those specific versions:
Chris@0 38
Chris@0 39 ```bash
Chris@0 40 $ composer require "zendframework/zend-stdlib:^3.0"
Chris@0 41 ```
Chris@0 42
Chris@0 43 ### CallbackHandler
Chris@0 44
Chris@0 45 `Zend\Stdlib\CallbackHandler` primarily existed for legacy purposes; it was
Chris@0 46 created before the `callable` typehint existed, so that we could typehint PHP
Chris@0 47 callables. It also provided some minimal features around lazy-loading callables
Chris@0 48 from instantiable classes, but these features were rarely used, and better
Chris@0 49 approaches already exist for handling such functinality in zend-servicemanager
Chris@0 50 and zend-expressive.
Chris@0 51
Chris@0 52 As such, the class was marked deprecated in v2.7.0, and removed for v3.0.0.
Chris@0 53
Chris@0 54 ### GuardUtils
Chris@0 55
Chris@0 56 Version 3 removes `Zend\Stdlib\Guard\GuardUtils`. This abstract class existed to
Chris@0 57 provide the functionality of the various traits also present in that
Chris@0 58 subcomponent, for consumers on versions of PHP earlier than 5.4. Since the
Chris@0 59 minimum required version is now PHP 5.5, the class is unnecessary. If you were
Chris@0 60 using it previously, compose the related traits instead.