marek-d-lis/phpstan-symfony-rules

My PHPStan rules for Symfony i like to include in my projects

1.0.2 2025-01-29 10:55 UTC

This package is auto-updated.

Last update: 2025-06-29 02:23:48 UTC


README

Description

This package provides custom PHPStan rules for Symfony projects to enforce better coding practices by preventing the use of debugging and execution-halting functions such as:

  • var_dump()
  • dump()
  • dd()
  • die()
  • exit()

Installation

Require the package via Composer:

composer require --dev marek-d-lis/phpstan-symfony-rules

Configuration

Include the package's rules in your phpstan.neon configuration file:

includes:
  - vendor/marek-d-lis/phpstan-symfony-rules/extension.neon

Rules

1. NoDumpRule

  • Prevents the use of var_dump() and dump().
  • Example violation:
    var_dump($data); // ❌ Not allowed
    dump($data); // ❌ Not allowed

2. NoDieRule

  • Prevents the use of die(), exit(), and dd().
  • Example violation:
    die("Fatal error"); // ❌ Not allowed
    exit(1); // ❌ Not allowed
    dd($data); // ❌ Not allowed

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Marek D. Lis - Website