Skip to content

Releases: nette/php-generator

Released version 4.0.2

21 Jun 12:07
@dg dg
Compare
Choose a tag to compare
  • Printer: added $bracesOnNextLine #112
  • Extractor: added support for Readonly promoted parameters (#111)
  • Printer: refactoring
  • Dumper: supports __serialize()
  • Dumper, Helpers::formatDocComment(), Printer::printFunction() & etc normalizes whitespace
  • Printer: always prints trailing comma #106
  • TraitType: traits cannot have constants

Released version 4.0.1

10 Mar 02:53
@dg dg
Compare
Choose a tag to compare
  • ClassType divided into InterfaceType, TraitType & EnumType
  • Enum: value can be expression
  • Extractor: supports promoted parameters #103
  • Extractor: maintains exact visibility
  • PhpNamespace: added removeUse() #102
  • constants are PascalCase
  • strict fixes
  • ClassType::__clone() clones traits

Released version 3.6.7

10 Mar 02:51
@dg dg
Compare
Choose a tag to compare
  • Extractor: supports promoted parameters #103
  • Extractor: maintains exact visibility
  • PhpNamespace: added removeUse() #102
  • constants are PascalCase
  • ClassType::__clone() clones traits

Released version 4.0.0

20 Feb 18:16
@dg dg
Compare
Choose a tag to compare

This release takes advantage of all the new features of PHP 8 and cleans up some issues in the API.

  • uses PHP 8 typehints & property typehints
  • Dumper: prints comma after last argument

Stricter behaviour:

  • ClassType::add*() throws exception when method/property/etc already exists
  • PhpNamespace::add*() throws exception when class/function already exists

Changes:

  • ClassType::addTrait() returns new class TraitUse instead of $this
  • ClassType::getTraits() returns TraitUse[] instead of string[]
  • Method: body is always string, even for interfaces
  • ClassType::setConstants() and setTraits() accepts array of Constant resp TraitUse objects only

Deprecations:

  • deprecated magic properties (BC break)
  • ClassType::withBodiesFrom() replaced with from(..., withBodies: true)
  • GlobalFunction::withBodyFrom() replaced with from(..., withBody: true)
  • ClassType::from() & Factory::fromClassReflection(): removed parameter $materializeTraits

Released version 3.6.5 (EOL)

20 Feb 18:10
@dg dg
Compare
Choose a tag to compare
  • Extractor: preserves the first comment in the file #100
  • PhpNamespace: added removeClass() & removeFunction()
  • coding style

This is the last 3.6.x release.

Released version 3.6.5

24 Nov 16:28
@dg dg
Compare
Choose a tag to compare
  • PhpNamespace: added resolveName()
  • Extractor: fixed extracting attributes #98
  • PhpNamespace::addUse() ignores names in current namespace #96
  • Dumper: improved encoding of strings

BLOG POST: https://blog.nette.org/en/phpgenerator-3-6-news-from-php-8-1-and-more

Released version 3.6.4

26 Oct 09:32
@dg dg
Compare
Choose a tag to compare
  • use-statements for functions & constants
  • ClassType: method names are case insensitive
  • PhpNamespace: class and function names are case-insensitive
  • PhpNamespace: addUse() & simplifyName() is case-insensitive
  • PhpNamespace::simplifyName() fixed collision when alias already exists
  • PhpNamespace: improved collision checking between class and alias
  • PhpNamespace::addUse() removed parameter $aliasOut (BC break)
  • PhpNamespace::addUse() simplified aliases generation
  • Factory: supports 'new' in parameters
  • accept numeric array keys when validating types #91

Released version 3.6.2

24 Sep 11:32
@dg dg
Compare
Choose a tag to compare
  • Printer: added property $wrapLength #55 #56
  • getType(), getReturnType(): added option $asObject that returns Nette\Utils\Type
  • Factory: constant values are tagged for resolving
  • Resolving of names in body & literals #85
  • "use Trait" can have comments #90
  • added TraitUse, represents use-statement
  • PhpNamespace::simplifyType() supports generics like Foo<A, B>
  • PhpNamespace::unresolveName() renamed to simplifyName()
  • Helpers::unindent() fixed when level = 0
  • Dumper::format() placeholder ? must not be followed by \w
  • Dumper: added $indentation
  • Dumper: refactoring
  • Printer: refactoring, added property $dumper
  • Printer: refactoring, added property $namespace
  • Revert "Dumper: dumps Closure as PHP code" (BC break)
  • PhpNamespace::addUse() added validation
  • checks reserved class names
  • added validator for types
  • added Property and Parameter validation
  • improved validation error messages
  • Escapes */ in comments

Released version 3.6.1

17 Sep 15:39
@dg dg
Compare
Choose a tag to compare
  • added ClassType::fromCode() & PhpFile::fromCode() #79
  • Factory::fromClassReflection() added option to materialize traits or not #89
  • PhpFile, PhpNamespace: can contain functions [Closes #80]
  • PhpFile: added getClasses()
  • Factory: generates trait resolutions
  • ClassType: constants are 'public' by default
  • Dumper: prints closures as func(...) in PHP 8.1

Released version 3.6.0

25 Aug 11:16
@dg dg
Compare
Choose a tag to compare
  • support for PHP 8.1
  • added support for enums
  • added support for intersection types foo&bar
  • added support for final constants
  • added support for readonly properties
  • added 'never' built-in type
  • Literal: accepts parameters
  • Dumper: can dump static Closure
  • ClassType: setInterface() & setTrait() replaced with interface() & trait() factories
  • requires PHP 7.2