struggle-for-php/sfp-psalm-dont-operation-inside-constructor-plugin

Dont' operation inside constructor

0.1.0 2023-03-18 13:58 UTC

README

$ ./vendor/bin/psalm
Scanning files...
Analyzing files...

░░░░░░░░░░░░░

ERROR: MethodOperationInsideConstructorIssue - src/app/Controllers/BlogController.php:15:9 - 'SplFileInfo::openfile' not allowed inside __construct()
        $log->openFile('w+');


ERROR: MethodOperationInsideConstructorIssue - src/app/models/Model.php:26:13 - 'PDO::query' not allowed inside __construct()
            $this->pdo->query($query);


------------------------------
2 errors found
------------------------------

Features

Todo

  • support flexible setting xml to mark vendor libraries

Disclaimer

this plugin is very experimental status.

Installation

$ composer require --dev struggle-for-php/sfp-psalm-dont-operation-inside-constructor-plugin:dev-master
$ vendor/bin/psalm-plugin enable struggle-for-php/sfp-psalm-dont-operation-inside-constructor-plugin