cspray/phinal

Enforce final on your classes!

Maintainers

Details

github.com/cspray/phinal

Source

Issues

Installs: 1 146

Dependents: 3

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:psalm-plugin

1.0.0 2022-07-08 19:14 UTC

This package is auto-updated.

Last update: 2022-07-08 19:16:46 UTC


README

Do you like final? Really like it? Then enforce it on all your classes! When you have to fallback to inheritance you can do so by explicitly marking your class with an Attribute and explaining why it should be inherited.

Installation

composer require --dev cspray/phinal
vendor/bin/psalm-plugin enable cspray/phinal

Code Examples

Good! 👍

<?php declare(strict_types=1);

use Cspray\Phinal\AllowInheritance;

final class ProperlyMarkedFinal {}

#[AllowInheritance('Explain why you would need to inherit this.')]
class YouCanInheritThis {}

Bad! 👎

<?php declare(strict_types=1);

class NotMarkedFinal {}

Why do you need to inherit this? You probably don't need to and should mark it final!