PHP code example of struggle-for-php / sfp-psalm-dont-operation-inside-constructor-plugin

1. Go to this page and download the library: Download struggle-for-php/sfp-psalm-dont-operation-inside-constructor-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

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


$ ./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
------------------------------

$ composer in/psalm-plugin enable struggle-for-php/sfp-psalm-dont-operation-inside-constructor-plugin