src/ReflectionEngine.php
public static function parseFile($fileName, $fileContent = null)
    {
        $fileName = PathResolver::realpath($fileName);
        if (isset(self::$parsedFiles[$fileName]) && !isset($fileContent)) {
            return self::$parsedFiles[$fileName];
        }

        if (isset(self::$maximumCachedFiles) && (count(self::$parsedFiles) === self::$maximumCachedFiles)) {
            array_shift(self::$parsedFiles);
        }

        if (!isset($fileContent)) {
            $fileContent = file_get_contents($fileName);
        }
        $treeNode = self::$parser->parse($fileContent);
        $treeNode = self::$traverser->traverse($treeNode);

        self::$parsedFiles[$fileName] = $treeNode;

        return $treeNode;
    }
public static function parseFile($fileName, $fileContent = null)
    {
        $fileName = PathResolver::realpath($fileName);
        if (isset(self::$parsedFiles[$fileName]) && !isset($fileContent)) {
            return self::$parsedFiles[$fileName];
        }

        if (isset(self::$maximumCachedFiles) && (count(self::$parsedFiles) === self::$maximumCachedFiles)) {
            array_shift(self::$parsedFiles);
        }

        if (!isset($fileContent)) {
            $fileContent = file_get_contents($fileName);
        }
        $treeNode = self::$parser->parse($fileContent);
        $treeNode = self::$traverser->traverse($treeNode);

        self::$parsedFiles[$fileName] = $treeNode;

        return $treeNode;
    }
public static function parseFile ( $ fileName , $ fileContent = null ) { $ fileName = PathResolver :: realpath ( $ fileName ) ; if ( isset ( self :: $ parsedFiles [ $ fileName ] ) && ! isset ( $ fileContent ) ) { return self :: $ parsedFiles [ $ fileName ] ; } if ( isset ( self :: $ maximumCachedFiles ) && ( count ( self :: $ parsedFiles ) === self :: $ maximumCachedFiles ) ) { array_shift ( self :: $ parsedFiles ) ; } if ( ! isset ( $ fileContent ) ) { $ fileContent = file_get_contents ( $ fileName ) ; } $ treeNode = self :: $ parser -> parse ( $ fileContent ) ; $ treeNode = self :: $ traverser -> traverse ( $ treeNode ) ; self :: $ parsedFiles [ $ fileName ] = $ treeNode ; return $ treeNode ; }
Parses a file and returns an AST for it

@param string      $fileName Name of the file
@param string|null $fileContent Optional content of the file

@return \PhpParser\Node[]
Parses a file and returns an AST for it