Download the PHP package filipefernandes/laravel-type-coverage without Composer
On this page you can find all versions of the php package filipefernandes/laravel-type-coverage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-type-coverage
Laravel Type Coverage
Laravel Type Coverage is a package that helps you ensure your codebase has proper type hints and PHPDoc coverage. It analyzes your PHP files for missing type hints and doc comments, generating a report with insights on which functions need improvement.
Features
- Analyze your codebase for functions without PHPDoc and missing type hints.
- Display detailed coverage information with suggestions for improvement.
- Export the results to a JSON file.
- Supports configurable paths and exclusions for scanning.
- Command-line interface for easy integration into your workflow.
Installation
1. Install via Composer
To install the package, run the following command in your Laravel project:
2. Publish Configuration (Optional)
If you want to customize the default configuration for the paths to scan, exclusions, or export options, you can publish the configuration file:
This will create a config/type-coverage.php
file where you can adjust the settings.
Usage
Run the Command
You can run the coverage analysis command with:
This command will scan your project for PHP functions and check if they have both type hints and PHPDoc comments. It will display a report in the terminal, showing the missing type hints and PHPDoc, along with suggested improvements.
Command Options:
--path
: Comma-separated list of paths to scan (e.g.,app,src
). If not provided, it will default toapp
.--fail-under
: Set the minimum coverage percentage required to pass (default:80
).--ignore
: Comma-separated list of paths to ignore.--export
: Export the report to a file (default istrue
).
Example Usage:
Output Example:
When you run the command, you’ll see output like this:
Exporting Results:
By default, the tool will export the results to laravel-type-coverage.json
in your project’s root directory. You can customize the export path in the configuration file.
Example Export:
If you want to specify a custom export path:
Configuration
The configuration file config/type-coverage.php
contains the following options:
paths
: Array of paths to scan (default:['app']
).ignore
: Array of paths to ignore (default:[]
).fail_under
: Minimum coverage percentage required to pass (default:80
).export
: Whether to export the results to a JSON file (default:true
).export_path
: The directory or path to export the coverage report (default: current directory).
Example:
Contributing
Contributions are welcome! If you'd like to contribute to the package, feel free to open a pull request with your changes.
License
This package is open-source software licensed under the MIT License.