Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update phpstan action #7522

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Update phpstan action #7522

merged 3 commits into from
Nov 29, 2023

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 27, 2023

Description:

removes dependency to external action

Review

@sgiehl sgiehl marked this pull request as ready for review November 27, 2023 13:02
@sgiehl sgiehl requested a review from sanchezzzhak November 27, 2023 13:02
@@ -244,14 +244,24 @@ public function getYamlParser(): YamlParser
protected function getRegexes(): array
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything criminal here.
The only thing I would do is less nested conditions.

    protected function getRegexes(): array
    {
        if (!empty($this->regexList)){
            return $this->regexList;
        }

        $cacheKey     = 'DeviceDetector-' . DeviceDetector::VERSION . 'regexes-' . $this->getName();
        $cacheKey     = (string) \preg_replace('/([^a-z0-9_-]+)/i', '', $cacheKey);
        $cacheContent = $this->getCache()->fetch($cacheKey);

        if (\is_array($cacheContent)) {
            $this->regexList = $cacheContent;
        }

        if (empty($this->regexList)) {
            $parsedContent = $this->getYamlParser()->parseFile(
                $this->getRegexesDirectory() . DIRECTORY_SEPARATOR . $this->fixtureFile
            );

            if (!\is_array($parsedContent)) {
                $parsedContent = [];
            }

            $this->regexList = $parsedContent;
            $this->getCache()->save($cacheKey, $this->regexList);
        }

        return $this->regexList;
    }

@sgiehl sgiehl merged commit 11b8935 into master Nov 29, 2023
15 checks passed
@sgiehl sgiehl deleted the phpstan branch November 29, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants