1- # Configuration Reference
1+ # Configuration reference
22
33## Overview
44
55This guide covers all configuration options for the Yii2 PHPStan extension, from basic setup to advanced scenarios.
66
7- ## Basic Configuration
7+ ## Basic configuration
88
9- ### Minimal Setup
9+ ### Minimal setup
1010
1111``` neon
1212includes:
@@ -24,7 +24,7 @@ parameters:
2424 config_path: config/phpstan-config.php
2525```
2626
27- ### Standard Web Application
27+ ### Standard web application
2828
2929``` neon
3030includes:
@@ -54,9 +54,9 @@ parameters:
5454 config_path: config/phpstan-config.php
5555```
5656
57- ## Application Type Configuration
57+ ## Application type configuration
5858
59- ### Web Application (Default )
59+ ### Web application (default )
6060
6161``` php
6262<?php
@@ -69,7 +69,7 @@ return [
6969];
7070```
7171
72- ### Console Application
72+ ### Console application
7373
7474For console applications, you ** must** explicitly specify the application type.
7575
@@ -107,9 +107,9 @@ parameters:
107107 config_path: config/phpstan-console-config.php
108108```
109109
110- ## Dynamic Constants Configuration
110+ ## Dynamic constants configuration
111111
112- ### Default Constants
112+ ### Default constants
113113
114114The extension automatically recognizes these Yii2 constants:
115115
@@ -123,7 +123,7 @@ parameters:
123123 - YII_ENV_TEST
124124```
125125
126- ### Adding Custom Constants
126+ ### Adding custom constants
127127
128128⚠️ ** Important** : When you define ` dynamicConstantNames ` , it ** replaces** the defaults. Include Yii2 constants explicitly.
129129
@@ -142,9 +142,9 @@ parameters:
142142 - FEATURE_FLAGS
143143```
144144
145- ## Service Map Configuration
145+ ## Service map configuration
146146
147- ### Component Configuration
147+ ### Component configuration
148148
149149Define your application components for proper type inference:
150150
@@ -197,7 +197,7 @@ return [
197197];
198198```
199199
200- ### Behavior Configuration
200+ ### Behavior configuration
201201
202202Configure behaviors for proper method and property reflection.
203203
@@ -217,7 +217,7 @@ return [
217217];
218218```
219219
220- ### Behavior PHPDoc Requirements
220+ ### Behavior PHPDoc requirements
221221
222222For accurate type inference, behaviors should define their properties using PHPDoc.
223223
@@ -239,7 +239,7 @@ use yii\db\ActiveRecord;
239239class NestedSetsBehavior extends Behavior {}
240240```
241241
242- ### Container Configuration
242+ ### Container configuration
243243
244244Define DI container services.
245245
@@ -276,9 +276,9 @@ return [
276276];
277277```
278278
279- ## Advanced Configuration
279+ ## Advanced configuration
280280
281- ### Strict Analysis Setup
281+ ### Strict analysis setup
282282
283283``` neon
284284includes:
@@ -322,7 +322,7 @@ parameters:
322322 - '#Access to an undefined property.*#'
323323```
324324
325- ### Performance Optimization
325+ ### Performance optimization
326326
327327``` neon
328328parameters:
@@ -350,15 +350,15 @@ declare(strict_types=1);
350350
351351error_reporting(-1);
352352
353- // Define constants without full application bootstrap
353+ // Define constants without a full application bootstrap
354354defined('YII_DEBUG') or define('YII_DEBUG', true);
355355defined('YII_ENV') or define('YII_ENV', 'test');
356356
357357// Load only essential classes
358358require(dirname(__DIR__) . '/vendor/yiisoft/yii2/Yii.php');
359359```
360360
361- ## Configuration Without Config File
361+ ## Configuration without a config file
362362
363363If you don't want to create a separate configuration file:
364364
@@ -370,18 +370,18 @@ parameters:
370370
371371This will work with basic type inference but won't have custom component types.
372372
373- ## Multiple Application Types
373+ ## Multiple application types
374374
375375For projects with both web and console applications:
376376
377- ### Project Structure
377+ ### Project structure
378378``` text
379379phpstan-web.neon # Web-specific configuration
380380phpstan-console.neon # Console-specific configuration
381381phpstan.neon # Base configuration
382382```
383383
384- ### Base Configuration
384+ ### Base configuration
385385``` neon
386386# phpstan.neon
387387includes:
@@ -393,7 +393,7 @@ parameters:
393393 tmpDir: %currentWorkingDirectory%/tests/runtime
394394```
395395
396- ### Web Configuration
396+ ### Web configuration
397397``` neon
398398# phpstan-web.neon
399399includes:
@@ -410,7 +410,7 @@ parameters:
410410 config_path: config/phpstan-config.php
411411```
412412
413- ### Console Configuration
413+ ### Console configuration
414414``` neon
415415# phpstan-console.neon
416416includes:
@@ -434,7 +434,7 @@ vendor/bin/phpstan analyse -c phpstan-web.neon
434434vendor/bin/phpstan analyse -c phpstan-console.neon
435435```
436436
437- ### File-Level Suppression
437+ ### File-Level suppression
438438
439439``` php
440440<?php
@@ -461,6 +461,6 @@ vendor/bin/phpstan analyse -v
461461vendor/bin/phpstan analyse --generate-baseline
462462```
463463
464- ## Next Steps
464+ ## Next steps
465465
466466- 💡 [ Usage Examples] ( examples.md )
0 commit comments