Skip to content

Releases: typhoon-php/typhoon

0.4.4 Bugfixes, Parameter::with(), ShapeElement::with()

18 Aug 20:05
Compare
Choose a tag to compare

Type

Added

  • Add Parameter::with().
  • Add ShapeElement::with().

Changed

  • Make ShapeElement::__construct($type) optional with types::mixed as a default value.

Reflection

Fixed

  • Resolve templates in type arguments of inherited parents and interfaces.

ChangeDetector

Fixed

  • Fix inverted logic in PhpVersionChangeDetector::changed().
  • Fix inverted logic in PhpExtensionVersionChangeDetector::changed().

Full Changelog: 0.4.3...0.4.4

0.4.3 ConstantReflection

06 Aug 17:16
Compare
Choose a tag to compare

What's Changed

Type

  • Add types::value() factory that creates a Type from an arbitrary value.

Reflection

  • Add ConstantReflection and TyphoonReflector::reflectConstant().

TypedMap

  • Make TypedMap implement \Countable.

ChangeDetector

  • Add ConstantChangeDetector.

PhpStormReflectionStubs

  • Do not locate defined constants via PhpStormStubsLocator. Reflecting defined constants from value is less
    error-prone.

New Contributors

Full Changelog: 0.4.2...0.4.3

0.4.2 Emphasize the risk of runtime errors in Reflection methods

05 Aug 16:10
Compare
Choose a tag to compare

Type

  • Drop needless $type parameter PHPDoc types in TypeVisitor.
  • Return Type<int> in types::intMask() due to possibly overflowing bitmasks.

Reflection

  • Add AttributeReflection::evaluate() to emphasize the risk of runtime errors.
  • Add AttributeReflection::evaluateArguments() to emphasize the risk of runtime errors.
  • Add ClassConstantReflection::evaluate() to emphasize the risk of runtime errors.
  • Add ParameterReflection::evaluateDefault() to emphasize the risk of runtime errors.
  • Add PropertyReflection::evaluateDefault() to emphasize the risk of runtime errors.

Full Changelog: 0.4.1...0.4.2

0.4.1 Bugfixes

05 Aug 04:56
Compare
Choose a tag to compare

Type

  • Replace self, parent and static type arguments in RecursiveTypeReplacer.

Reflection

  • Reflect trait @use PHPDoc in classes without a class-level PHPDoc.

Full Changelog: 0.4.0...0.4.1

0.4.0 New API & components, support for enums, functions and PHPDoc properties and methods

01 Aug 20:22
Compare
Choose a tag to compare

I am extremely happy to announce the new Typhoon version. We've been discussing, deciding, refactoring and rewriting Typhoon for 5 months since 0.3.0. This was a massive effort with many discoveries and insights. Hope, you will like what we've come up with!

Basically everything was rewritten a couple of times, so don't expect any backward compatibility. After all, that's what 0.y versions are for. Starting from this version we will keep a changelog, because we do not expect any massive rewrites in the near future.

Here are some notable changes:

Type

  • TypeStringifier is now part of the type package. Use Typhoon\Type\stringify() function to stringify a type.
  • Desired compatibility with Psalm and PHPStan was achieved. See Typhoon Type documentation article for details.
  • Added not type. non-empty-* types are now expressed as intersection + not.
  • Added float-range type.
  • Refactored the rest of the types. TypeVisitor changed a lot. Hope it will have no breaking changes in 0.5.0.

Reflection

  • Reflection now has it's own API with cool collections. Use toNativeReflection() methods to get native reflection adapters. See Native reflection adapters documentation article for more details.
  • The whole class reflection data is now cached. Cache invalidation takes into account changes in all inherited class-likes.
  • A new TypeKind::Inferred is introduced for getting constant value types. See Reflecting types documentation article for details.
  • PHPDoc properties and methods are now fully supported. See Reflecting PHPDoc properties and methods documentation article for details.
  • Introduced *Reflection::location() method that returns full code location information (lines, columns, positions). Even for type aliases and templates.
  • You can now reflect code from string. Documentation for this is coming, for now use any functional test as an example.
  • Full enum support.
  • Full named functions support. Support for anonymous functions and global constants is coming soon.
  • To use PhpStorm stubs, typhoon/phpstorm-reflection-stubs package should be installed.
  • You can now integrate custom phpDoc types, see Implementing custom types.

New components

  • TypedMap β€” an implementation of heterogeneous type-safe map for PHP. This can be considered as an alternative to Symfony's OptionsResolver. Inspired by broo2s/typedmap for Kotlin. Documentation coming soon.
  • DeclarationId β€” identifiers for constants, functions, classes, properties and methods. Supports anonymous functions and classes. Documentation coming soon.
  • ChangeDetector β€” can be used to detect file, package version and PHP version changes. Useful for cache invalidation. Documentation coming soon.
  • PhpStormReflectionStubs β€” integrates PhpStorm stubs into reflection via locators and hooks. It is automatically used in TyphoonReflector::build() and TyphoonReflector::defaultLocators() if installed.

Abandoned components

Full Changelog: 0.3.3...0.4.0

0.3.3 Merge IntRangeType and IntType

12 Apr 16:36
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.3.2...0.3.3

0.3.2 nikic/php-parser v5, deprecate types::classStringLiteral()

07 Apr 00:34
Compare
Choose a tag to compare

What's Changed

Full Changelog: 0.3.1...0.3.2

0.3.1 Full implementation of *Type methods

10 Mar 10:44
1d548a4
Compare
Choose a tag to compare

Type

  • Deprecated calling types::alias(), types::template() and types::object() with named arguments.
  • Deprecated TypeVisitor::value() and DefaultVisitor::value().

Reflection

  • Implemented getType(), getReturnType(), getTentativeReturnType(), hasTentativeReturnType(), hasReturnType().
  • Deprecated FileResource::changeDetector().
  • Introduced new parameter TyphoonReflector::build($fallbackToNativeReflection = true).
  • Deprecated NativeReflectionFileLocator.
  • Deprecated NativeReflectionLocator.
  • Deprecated returning ReflectionClass from ClassLocator::locateClass().

Full Changelog: 0.3.0...0.3.1

0.3.0 New type system, traits, attributes support

01 Mar 17:45
Compare
Choose a tag to compare
  • New type system.
  • Traits, attributes, class constants support.
  • Native reflection compatibility.