struggle-for-php / sfp-psalm-dont-operation-inside-constructor-plugin
Dont' operation inside constructor
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 3
Type:psalm-plugin
Requires
- php: ^7.4.7|^8
- ext-simplexml: *
- nikic/php-parser: ^4.10
- struggle-for-php/resource-operations: ^4.0
- vimeo/psalm: ^4.8
Requires (Dev)
- doctrine/coding-standard: ^9.0
- infection/infection: ^0.22.1
- phpunit/phpunit: ^9|^10
- slevomat/coding-standard: ^7.0
- squizlabs/php_codesniffer: ^3.3
This package is auto-updated.
Last update: 2023-01-30 05:02:09 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
- check operation resources
- resource operation function list is provided by struggle-for-php/resource-operations
- fork of sebastianbergmann/resource-operations
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