src/Viserio/Component/Translation/Extractor/PhpExtractor.php
public function extract($resource): array
    {
        if (! \is_string($resource) && ! \is_array($resource)) {
            throw new InvalidArgumentException(\sprintf(
                'The resource parameter must be of type string or array, [%s] given.',
                \is_object($resource) ? \get_class($resource) : \gettype($resource)
            ));
        }

        $messages = [];
        $files    = $this->extractFiles($resource);

        foreach ($files as $file) {
            $tokens   = \token_get_all(\file_get_contents($file));
            $messages = \array_merge($messages, $this->parseTokens($tokens));

            // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
            \gc_mem_caches();
        }

        return $messages;
    }
public function extract($resource): array
    {
        if (! \is_string($resource) && ! \is_array($resource)) {
            throw new InvalidArgumentException(\sprintf(
                'The resource parameter must be of type string or array, [%s] given.',
                \is_object($resource) ? \get_class($resource) : \gettype($resource)
            ));
        }

        $messages = [];
        $files    = $this->extractFiles($resource);

        foreach ($files as $file) {
            $tokens   = \token_get_all(\file_get_contents($file));
            $messages = \array_merge($messages, $this->parseTokens($tokens));

            // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
            \gc_mem_caches();
        }

        return $messages;
    }
{@inheritdoc}