Download the PHP package yii2-extensions/phpstan without Composer
On this page you can find all versions of the php package yii2-extensions/phpstan. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yii2-extensions/phpstan
More information about yii2-extensions/phpstan
Files in yii2-extensions/phpstan
Package phpstan
Short Description PHPStan extension for Yii2
License BSD-3-Clause
Informations about the package phpstan
Extension for PHPStan
A comprehensive PHPStan extension that provides enhanced static analysis for Yii2 applications with precise type inference, dynamic method resolution, and comprehensive property reflection.
Features
✅ ActiveRecord & ActiveQuery Analysis
- Array/object result type inference based on
asArray()
usage. - Dynamic return type inference for
find()
,findOne()
,findAll()
methods. - Generic type support for
ActiveQuery<Model>
with proper chaining. - Hierarchical type resolution: model properties take precedence over behavior properties.
- Precise type inference for
getAttribute()
method calls based on PHPDoc annotations. - Property type resolution from both model classes and attached behaviors.
- Relation methods (
hasOne()
,hasMany()
) with accurate return types. - Support for behavior property definitions through ServiceMap integration.
✅ Application Component Resolution
- Automatic type inference for
Yii::$app->component
access. - Behavior property and method reflection.
- Generic component support with configurable type parameters.
- Non-destructive generic configuration - extend without overriding defaults.
- Support for custom component configurations.
- User component with
identity
,id
,isGuest
property types.
✅ Dependency Injection Container
- Service map integration for custom services.
- Support for closures, singletons, and nested definitions.
- Type-safe
Container::get()
method resolution.
✅ Framework Integration
- Header collection dynamic method types.
- Stub files for different application types (web, console, base).
- Support for Yii2 constants (
YII_DEBUG
,YII_ENV_*
).
✅ Service Locator Component Resolution
- Automatic fallback to mixed type for unknown component identifiers.
- Dynamic return type inference for
ServiceLocator::get()
calls. - Priority-based resolution: ServiceMap components > ServiceMap services > Real classes > Mixed type.
- Support for all Service Locator subclasses (Application, Module, custom classes).
- Type inference with string variables and class name constants.
Quick start
Installation
Create a phpstan.neon
file in your project root.
Create a PHPStan-specific config file (config/phpstan-config.php
).
Run PHPStan
.
Type inference examples
Active Record
Application components
Dependency injection
Service locator
Documentation
For detailed configuration options and advanced usage.
- 📚 Installation Guide
- ⚙️ Configuration Reference
- 💡 Usage Examples
- 🧪 Testing Guide
Quality code
Our social networks
License
Fork
This package is a fork of proget-hq/phpstan-yii2 with some corrections.
All versions of phpstan with dependencies
nikic/php-parser Version ^4.1|^5.4.0
phpstan/phpstan Version ^2.1
yiisoft/yii2 Version ^2.0.53|^22