All notable changes to this project will be documented in this file, in reverse chronological order by release.
Feature release (minor)
Feature release (minor)
TraitGenerator
test code coverage thanks to @mchekinfalse
mixed
null
static
7.4
Laminas\Code\Generator\ClassGenerator#generate()
declare()
statements
will now be generated above namespace
declarations: this is to be better compliant with PSR-2, but it
may break downstream applications if these rely on the stability of code produced
by Laminas\Code\Generator\FileGenerator#generate()
laminas/laminas-zendframework-bridge
has been removed, and is instead to be installed optionally
by consumers of the library. If you are still migrating from zendframework/zend-code
, you will
need to add it to your composer.json
yourself, or directly use to Laminas\Code
symbols.Scanner
and Annotation
components have been removed, and with it all API that interacted with it:
Laminas\Code\Generator\FileGeneratorRegistry
has been deletedLaminas\Code\Generator\FileGenerator::fromReflectedFileName()
was removedLaminas\Code\Generator\FileGenerator::fromReflection()
was removedLaminas\Code\NameInformation
has been deletedLaminas\Code\Reflection\ReflectionInterface
was marked @internal
Laminas\Code\Reflection\FileReflection
has been deletedLaminas\Code\Generic\Prototype\PrototypeInterface
was marked @internal
Laminas\Code\Generic\Prototype\PrototypeClassFactory
was marked @internal
Laminas\Code\Generic\Prototype\PrototypeGenericInterface
was marked @internal
Laminas\Code\Annotation\AnnotationInterface
has been deletedLaminas\Code\Annotation\Parser\GenericAnnotationParser
has been deletedLaminas\Code\Annotation\Parser\ParserInterface
has been deletedLaminas\Code\Annotation\Parser\DoctrineAnnotationParser
has been deletedLaminas\Code\Annotation\AnnotationManager
has been deletedLaminas\Code\Annotation\AnnotationCollection
has been deletedLaminas\Code\Scanner\ValueScanner
has been deletedLaminas\Code\Scanner\DirectoryScanner
has been deletedLaminas\Code\Scanner\DocBlockScanner#$nameInformation
was removedLaminas\Code\Scanner\DocBlockScanner#$annotationManager
was removedLaminas\Code\Scanner\DocBlockScanner#$annotations
was removedLaminas\Code\Scanner\DocBlockScanner#getAnnotations()
was removedLaminas\Code\Scanner\DocBlockScanner
was marked @internal
Laminas\Code\Scanner\ConstantScanner
has been deletedLaminas\Code\Scanner\FunctionScanner
has been deletedLaminas\Code\Scanner\AnnotationScanner
has been deletedLaminas\Code\Scanner\DerivedClassScanner
has been deletedLaminas\Code\Scanner\ClassScanner
has been deletedLaminas\Code\Scanner\AggregateDirectoryScanner
has been deletedLaminas\Code\Scanner\TokenArrayScanner
has been deletedLaminas\Code\Scanner\ParameterScanner
has been deletedLaminas\Code\Scanner\FileScanner
has been deletedLaminas\Code\Scanner\PropertyScanner
has been deletedLaminas\Code\Scanner\CachingFileScanner
has been deletedLaminas\Code\Scanner\ScannerInterface
has been deletedLaminas\Code\Scanner\MethodScanner
has been deletedLaminas\Code\Scanner\Util
has been deletednext backward compatibility break release (major)
4.0.x
branch against real-world applications before releasing thanks to @Ocramius3.5.0
into development branch for 4.0.x
thanks to @OcramiusScanner
component, removed FileReflection
, removed NameInformation
and made DocBlockScanner
@internal
thanks to @Ocramius3.5.x bugfix release (patch)
next feature release (minor)
47: Start PHP 8.0 support thanks to @Slamdunk
43: QA fix for phpstan thanks to @janvernieuwe
zendframwork/zend-code#179 fixes exception message when invalid value provided in Laminas\Code\Generator\ValueGenerator
.
zendframwork/zend-code#180 fixes PHP 7.4 compatibility.
zendframwork/zend-code#170 adds class constant visibility modifiers support.
zendframwork/zend-code#169 adds the ability to define declare statements.
zendframwork/zend-code#167 adds the ability to remove doc block of a member.
zendframwork/zend-code#171 changes curly braces in array and string offset access to square brackets in order to prevent issues under the upcoming PHP 7.4 release.
zendframwork/zend-code#164 fixes indentation in multi-level arrays generated by ValueGenerator
.
zendframwork/zend-code#158 updates several switch
cases to use break
instead of continue
in order to prevent issues under the upcoming PHP 7.3 release.
zendframwork/zend-code#147 fixes the regular expression used for @var
annotations to
allow omission of the variable name.
zendframwork/zend-code#146 updates all @return
annotations to reflect the correct types returned by each method.
zendframwork/zend-code#144 fixes the class generator such that it now resolves
setExtendedClass()
arguments to aliases provided to the generator.
zendframwork/zend-code#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.
zendframwork/zend-code#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.Laminas\Code\Generator\MethodGenerator#getReturnType()
accessor.Laminas\Code\Scanner\ClassScanner
to detect multiple interface inheritance.Laminas\Code\Generator\ParameterGenerator
to allow copying parameter signatures
for non-optional parameters that are still nullable via a default = null
value.Laminas\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 docs/book/migration.md for migration instructions.
string
, int
, float
, bool
passed to Laminas\Code\Generator\ParameterGenerator#setType()
are no longer ignored in generated code zendframwork/zend-code#30Laminas\Code\Generator\ParameterGenerator
via
Laminas\Code\Generator\ParameterGenerator::fromReflection()
. zendframwork/zend-code#30Laminas\Code\Generator\InvalidArgumentException
being thrown.
zendframwork/zend-code#30Laminas\Code\Generator\ParameterGenerator::$simple
was removed. zendframwork/zend-code#30Laminas\Code\Generator\ParameterGenerator#$type
is now a null|Laminas\Code\Generator\TypeGenerator
: was a
string
before. zendframwork/zend-code#30Laminas\Code\Generator
type-hints are now always prefixed with the namespace separator \
.
zendframwork/zend-code#30Laminas\Code\Reflection\ParameterReflection#getType()
was renamed
to Laminas\Code\Reflection\ParameterReflection#detectType()
in order to not override the inherited
ReflectionParameter#getType()
, introduced in PHP 7. zendframwork/zend-code#30Laminas\Code\Generator\MethodGenerator#setReturnType()
.
zendframwork/zend-code#30Laminas\Code\Generator\ParameterGenerator#setType()
and
Laminas\Code\Generator\ParameterGenerator#getType()
. zendframwork/zend-code#30Laminas\Code\Generator\ParameterGenerator#setVariadic()
and
Laminas\Code\Generator\ParameterGenerator#getVariadic()
. zendframwork/zend-code#30Laminas\Code\Generator\ParameterGenerator#setReturnsReference()
.
zendframwork/zend-code#30Laminas\Code\ParameterGenerator::$simple
was removed. zendframwork/zend-code#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.Laminas\Code\Generator\InterfaceGenerator
.^2.6|^3.0
, and changes its
internal usage to use the triggerEventUntil()
signature.Laminas\Code\Generator\ValueGenerator
: setConstants()
and getConstants()
can now receive/emit either an SPL ArrayObject
or
Laminas\Stdlib\ArrayObject
. Since these are functionally equivalent, however,
you will experience no change in behavior.