Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpstan Generic Rules Laravel Package

korbeil/phpstan-generic-rules

PHPStan extension that enforces and improves the use of PHP generics. Adds custom rules to catch missing or incorrect template types, invalid generic usages, and helps keep docblocks and type hints consistent for safer, more accurate static analysis.

View on GitHub
Deep Wiki
Context7

phpstan-generic-rules

Rules list

Debug rules

  • You should not have var_dump, exit or die function calls
  • If you have symfony/var-dumper, you should not have dump or die function calls

MbString rules

  • You should use multibyte string function when it exists

Installation

We assume that PHPStan is already installed in your project.

To use this extension, require it in Composer:

composer require --dev korbeil/phpstan-generic-rules

If you also install phpstan/extension-installer then you're all set!

If you don't want to use phpstan/extension-installer, include phpstan-strict-rules.neon in your project's PHPStan config:

includes:
    - vendor/korbeil/phpstan-generic-rules/extension.neon

Advanced usage

You can configure this library with parameters:

parameters:
    generic_rules:
        never_empty_rule: true # To enable the never empty rule
        debug_rule: false  # To disable the debug rule
        mb_string_rules: false  # To disable the mb_string rule
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor