lib/PublicVisibility.php
private function grabAttribsBeforePropertyToken(Tokens $tokens, $index)
    {
        static $tokenAttribsMap = [
            T_VAR       => null, // destroy T_VAR token!
            T_PRIVATE   => 'visibility',
            T_PROTECTED => 'visibility',
            T_PUBLIC    => 'visibility',
            T_STATIC    => 'static',
        ];

        $result = $this->grabAttribsBeforeToken(
            $tokens,
            $index,
            $tokenAttribsMap,
            [
                'visibility' => new Token([T_PUBLIC, 'public']),
                'static'     => null,
            ]
        );
        if ($result['visibility'] && 'public' === $result['visibility']->getContent()) {
            // If visibility is public and static is set, we remove visibility.
            if ($result['static']) {
                $result['visibility'] = null;
            }
        }
        return $result;
    }
private function grabAttribsBeforePropertyToken(Tokens $tokens, $index)
    {
        static $tokenAttribsMap = [
            T_VAR       => null, // destroy T_VAR token!
            T_PRIVATE   => 'visibility',
            T_PROTECTED => 'visibility',
            T_PUBLIC    => 'visibility',
            T_STATIC    => 'static',
        ];

        $result = $this->grabAttribsBeforeToken(
            $tokens,
            $index,
            $tokenAttribsMap,
            [
                'visibility' => new Token([T_PUBLIC, 'public']),
                'static'     => null,
            ]
        );
        if ($result['visibility'] && 'public' === $result['visibility']->getContent()) {
            // If visibility is public and static is set, we remove visibility.
            if ($result['static']) {
                $result['visibility'] = null;
            }
        }
        return $result;
    }
private function grabAttribsBeforePropertyToken ( Tokens $ tokens , $ index ) { static $ tokenAttribsMap = [ T_VAR => null , // destroy T_VAR token! T_PRIVATE => 'visibility' , T_PROTECTED => 'visibility' , T_PUBLIC => 'visibility' , T_STATIC => 'static' , ] ; $ result = $ this -> grabAttribsBeforeToken ( $ tokens , $ index , $ tokenAttribsMap , [ 'visibility' => new Token ( [ T_PUBLIC , 'public' ] ) , 'static' => null , ] ) ; if ( $ result [ 'visibility' ] && 'public' === $ result [ 'visibility' ] -> getContent ( ) ) { // If visibility is public and static is set, we remove visibility. if ( $ result [ 'static' ] ) { $ result [ 'visibility' ] = null ; } } return $ result ; }
Grab attributes before property token at given index.

It's a shorthand for grabAttribsBeforeToken method.

@param Tokens $tokens Tokens collection
@param int    $index  token index

@return array array of grabbed attributes
Grab attributes before property token at given index .