Download the PHP package kenaths/phpstan-fixer without Composer

On this page you can find all versions of the php package kenaths/phpstan-fixer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpstan-fixer

PHPStan Auto-Fixer

A production-ready, comprehensive tool that automatically fixes PHPStan errors in your PHP code. Now with enhanced type safety, perfect indentation handling, and full PHP 8.4 support! 🚀

Features

✨ Core Capabilities

🔧 Advanced Features

Installation

Install via Composer:

Usage

🚀 Quick Start

Fix PHPStan errors in your source directory:

🎯 Advanced Usage

Smart Mode (recommended for complex projects):

Preview fixes safely without making changes:

Use custom PHPStan configuration:

Fix specific files:

Verbose output for debugging:

Create backup files before making changes:

Increase memory limit for PHPStan:

Programmatic Usage

🆕 Recent Improvements (v2.0)

Enhanced Type Safety & Indentation

We've significantly improved the fixer with production-grade enhancements:

🎯 Perfect Indentation Handling

🔧 Advanced Type Consistency Fixing

🛡️ Production-Ready Safety

🧠 Smart Array Type Inference

Performance & Reliability

Supported Fixes

Core Fixes

  1. Missing Array Value TypesEnhanced - Adds comprehensive array type annotations (array<string, mixed>)
  2. Type Consistency ErrorsNew - Fixes property/method type mismatches with union types
  3. Missing Return Types - Automatically infers and adds return types with union type support
  4. Missing Parameter Types - Adds type declarations to method parameters with proper PHPDoc
  5. Missing Property Types - Adds type declarations to class properties with perfect indentation
  6. Undefined Variables - Initializes undefined variables with appropriate types
  7. Unused Variables - Removes unused variable assignments safely
  8. Strict Comparisons - Converts == to === and != to !==
  9. Null Coalescing - Converts isset() ?: to ?? operator
  10. PHPDoc Fixes - Fixes invalid PHPDoc tags with consistent formatting

PHP 8+ Modern Features

  1. Union Types - Handles string|int and complex union types
  2. Intersection Types - Supports Foo&Bar type declarations
  3. DNF Types - Disjunctive Normal Form types like (A&B)|C
  4. Readonly Properties - Adds readonly modifier and ensures types
  5. Enums - Fixes enum backing types and cases
  6. Constructor Property Promotion - Converts traditional properties to promoted ones
  7. Never Type - Properly handles never return type
  8. Mixed Type - Smart inference of mixed type
  9. Match Expressions - Type inference for match expressions
  10. First-class Callables - Proper handling of callable syntax
  11. Property Hooks - Basic support for property access patterns

Creating Custom Fixers

You can create custom fixers for specific error types:

Configuration

Create a phpstan.neon file in your project root:

Limitations

Not all PHPStan errors can be automatically fixed. Some errors require human intervention to understand the intent of the code. The library will report which errors it couldn't fix.

Common unfixable errors include:

Safety

Contributing

Contributions are welcome! To add support for new error types:

  1. Create a new fixer class extending AbstractFixer
  2. Implement the required methods
  3. Add tests for your fixer
  4. Submit a pull request

License

This library is open-source software licensed under the MIT license.

Tips

  1. Start with lower levels: Begin with level 0 and work your way up
  2. Use version control: Always commit your code before running the fixer
  3. Review changes: Automated fixes may not always match your intent
  4. Combine with CI: Run PHPStan in your CI pipeline after fixing
  5. Custom fixers: Create fixers for your project-specific patterns

Troubleshooting

"PHPStan executable not found"

Make sure PHPStan is installed:

"Autoloader not found"

Run composer install:

Fixes seem incorrect

  1. Check if you're using the correct PHPStan level
  2. Review the specific error message
  3. Consider creating a custom fixer for your use case
  4. Some fixes are generic and may need manual adjustment

Modern PHP Examples

Before Fix

After Fix

Constructor Promotion Example

Example Workflow


All versions of phpstan-fixer with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kenaths/phpstan-fixer contains the following files

Loading the files please wait ...