Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mteu/docblock-rules
Simple PHPStan rules extension to verify whether the PHP files contain certain pre-defined strings.
https://github.com/mteu/docblock-rules
phpstan phpstan-extension
Last synced: 3 months ago
JSON representation
Simple PHPStan rules extension to verify whether the PHP files contain certain pre-defined strings.
- Host: GitHub
- URL: https://github.com/mteu/docblock-rules
- Owner: mteu
- License: gpl-3.0
- Created: 2023-04-12T12:08:45.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-13T09:13:01.000Z (5 months ago)
- Last Synced: 2024-09-13T22:43:04.632Z (4 months ago)
- Topics: phpstan, phpstan-extension
- Language: PHP
- Homepage:
- Size: 319 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![CGL](https://github.com/mteu/docblock-rules/actions/workflows/cgl.yaml/badge.svg)](https://github.com/mteu/docblock-rules/actions/workflows/cgl.yaml)
[![Tests](https://github.com/mteu/docblock-rules/actions/workflows/tests.yaml/badge.svg)](https://github.com/mteu/docblock-rules/actions/workflows/tests.yaml)# DocBlock Rules
**DocBlock Rules** is simple [PHPStan](https://github.com/phpstan/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.)```bash
composer require --dev mteu/docblock-rules
```If you're using the [`phpstan/extension-installer`](https://github.com/phpstan/extension-installer) you're good to go.
## Configuration
This package ships custom rules that need additional configuration:
* [`RequireCopyrightInformationInFirstCommentRule`](#RequireCopyrightInformationInFirstCommentRule)
* [`RequireLicenseInformationInFirstCommentRule`](#RequireLicenseInformationInFirstCommentRule)### [`RequireCopyrightInformationInFirstCommentRule`](src/Rules/RequireCopyrightInformationInFirstCommentRule.php)
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:
```neon
# phpstan.neonparameters:
docblock:
copyrightIdentifier: 'Copyright (C) 2023'
```### [`RequireLicenseInformationInFirstCommentRule`](src/Rules/RequireLicenseInformationInFirstCommentRule.php)
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:
```neon
# phpstan.neonparameters:
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](https://github.com/phpstan/phpstan). Děkuji, [Ondřej](https://github.com/ondrejmirtes)
and everyone who has contributed!## ⭐ License
This project is licensed under [GNU General Public License 3.0 (or later)](LICENSE).