PHPackages                             topotru/phpstan-conditional-final - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. topotru/phpstan-conditional-final

ActivePhpstan-extension[Database &amp; ORM](/categories/database)

topotru/phpstan-conditional-final
=================================

Smart final/abstract class enforcement with attributes-based exclusions for PHPStan. Perfect for Doctrine entities.

1.0.1(2mo ago)0230↓25%MITPHP ^8.2

Since May 14Compare

[ Source](https://github.com/topotru/phpstan-conditional-final)[ Packagist](https://packagist.org/packages/topotru/phpstan-conditional-final)[ RSS](/packages/topotru-phpstan-conditional-final/feed)WikiDiscussions Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Conditional Final for PHPStan
=============================

[](#conditional-final-for-phpstan)

Smart `final`/`abstract` class enforcement with attributes-based exclusions for PHPStan.

Installation
------------

[](#installation)

```
composer require --dev topotru/phpstan-conditional-final
```

Usage
-----

[](#usage)

By default, the extension requires all classes to be `final` or `abstract` and has an empty exclusion list.

### Integration with Doctrine ORM

[](#integration-with-doctrine-orm)

If your project uses Doctrine, include the preconfigured preset in your `phpstan.neon`:

```
includes:
    - vendor/topotru/phpstan-conditional-final/doctrine.neon
```

This preset automatically protects `#[Entity]` and `#[MappedSuperclass]` classes from being marked as `final`.

### Custom Configurations

[](#custom-configurations)

You can add any custom proxy or framework attributes to the exclusion list manually:

```
parameters:
    conditionalFinal:
        forbiddenFinalAttributes:
            - App\Attributes\CustomProxy
            - ApiPlatform\Metadata\ApiResource
```

For classes, specified in `forbiddenFinalAttributes`, an **error will be issued** if they are finalized.

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance86

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

71d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6192218?v=4)[topotru](/maintainers/topotru)[@topotru](https://github.com/topotru)

---

Tags

PHPStanstatic analysisdoctrinearchitecturefinal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/topotru-phpstan-conditional-final/health.svg)

```
[![Health](https://phpackages.com/badges/topotru-phpstan-conditional-final/health.svg)](https://phpackages.com/packages/topotru-phpstan-conditional-final)
```

###  Alternatives

[rector/rector

Instant Upgrade and Automated Refactoring of any PHP code

10.4k139.2M10.1k](/packages/rector-rector)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M9.2k](/packages/larastan-larastan)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

79475.7M2.3k](/packages/phpstan-phpstan-symfony)[shipmonk/dead-code-detector

Dead code detector to find unused PHP code via PHPStan extension. Can automatically remove dead PHP code. Supports libraries like Symfony, Doctrine, PHPUnit etc. Detects dead cycles. Can detect dead code that is tested.

4853.5M98](/packages/shipmonk-dead-code-detector)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

67372.8M1.5k](/packages/phpstan-phpstan-doctrine)[weirdan/doctrine-psalm-plugin

Stubs to let Psalm understand Doctrine better

897.3M59](/packages/weirdan-doctrine-psalm-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
