Skip to content

Commit 51ab6b6

Browse files
docs: Standardize headings and improve clarity in documentation files. (#52)
1 parent 5a5c6c9 commit 51ab6b6

File tree

6 files changed

+90
-89
lines changed

6 files changed

+90
-89
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Bug #49: Update documentation for `ServiceMap` and related classes to enhance clarity for Yii Application static analysis (@terabytesoftw)
2020
- Bug #50: Add Testing Guide link to `installation` and `examples` documentation (@terabytesoftw)
2121
- Bug #51: Reorder Installation section in `README.md` for improved clarity (@terabytesoftw)
22+
- Bug #52: Standardize headings and improve clarity in documentation files (@terabytesoftw)
2223

2324
## 0.2.3 June 09, 2025
2425

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<p align="center">
1+
<p style="text-align: center;">
22
<a href="https://github.com/yii2-extensions/phpstan" target="_blank">
3-
<img src="https://www.yiiframework.com/image/yii_logo_light.svg" height="100px;">
3+
<img src="https://www.yiiframework.com/image/yii_logo_light.svg" height="100px;" alt="Yii Framework">
44
</a>
5-
<h1 align="center">Extension for PHPStan</h1>
5+
<h1 style="text-align: center;">Extension for PHPStan</h1>
66
</p>
77

8-
<p align="center">
8+
<p style="text-align: center;">
99
<a href="https://www.php.net/releases/8.1/en.php" target="_blank">
1010
<img src="https://img.shields.io/badge/PHP-%3E%3D8.1-787CB5" alt="PHP-Version">
1111
</a>
@@ -63,7 +63,7 @@ inference, dynamic method resolution, and comprehensive property reflection.
6363
composer require --dev yii2-extensions/phpstan
6464
```
6565

66-
## Quick Start
66+
## Quick start
6767

6868
Create a `phpstan.neon` file in your project root.
6969

@@ -110,34 +110,34 @@ Run `PHPStan`.
110110
vendor/bin/phpstan analyse
111111
```
112112

113-
## Type Inference Examples
113+
## Type inference examples
114114

115-
### ActiveRecord
115+
### Active Record
116116

117117
```php
118-
// ✅ Properly typed as User|null
118+
// ✅ Typed as User|null
119119
$user = User::findOne(1);
120120

121-
// ✅ Properly typed as User[]
121+
// ✅ Typed as User[]
122122
$users = User::findAll(['status' => 'active']);
123123

124124
// ✅ Generic ActiveQuery<User> with method chaining
125125
$query = User::find()->where(['active' => 1])->orderBy('name');
126126

127-
// ✅ Array results properly typed as array{id: int, name: string}[]
127+
// ✅ Array results typed as array{id: int, name: string}[]
128128
$userData = User::find()->asArray()->all();
129129

130-
// ✅ Properly typed based on model property annotations string
130+
// ✅ Typed based on model property annotations string
131131
$userName = $user->getAttribute('name');
132132

133133
// ✅ Behavior property resolution string
134134
$slug = $user->getAttribute('slug');
135135
```
136136

137-
### Application Components
137+
### Application components
138138

139139
```php
140-
// ✅ Properly typed based on your configuration
140+
// ✅ Typed based on your configuration
141141
$mailer = Yii::$app->mailer; // MailerInterface
142142
$db = Yii::$app->db; // Connection
143143
$user = Yii::$app->user; // User
@@ -149,7 +149,7 @@ if (Yii::$app->user->isGuest === false) {
149149
}
150150
```
151151

152-
### Dependency Injection
152+
### Dependency injection
153153

154154
```php
155155
$container = new Container();

docs/configuration.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Configuration Reference
1+
# Configuration reference
22

33
## Overview
44

55
This 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
1212
includes:
@@ -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
3030
includes:
@@ -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

7474
For 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

114114
The 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

149149
Define your application components for proper type inference:
150150

@@ -197,7 +197,7 @@ return [
197197
];
198198
```
199199

200-
### Behavior Configuration
200+
### Behavior configuration
201201

202202
Configure 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

222222
For accurate type inference, behaviors should define their properties using PHPDoc.
223223

@@ -239,7 +239,7 @@ use yii\db\ActiveRecord;
239239
class NestedSetsBehavior extends Behavior {}
240240
```
241241

242-
### Container Configuration
242+
### Container configuration
243243

244244
Define 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
284284
includes:
@@ -322,7 +322,7 @@ parameters:
322322
- '#Access to an undefined property.*#'
323323
```
324324

325-
### Performance Optimization
325+
### Performance optimization
326326

327327
```neon
328328
parameters:
@@ -350,15 +350,15 @@ declare(strict_types=1);
350350

351351
error_reporting(-1);
352352

353-
// Define constants without full application bootstrap
353+
// Define constants without a full application bootstrap
354354
defined('YII_DEBUG') or define('YII_DEBUG', true);
355355
defined('YII_ENV') or define('YII_ENV', 'test');
356356

357357
// Load only essential classes
358358
require(dirname(__DIR__) . '/vendor/yiisoft/yii2/Yii.php');
359359
```
360360

361-
## Configuration Without Config File
361+
## Configuration without a config file
362362

363363
If you don't want to create a separate configuration file:
364364

@@ -370,18 +370,18 @@ parameters:
370370

371371
This will work with basic type inference but won't have custom component types.
372372

373-
## Multiple Application Types
373+
## Multiple application types
374374

375375
For projects with both web and console applications:
376376

377-
### Project Structure
377+
### Project structure
378378
```text
379379
phpstan-web.neon # Web-specific configuration
380380
phpstan-console.neon # Console-specific configuration
381381
phpstan.neon # Base configuration
382382
```
383383

384-
### Base Configuration
384+
### Base configuration
385385
```neon
386386
# phpstan.neon
387387
includes:
@@ -393,7 +393,7 @@ parameters:
393393
tmpDir: %currentWorkingDirectory%/tests/runtime
394394
```
395395

396-
### Web Configuration
396+
### Web configuration
397397
```neon
398398
# phpstan-web.neon
399399
includes:
@@ -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
416416
includes:
@@ -434,7 +434,7 @@ vendor/bin/phpstan analyse -c phpstan-web.neon
434434
vendor/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
461461
vendor/bin/phpstan analyse --generate-baseline
462462
```
463463

464-
## Next Steps
464+
## Next steps
465465

466466
- 💡 [Usage Examples](examples.md)

0 commit comments

Comments
 (0)