"Maximum execution time of 30 seconds exceeded" in hasEvenNumberOfParentheses Function (NEW)

Good day everyone!

I would like to address this issue in Laravel Filament Project, and I hope someone will fix this issue. It seems like this happens to me when I have a RelationManager in my specific Filament Resource inside whenever I open one item. Can someone help me please?

protected static function hasEvenNumberOfParentheses(string $expression)

    {

        $tokens = token_get_all('<?php '.$expression);



        if (Arr::last($tokens) !== ')') {

            return false;

        }



        $opening = 0;

        $closing = 0;



        foreach ($tokens as $token) {

            if ($token == ')') {

                $closing++;

            } elseif ($token == '(') {

                $opening++;

            }

        }



        return $opening === $closing;

    }


Any suggestion would be appreciated. Thank you!
Was this page helpful?