mteu / docblock-rules
A few additional rules for PHPStan
Installs: 11 588
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 3
Type:phpstan-extension
Requires
- php: ~8.1 || ~8.2 || ~8.3
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.10
Requires (Dev)
- armin/editorconfig-cli: ^1.8 || ^2.0
- ergebnis/composer-normalize: ^2.41
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2024-11-17 19:27:45 UTC
README
DocBlock Rules
DocBlock Rules is simple PHPStan rules extension to verify whether the PHP files contain certain pre-defined strings.
⚡ Usage
Require this package and make sure to configure PHPStan according to your needs by putting a configuration file in your project
(e.g. as phpstan.neon
file in your package root.)
composer require --dev mteu/docblock-rules
If you're using the phpstan/extension-installer
you're good to go.
Configuration
This package ships custom rules that need additional configuration:
RequireCopyrightInformationInFirstCommentRule
This rule checks whether there is a PHPDoc comment block present that contains copyright information identified by a needle string in the PHPStan configuration.
Sample configuration:
# phpstan.neon parameters: docblock: copyrightIdentifier: 'Copyright (C) 2023'
RequireLicenseInformationInFirstCommentRule
This rule checks whether there is a PHPDoc comment block present that contains license information. You can use pre-defined license checks values or define a custom string that is being looked for.
Sample configuration:
# phpstan.neon parameters: docblock: # Pre-configured checks when applying 'GPL-2.0' or 'GPL-3.0' as value. # Alternatively, use a custom string to look for in the file. requiredLicenseIdentifier: 'GPL-3.0'
💛 Acknowledgement
I'm very grateful for the good people that created, maintain and sponsor PHPStan. Děkuji, Ondřej and everyone who has contributed!
⭐ License
This project is licensed under GNU General Public License 3.0 (or later).