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

fix 8.2 add AllowDynamicProperties in ForbiddenSetterSniff class #647

Conversation

Enz000
Copy link

@Enz000 Enz000 commented May 30, 2023

Q A
Bug fix? no
New feature? no

Since 8.2, dynamic properties are deprecated.

An error message is displayed when I ran phpinsights on my project.

PHP Deprecated: Creation of dynamic property NunoMaduro\PhpInsights\Domain\Sniffs\ForbiddenSetterSniff::$exclude is deprecated in /Users/enzo/dev/phpinsights/src/Domain/InsightLoader/SniffLoader.php on line 32

The SniffLoader class uses the dynamic properties pattern

   public function load(string $insightClass, string $dir, array $config, Collector $collector): Insight
    {
        /** @var SniffContract $sniff */
        $sniff = new $insightClass();

        foreach ($config as $property => $value) {
            $sniff->{$property} = $value;
        }

        return new SniffDecorator($sniff, $dir);
    }

There's multiple solutions to avoid this depreciation, I'm available to discuss it 😁

@cmgmyr
Copy link
Collaborator

cmgmyr commented Sep 28, 2023

closing in favor of #653. Thank you for the PR!

@cmgmyr cmgmyr closed this Sep 28, 2023
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