All notable changes to this project will be documented in this file, in reverse chronological order by release.
#158 updates several switch
cases to use break
instead of continue
in order to prevent issues under the upcoming PHP 7.3 release.
#147 fixes the regular expression used for @var
annotations to
allow omission of the variable name.
#146 updates all @return
annotations to reflect the correct types returned by each method.
#144 fixes the class generator such that it now resolves
setExtendedClass()
arguments to aliases provided to the generator.
#140 fixes MethodScanner::setVisibility()
such that it no longer
casts the provided visibility token to lower case; this fix is necessary, as
the method is supposed to expect only the appropriate
T_(PUBLIC|PROTECTED|PRIVATE)
token values, which are integers.
#140 updates the MethodScanner::setVisibility()
method to raise
a package-specific InvalidArgumentException
instead of the non-existent
package Exception
class when an invalid visibility is provided.
MethodGenerator::copyMethodSignature()
constructor that
only copies the method declaration with no body nor docblock.omitdefaultvalue
key when using
ParameterGenerator::fromArray()
ParameterGenerator
is always a ValueGenerator
7.2
object
type-hintVarTag
support to the docblock generators and reflectors: allows generating
and parsing @var
tags.7.2
to the build matrix^7.1.0
^6.2.2
use
statements (experimenting with OpCache
OPCODE inlining optimisations)isInternalPhpType
twice in the TypeGenerator
void
return type declaration.iterable
type declaration.Zend\Code\Generator\MethodGenerator#getReturnType()
accessor.Zend\Code\Scanner\ClassScanner
to detect multiple interface inheritance.Zend\Code\Generator\ParameterGenerator
to allow copying parameter signatures
for non-optional parameters that are still nullable via a default = null
value.Zend\Code\Generator\ValueGenerator
so that class constants can now
be generated with arrays as default value (supported since PHP 5.6).use
statements.extends
statements qualify the parent class based on the current
namespace and/or import statements.TokenArrayScanner
when scanning closures.\n
for line endings in generated code, vs PHP_EOL
,
ensuring cross-platform consistency.MethodScanner::setVisibility()
method to raise a package-specific InvalidArgumentException
instead of
the non-existent package Exception
class when an invalid visibility is provided.This section refers to breaking changes: please refer to doc/book/migration.md for migration instructions.
string
, int
, float
, bool
passed to Zend\Code\Generator\ParameterGenerator#setType()
are no longer ignored in generated code #30Zend\Code\Generator\ParameterGenerator
via
Zend\Code\Generator\ParameterGenerator::fromReflection()
. #30Zend\Code\Generator\InvalidArgumentException
being thrown.
#30Zend\Code\Generator\ParameterGenerator::$simple
was removed. #30Zend\Code\Generator\ParameterGenerator#$type
is now a null|Zend\Code\Generator\TypeGenerator
: was a
string
before. #30Zend\Code\Generator
type-hints are now always prefixed with the namespace separator \
.
#30Zend\Code\Reflection\ParameterReflection#getType()
was renamed
to Zend\Code\Reflection\ParameterReflection#detectType()
in order to not override the inherited
ReflectionParameter#getType()
, introduced in PHP 7. #30Zend\Code\Generator\MethodGenerator#setReturnType()
.
#30Zend\Code\Generator\ParameterGenerator#setType()
and
Zend\Code\Generator\ParameterGenerator#getType()
. #30Zend\Code\Generator\ParameterGenerator#setVariadic()
and
Zend\Code\Generator\ParameterGenerator#getVariadic()
. #30Zend\Code\Generator\ParameterGenerator#setReturnsReference()
.
#30Zend\Code\ParameterGenerator::$simple
was removed. #30doctrine/common
suggestion/dev-dependency to the more specific
doctrine/annotations
package (which is what is actually consumed).array(...)
) or short
syntax ([...]
). This can be accomplished by setting the value type to
ValueGenerator::TYPE_ARRAY_SHORT
instead of using TYPE_ARRAY
.
Additionally, you can use TYPE_ARRAY_LONG
instead of TYPE_ARRAY
; the two
constants are synonyms.Zend\Code\Generator\InterfaceGenerator
.^2.6|^3.0
, and changes its
internal usage to use the triggerEventUntil()
signature.Zend\Code\Generator\ValueGenerator
: setConstants()
and getConstants()
can now receive/emit either an SPL ArrayObject
or
Zend\Stdlib\ArrayObject
. Since these are functionally equivalent, however,
you will experience no change in behavior.