how to access property promotion in php8 ?
See original GitHub issuefor example a class like
final class CurrencyFactory
{
private $currencyList;
/**
* @param array<string, mixed> $currencies
*/
public function __construct(private array $currencies)
{
}
}
- parser config
const parser = new PhpParser.Engine({
parser: {
extractDoc: true,
},
ast: {
withPositions: true
}
});
the propertystatement
only have $currencyList
, but how to get $currencies
info aswell?
am not sure if this is a bug or am missing a config option, any help is appreciated.
Issue Analytics
- State:
- Created 9 months ago
- Comments:6
Top Results From Across the Web
PHP 8: Constructor property promotion - Stitcher.io
In short: property promotion allows you to combine class fields, constructor definition and variable assignments all into one syntax, in the ...
Read more >PHP 8.0: Class constructor property promotion
Constructor Property Promotion is a new syntax in PHP 8 that allows class property declaration and constructor assignment right from the constructor.
Read more >Constructor property promotion in PHP 8 - Mindsers Blog
PHP 8 provides a solution to this problem through the promotion of constructor properties. The two examples are identical. But watch how promoted...
Read more >New Features - Manual - PHP
Support for constructor property promotion (declaring properties in the constructor signature) has ... These are the same as %g and %G , but...
Read more >PHP 8: Constructor property promotion - phpGrid
PHP 8 : Constructor property promotion · The Promoted properties can have default value · It's OK to combine promoted and normal properties...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s the
flags
field ofParameter
:https://github.com/glayzzle/php-parser/blob/3ff45606965cffad06931bb10e62e6baffd0de43/types.d.ts#L725-L734
@deakjahn many many thanks for your help & quick response, deeply appreciate it.