Skip to content

6.0.0

Latest
Compare
Choose a tag to compare
@jaapio jaapio released this 23 May 19:56
· 96 commits to 6.x since this release
61e2f1f

6.0.0

In this version we added support for Attributes and improved the way this project can be extended using Reducers. Added support for php 8.3 features and upgraded to version 5 of phpparser.

Attributes

In PHP8 attributes were added to the language. Attributes are great at runtime but kinda hurdle to take in reflection of the code base as we do not load any classes into our runtime. We are just processing your code as it was plain text. This means that attribute classes are not available as classes, but also a lot of information is gone that you would normally have when loading attributes.

In this version we added a way to support reflection of attributes describing the format of the defined attributes and their call parameters. CallParameters have an optional name if named parameters are used in the usage of an attribute. This should give our users enough information to get everything out. More features will be added in the future.

Reducers

During the development of the project we noticed that we were handling similar constructs over and over again. But as we wanted to keep the factories creating the elements decouples we were not able to reuse code. The new concept of Reducer solves this issue. Reducers are post creation strategies that are executed after the factory created an element. Attributes are a good example of extra data that can be added to any kind of code element, the creation of attributes is always the same. Each factory can have a number of reducers and they can be defined per factory.

Removed deprecation

In php 8.2 dynamic properties were deprecated as this project was using dynamic properties to add extra information to the phpparser nodes we needed to change that functionality. The foundation for this change including a forward compatibility option were added in v5.3 and with this new release the deprecation is removed. From now on FQSEN of nodes is only available as a node attribute. If your code contains custom factories replace the the usage of $object->fqsen with $object->getAttribute('fqsen')

phpparser v5

We switched internally to phpparser v5 to ensure this project will keep working with the latest features in php. For normal usecases there won't be any difference. phpparser is still able to process old code back to php 5. But it is no longer possible to switch the parser version when using this project.

Full Changelog: 5.3.3...6.0.0