Releases: typhoon-php/typhoon
0.4.4 Bugfixes, Parameter::with(), ShapeElement::with()
Type
Added
- Add
Parameter::with(). - Add
ShapeElement::with().
Changed
- Make
ShapeElement::__construct($type)optional withtypes::mixedas 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
What's Changed
Type
- Add
types::value()factory that creates aTypefrom an arbitrary value.
Reflection
- Add
ConstantReflectionandTyphoonReflector::reflectConstant().
TypedMap
- Make
TypedMapimplement\Countable.
ChangeDetector
- Add
ConstantChangeDetector.
PhpStormReflectionStubs
- Do not locate defined constants via
PhpStormStubsLocator. Reflecting defined constants from value is less
error-prone.
New Contributors
- @kafkiansky made their first contribution in #75
Full Changelog: 0.4.2...0.4.3
0.4.2 Emphasize the risk of runtime errors in Reflection methods
Type
- Drop needless
$typeparameter PHPDoc types inTypeVisitor. - Return
Type<int>intypes::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
Type
- Replace self, parent and static type arguments in RecursiveTypeReplacer.
Reflection
- Reflect trait
@usePHPDoc 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
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
TypeStringifieris now part of thetypepackage. UseTyphoon\Type\stringify()function to stringify a type.- Desired compatibility with Psalm and PHPStan was achieved. See Typhoon Type documentation article for details.
- Added
nottype.non-empty-*types are now expressed as intersection + not. - Added
float-rangetype. - Refactored the rest of the types.
TypeVisitorchanged 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::Inferredis 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-stubspackage 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()andTyphoonReflector::defaultLocators()if installed.
Abandoned components
typhoon/type-stringifieris now abandoned, useTyphoon\Type\stringify()instead.
Full Changelog: 0.3.3...0.4.0
0.3.3 Merge IntRangeType and IntType
What's Changed
- Merge IntRangeType and IntType by @vudaltsov in #34
- Use composer-require-checker instead of Deptrac by @vudaltsov in #35
Full Changelog: 0.3.2...0.3.3
0.3.2 nikic/php-parser v5, deprecate types::classStringLiteral()
What's Changed
- Deprecate
types::classStringLiteral()by @vudaltsov in #25 - Support nikic/php-parser v5
Full Changelog: 0.3.1...0.3.2
0.3.1 Full implementation of *Type methods
Type
- Deprecated calling
types::alias(),types::template()andtypes::object()with named arguments. - Deprecated
TypeVisitor::value()andDefaultVisitor::value().
Reflection
- Implemented
getType(),getReturnType(),getTentativeReturnType(),hasTentativeReturnType(),hasReturnType(). - Deprecated
FileResource::changeDetector(). - Introduced new parameter
TyphoonReflector::build($fallbackToNativeReflection = true). - Deprecated
NativeReflectionFileLocator. - Deprecated
NativeReflectionLocator. - Deprecated returning
ReflectionClassfromClassLocator::locateClass().
Full Changelog: 0.3.0...0.3.1
0.3.0 New type system, traits, attributes support
- New type system.
- Traits, attributes, class constants support.
- Native reflection compatibility.