Skip to content

Conversation

@thekid
Copy link
Member

@thekid thekid commented Apr 7, 2023

See https://wiki.php.net/rfc/dynamic_class_constant_fetch and php/php-src#9793

  • Instance properties: $this->$member, $this->{$member}
  • Static properties: self::${$member}
  • Instance methods: $this->$method(), $this->{$method}()
  • Static methods: self::$method(), self::{$method}()
  • Constants: self::{$member}

This pull request also fixes support for dynamic static properties.

@thekid
Copy link
Member Author

thekid commented Apr 8, 2023

Tests are failing because of version constraint conflict for xp-framework/ast: The test library wants ^9.x, we're using the development branch feature/expressions as version 10.0.0

For the time being, we can use as 9.99.0, but when xp-framework/ast#44 is merged, we'll have to release xp-framework/test with an updated constraint before releasing xp-framework/compiler!

@thekid
Copy link
Member Author

thekid commented Apr 8, 2023

Performance and memory figures indicate no significant change:

Before

Test cases:  917 succeeded, 4 skipped
Memory used: 11181.34 kB (11235.46 kB peak)
Time taken:  0.262 seconds (0.760 seconds overall)

After

Test cases:  933 succeeded, 4 skipped
Memory used: 11413.18 kB (11467.31 kB peak)
Time taken:  0.251 seconds (0.720 seconds overall)

@thekid
Copy link
Member Author

thekid commented Apr 8, 2023

Added to https://github.com/xp-framework/compiler/wiki/Implementation-status. This is the first PHP 8.3 feature to go into the compiler although PHP 8.3 is still quite a while away at the time of writing.

@thekid thekid merged commit 236e67c into master Apr 8, 2023
@thekid thekid deleted the feature/dynamic-class-constants branch April 8, 2023 17:21
@thekid
Copy link
Member Author

thekid commented Apr 8, 2023

@thekid
Copy link
Member Author

thekid commented Apr 8, 2023

The typical upgrade process will show:

  • Upgrading xp-framework/ast (v9.2.7 => v10.0.0): Extracting archive
  • Upgrading xp-framework/compiler (v8.9.0 => v8.10.0): Extracting archive
  • Upgrading xp-framework/reflection (v2.9.1 => v2.10.0): Extracting archive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants