$ xp compile -t php:7.0 -a php:virtual-property-types <in> <out>
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Important
The emitter is not enabled by default as a) it does not work with static properties due to a limitation in PHP and b) the generated code is much slower than its native implementation. So instead of a "prune" option (as asked for by @Danon in #119), users will have to explicitely add this command line switch to generate code which behaves the same in all PHP versions.
This pull request makes it possible to emit code for PHP versions < 7.4 which will simulate typed properties as described in https://wiki.php.net/rfc/typed_properties_v2.
Usage
By means of the -e switch on the command line:
Important
The emitter is not enabled by default as a) it does not work with static properties due to a limitation in PHP and b) the generated code is much slower than its native implementation. So instead of a "prune" option (as asked for by @Danon in #119), users will have to explicitely add this command line switch to generate code which behaves the same in all PHP versions.