Php-parser: public always true

Created on 20 Feb 2018  路  9Comments  路  Source: glayzzle/php-parser

Input:

class MyClass
{
    function myFunction() 
    {
        // Nothing
    }
}

function always interpreted as public. Maybe we can add hiddenVisibility: true (maybe best name)?

Based https://github.com/prettier/plugin-php/issues/72

enhancement AST

Most helpful comment

I will work on php-parser bug this week, and I'll release it under 3.0.0-alpha

All 9 comments

I'm agree with you, initially the AST was made to act as the PHP engine acts, so the public visibility is implicit.

Yes, I could disable https://github.com/glayzzle/php-parser/blob/master/src/parser/class.js#L248 so when not public keyword is used, the visibility flag could be -1.

I could release it as a breaking change, v3

@ichiriac will be great :+1:

@evilebottnawi, now the visibility property is empty when the keyword is not defined.

@ichiriac thanks!

@ichiriac it is work for const public const OTHER_CONST = 'value'; ?

@evilebottnawi yes, the visibilty should be node.visibility = "public" in this case

@ichiriac can you release patch with this changes?

I will work on php-parser bug this week, and I'll release it under 3.0.0-alpha

@ichiriac Awesome :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexander-akait picture alexander-akait  路  7Comments

alexander-akait picture alexander-akait  路  3Comments

alexander-akait picture alexander-akait  路  3Comments

alexander-akait picture alexander-akait  路  5Comments

alexander-akait picture alexander-akait  路  8Comments