1- # Migrating from ` Zend\Code ` ` 2.* ` to ` 3.0.0 `
1+ # Migrating from zend-code v2 to v3
22
3- ### ` string ` , ` int ` , ` float ` , ` bool ` are no longer ignored
3+ ## ` string ` , ` int ` , ` float ` , ` bool ` are no longer ignored
44
55In 2.x, a ` Zend\Code\Generator\ParameterGenerator ` with name ` foo ` and type
66` string ` , ` int ` , ` float ` or ` bool ` simply generated code ` "$foo" ` :
@@ -27,7 +27,7 @@ if (in_array($type, ['string', 'int', 'float', 'bool'])) {
2727$generator->setType($type);
2828```
2929
30- ### ` Zend\Code\Reflection\ParameterReflection#getType() ` changes
30+ ## ` Zend\Code\Reflection\ParameterReflection#getType() ` changes
3131
3232PHP 7 introduced [ ` ReflectionParameter#getType() ` ] ( http://php.net/manual/en/reflectionparameter.gettype.php ) .
3333
@@ -37,7 +37,7 @@ was renamed to `Zend\Code\Reflection\ParameterReflection#detectType()`.
3737If you relied on ` Zend\Code\Reflection\ParameterReflection#getType() ` , you can
3838simply replace the method calls in your code.
3939
40- ### DocBlock types ignored by ` Zend\Code\Generator\ParameterGenerator::fromReflection() `
40+ ## DocBlock types ignored by ` Zend\Code\Generator\ParameterGenerator::fromReflection() `
4141
4242As a direct consequence of the previous change, calls to
4343` Zend\Code\Generator\ParameterGenerator::fromReflection() ` will not mirror the
@@ -73,7 +73,7 @@ That also means that reflecting scalar type hints from DocBlocks into the
7373signature of a generated method may lead to fatal errors (due to signature
7474mismatch) at runtime.
7575
76- ### Type strings are validated
76+ ## Type strings are validated
7777
7878If you attempt to generate type-hints for parameters or return types, those types are
7979now validated before the code is generated.
@@ -94,7 +94,7 @@ $parameterGenerator->setType('\\'); // invalid (throws exception)
9494```
9595
9696
97- ### Generated type-hints are now prefixed by ` "\" `
97+ ## Generated type-hints are now prefixed by ` "\" `
9898
9999Generated type-hints are now prefixed with the ` NAMESPACE_SEPARATOR ` ,
100100` "\" ` .
@@ -116,14 +116,13 @@ In version 3.x, it produces `public function foo(\baz $bar) : \tab {}`.
116116In order to avoid migration problems, be sure to always pass fully qualified class
117117names to ` Zend\Code\Generator\MethodGenerator ` and ` Zend\Code\Generator\ParameterGenerator ` .
118118
119-
120- ### ` Zend\Code\Generator\ParameterGenerator::$simple ` was removed
119+ ## ` Zend\Code\Generator\ParameterGenerator::$simple ` was removed
121120
122121If you extended ` Zend\Code\Generator\ParameterGenerator ` , be sure to check if you
123122are accessing the protected static variable ` $simple ` : it was removed, and you should
124123adapt your code by either copying it into your class or avoiding its usage.
125124
126- ### ` Zend\Code\Generator\ParameterGenerator::$type ` has changed
125+ ## ` Zend\Code\Generator\ParameterGenerator::$type ` has changed
127126
128127If you extended ` Zend\Code\Generator\ParameterGenerator ` , be sure to check if you
129128are accessing the protected variable ` $type ` : its type has changed.
0 commit comments