Skip to content

Commit fea324e

Browse files
refactor: Update documentation for ServiceMap and related classes to enhance clarity for Yii Application static analysis. (#49)
1 parent 9edac44 commit fea324e

17 files changed

+72
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- Bug #46: Update `README.md` to enhance clarity and structure of `docs/installation.md`, `docs/configuration.md` and `docs/examples.md` (@terabytesoftw)
1717
- Enh #47: Add `ActiveRecordGetAttributeDynamicMethodReturnTypeExtension` to provide precise type inference for `getAttribute()` method calls based on PHPDoc annotations (@terabytesoftw)
1818
- Bug #48: Update `PHPStan` configuration paths and create new config files for improved structure and clarity (@terabytesoftw)
19+
- Bug #49: Update documentation for `ServiceMap` and related classes to enhance clarity for Yii Application static analysis (@terabytesoftw)
1920

2021
## 0.2.3 June 09, 2025
2122

src/StubFilesExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* - Resolves stub file paths relative to the extension directory.
2727
* - Supports web, console, and base application contexts.
2828
*
29-
* @see ServiceMap for component/service class resolution.
29+
* @see ServiceMap for service and component map for Yii Application static analysis.
3030
*
3131
* @copyright Copyright (C) 2023 Terabytesoftw.
3232
* @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
@@ -42,7 +42,7 @@ final class StubFilesExtension implements \PHPStan\PhpDoc\StubFilesExtension
4242
private const DEFAULT_STUB = 'ApplicationWeb.stub';
4343

4444
/**
45-
* @param ServiceMap $serviceMap Service map for determining an application type
45+
* @param ServiceMap $serviceMap Service and component map for Yii Application static analysis.
4646
*/
4747
public function __construct(private readonly ServiceMap $serviceMap) {}
4848

src/method/BehaviorMethodsClassReflectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class BehaviorMethodsClassReflectionExtension implements MethodsClassRefle
4141
* Creates a new instance of the {@see BehaviorMethodsClassReflectionExtension} class.
4242
*
4343
* @param ReflectionProvider $reflectionProvider Reflection provider for class and property lookups.
44-
* @param ServiceMap $serviceMap Service map for resolving component classes by ID.
44+
* @param ServiceMap $serviceMap Service and component map for Yii Application static analysis.
4545
*/
4646
public function __construct(
4747
private readonly ReflectionProvider $reflectionProvider,

src/property/ApplicationPropertiesClassReflectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ final class ApplicationPropertiesClassReflectionExtension implements PropertiesC
7575
* @param AnnotationsPropertiesClassReflectionExtension $annotationsProperties Extension for handling
7676
* annotation-based properties.
7777
* @param ReflectionProvider $reflectionProvider Reflection provider for class and property lookups.
78-
* @param ServiceMap $serviceMap Service map for resolving component classes by ID.
78+
* @param ServiceMap $serviceMap Service and component map for Yii Application static analysis.
7979
*/
8080
public function __construct(
8181
private readonly AnnotationsPropertiesClassReflectionExtension $annotationsProperties,

src/property/BehaviorPropertiesClassReflectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final class BehaviorPropertiesClassReflectionExtension implements PropertiesClas
4545
* @param AnnotationsPropertiesClassReflectionExtension $annotationsProperties Extension for handling
4646
* annotation-based properties.
4747
* @param ReflectionProvider $reflectionProvider Reflection provider for class and property lookups.
48-
* @param ServiceMap $serviceMap Service map for resolving component classes by ID.
48+
* @param ServiceMap $serviceMap Service and component map for Yii Application static analysis.
4949
*/
5050
public function __construct(
5151
private readonly AnnotationsPropertiesClassReflectionExtension $annotationsProperties,

src/property/UserPropertiesClassReflectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ final class UserPropertiesClassReflectionExtension implements PropertiesClassRef
5555
* @param AnnotationsPropertiesClassReflectionExtension $annotationsProperties Extension for handling
5656
* annotation-based properties.
5757
* @param ReflectionProvider $reflectionProvider Reflection provider for class and property lookups.
58-
* @param ServiceMap $serviceMap Service map for resolving component classes by ID.
58+
* @param ServiceMap $serviceMap Service and component map for Yii Application static analysis.
5959
*/
6060
public function __construct(
6161
private readonly AnnotationsPropertiesClassReflectionExtension $annotationsProperties,

src/type/ActiveQueryDynamicMethodReturnTypeExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* - Integration with PHPStan type combinators and file type mapper for accurate analysis.
4949
* - Support for union, array, and generic object types in method return values.
5050
*
51-
* @see ActiveQuery for query API details.
51+
* @see ActiveQuery for Active Query API details.
5252
* @see DynamicMethodReturnTypeExtension for PHPStan dynamic return type extension contract.
5353
*
5454
* @copyright Copyright (C) 2023 Terabytesoftw.
@@ -107,7 +107,7 @@ public function getClass(): string
107107
* - For {@see ActiveQuery::one()}: a union of the model type and null.
108108
* - For other methods: the result of {@see handleDefaultCase()}.
109109
*
110-
* @param MethodReflection $methodReflection Reflection for the called method.
110+
* @param MethodReflection $methodReflection Reflection instance for the method being analyzed.
111111
* @param MethodCall $methodCall AST node for the method call expression.
112112
* @param Scope $scope PHPStan analysis scope for type resolution.
113113
*
@@ -383,7 +383,7 @@ private function getArrayTypeFromModelProperties(Type $modelType): Type
383383
* This method is used internally by the dynamic return type extension to support accurate type inference for
384384
* {@see ActiveQuery::asArray()} calls during static analysis.
385385
*
386-
* @param MethodCall $methodCall AST node for the {@see asArray()} method call.
386+
* @param MethodCall $methodCall AST node for the method call expression.
387387
* @param Scope $scope PHPStan analysis scope for type resolution.
388388
*
389389
* @return Type Type of the first argument if present, or {@see ConstantBooleanType} `true` if not provided.
@@ -413,7 +413,7 @@ private function getAsArrayArgument(MethodCall $methodCall, Scope $scope): Type
413413
* This method enables precise type inference for chained {@see asArray()} calls, ensuring that the correct type is
414414
* propagated for subsequent method calls on the {@see ActiveQuery} instance during static analysis.
415415
*
416-
* @param MethodCall $methodCall AST node for the {@see asArray()} method call.
416+
* @param MethodCall $methodCall AST node for the method call expression.
417417
* @param Scope $scope PHPStan analysis scope for type resolution.
418418
* @param Type $modelType Model type extracted from the generic {@see ActiveQuery} instance.
419419
*
@@ -450,7 +450,7 @@ private function handleAsArray(MethodCall $methodCall, Scope $scope, Type $model
450450
* This ensures that fluent interface methods maintain correct generic type propagation for static analysis and IDE
451451
* support.
452452
*
453-
* @param MethodReflection $methodReflection Reflection for the called method.
453+
* @param MethodReflection $methodReflection Reflection instance for the method being analyzed.
454454
* @param Type $calledOnType Type on which the method is called.
455455
* @param Type $modelType Model type extracted from the generic {@see ActiveQuery} instance.
456456
*

src/type/ActiveRecordDynamicMethodReturnTypeExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
* - Exception handling for invalid or missing arguments in relation method calls.
3737
* - Returns a generic {@see ActiveQuery} type with the related model class as type parameter.
3838
*
39-
* @see ActiveQuery for query API details.
40-
* @see ActiveRecord for relation method definitions.
39+
* @see ActiveQuery for Active Query API details.
40+
* @see ActiveRecord for Active Record API details.
4141
* @see DynamicMethodReturnTypeExtension for PHPStan dynamic return type extension contract.
4242
*
4343
* @copyright Copyright (C) 2023 Terabytesoftw.
@@ -71,7 +71,7 @@ public function getClass(): string
7171
* Determines the correct return type for {@see ActiveRecord::hasOne()} and {@see ActiveRecord::hasMany()} relation
7272
* methods by inspecting the first argument which should be a constant string representing the related model class.
7373
*
74-
* @param MethodReflection $methodReflection Reflection instance for the called relation method.
74+
* @param MethodReflection $methodReflection Reflection instance for the method being analyzed.
7575
* @param MethodCall $methodCall AST node for the method call expression.
7676
* @param Scope $scope PHPStan analysis scope for type resolution.
7777
*

src/type/ActiveRecordDynamicStaticMethodReturnTypeExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
* - Nullability handling for methods like {@see ActiveRecord::findOne()}.
4242
* - Support for custom {@see ActiveQuery} subclasses and generic parameter propagation.
4343
*
44-
* @see ActiveQuery for query API details.
45-
* @see ActiveRecord for ActiveRecord API details.
44+
* @see ActiveQuery for Active Query API details.
45+
* @see ActiveRecord for Active Record API details.
4646
* @see DynamicStaticMethodReturnTypeExtension for PHPStan dynamic static method return type extension contract.
4747
*
4848
* @copyright Copyright (C) 2023 Terabytesoftw.
@@ -88,7 +88,7 @@ public function getClass(): string
8888
* accurate autocompletion and static analysis for methods such as {@see ActiveRecord::findOne()},
8989
* {@see ActiveRecord::findAll()}, and custom query builders.
9090
*
91-
* @param MethodReflection $methodReflection Reflection instance for the static method.
91+
* @param MethodReflection $methodReflection Reflection instance for the method being analyzed.
9292
*
9393
* @return bool `true` if the static method is supported for dynamic return type inference; `false` otherwise.
9494
*/
@@ -156,7 +156,7 @@ public function isStaticMethodSupported(MethodReflection $methodReflection): boo
156156
* This method ensures that static analysis and IDEs reflect the actual runtime behavior of static
157157
* {@see ActiveRecord} methods, supporting precise type checks and developer productivity.
158158
*
159-
* @param MethodReflection $methodReflection Reflection instance for the static method.
159+
* @param MethodReflection $methodReflection Reflection instance for the method being analyzed.
160160
* @param StaticCall $methodCall AST node for the static method call expression.
161161
* @param Scope $scope PHPStan analysis scope for type resolution.
162162
*

src/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* - Integration with PHPStan file type mapper for accurate PHPDoc parsing.
4040
* - PHPDoc property tag extraction from model classes and behaviors.
4141
*
42-
* @see ActiveRecord for ActiveRecord API details.
42+
* @see ActiveRecord for Active Record API details.
4343
* @see DynamicMethodReturnTypeExtension for PHPStan dynamic return type extension contract.
4444
* @see ServiceMap for service and component map for Yii Application static analysis.
4545
*

0 commit comments

Comments
 (0)