wwwision/types-phpstan

Custom PHPStan rules for wwwision/types

Maintainers

Package info

github.com/bwaidelich/types-phpstan

Type:phpstan-extension

pkg:composer/wwwision/types-phpstan

Fund package maintenance!

bwaidelich

Paypal

Statistics

Installs: 3 738

Dependents: 0

Suggesters: 1

Stars: 0

Open Issues: 0

1.1.0 2026-06-26 11:58 UTC

This package is auto-updated.

Last update: 2026-06-26 11:59:24 UTC


README

Custom PHPStan rules and extensions for the wwwision/types package

What's included

  • Rules that enforce the best practices for #[TypeBased] classes (must be final, readonly, have a private constructor and never be constructed directly).
  • A reflection extension for dynamic schemas: instances of DynamicRecord are read via __get, so PHPStan would normally report $record->someProperty as access to an undefined property. The extension teaches PHPStan that any property of a DynamicRecord is a readable (immutable) mixed value, so object-accessor syntax type-checks. (A dynamic record's shape is only known at runtime, so per-property types cannot be inferred.)

Installation

To use this extension, require it in Composer:

composer require --dev wwwision/types-phpstan

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

Manual installation

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

includes:
    - vendor/wwwision/types-phpstan/rules.neon