Skip to content

fix: improve Yii/PHPStan inference, cache invalidation, compatibility regression coverage, and documentation. - #103

Merged
terabytesoftw merged 1 commit into
mainfrom
fix/improve-yii-phpstan-inference
Oct 18, 2026
Merged

terabytesoftw merged 1 commit into
mainfrom
fix/improve-yii-phpstan-inference

Conversation

@terabytesoftw

Copy link
Copy Markdown
Member

Pull Request

  • Breaking change (fix or feature that would cause existing functionality to change)
  • Bugfix (non-breaking change that fixes an issue)
  • CI/build configuration
  • Documentation update
  • New feature (non-breaking change that adds functionality)
  • Refactoring (no functional changes)

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (29848e2) to head (d328ddd).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #103   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       147       149    +2     
===========================================
  Files              4         4           
  Lines            332       334    +2     
===========================================
+ Hits             332       334    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5cccb15d-d8ad-4e27-a6d6-c38173c51d0e
📥 Commits

Reviewing files that changed from the base of the PR and between 4c3800c and d328ddd.

📒 Files selected for processing: 60
  • CHANGELOG.md
  • README.md
  • composer-require-checker.json
  • docs/examples.md
  • docs/migration.md
  • docs/testing.md
  • skills/yii2-phpstan-analysis/SKILL.md
  • src/ParamsTypeBuilder.php
  • src/ServiceMapResultCacheValueExtension.php
  • src/type/ActiveQueryDynamicMethodReturnTypeExtension.php
  • src/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtension.php
  • src/type/LoggerMessagesExpressionTypeResolverExtension.php
  • tests/ParamsTypeBuilderTest.php
  • tests/ServiceMapResultCacheValueExtensionTest.php
  • tests/config/result-cache/component-states.php
  • tests/console/property/ApplicationPropertiesClassReflectionExtensionTest.php
  • tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php
  • tests/data/type/ActiveQueryDerivedModelEdgeType.php
  • tests/data/type/ActiveRecordGetAttributeDynamicMethodReturnType.php
  • tests/data/type/LoggerMessagesExpressionTypeResolver.php
  • tests/method/BehaviorMethodsClassReflectionExtensionTest.php
  • tests/property/BehaviorPropertiesClassReflectionExtensionTest.php
  • tests/property/UserPropertiesClassReflectionExtensionTest.php
  • tests/provider/ActiveQueryDynamicReturnTypeExtensionProvider.php
  • tests/provider/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionProvider.php
  • tests/provider/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionProvider.php
  • tests/provider/ActiveRecordRelationReturnTypeProvider.php
  • tests/provider/ActiveRecordStaticMethodReturnTypeProvider.php
  • tests/provider/BehaviorMethodsClassReflectionExtensionProvider.php
  • tests/provider/BehaviorPropertiesClassReflectionExtensionProvider.php
  • tests/provider/ConsoleApplicationPropertiesClassReflectionExtensionProvider.php
  • tests/provider/ContainerDynamicMethodReturnTypeExtensionProvider.php
  • tests/provider/CustomApplicationPropertiesClassReflectionExtensionProvider.php
  • tests/provider/HeaderCollectionDynamicMethodReturnTypeExtensionProvider.php
  • tests/provider/LoggerMessagesExpressionTypeResolverExtensionProvider.php
  • tests/provider/ParamsTypeBuilderProvider.php
  • tests/provider/ServiceLocatorDynamicMethodReturnTypeExtensionProvider.php
  • tests/provider/ServiceMapDefinitionTypeProvider.php
  • tests/provider/UserPropertiesClassReflectionExtensionProvider.php
  • tests/provider/WebApplicationParamsPropertyProvider.php
  • tests/provider/WebApplicationParamsTypeProvider.php
  • tests/provider/WebApplicationPropertiesClassReflectionExtensionProvider.php
  • tests/provider/WebParamsAwkwardKeysTypeProvider.php
  • tests/support/bootstrap.php
  • tests/support/stub/DerivedModelNativeQuery.php
  • tests/support/stub/VirtualAttributeRecord.php
  • tests/type/ActiveQueryDynamicReturnTypeExtensionTest.php
  • tests/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionTest.php
  • tests/type/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest.php
  • tests/type/ActiveRecordRelationReturnTypeTest.php
  • tests/type/ActiveRecordStaticMethodReturnTypeTest.php
  • tests/type/ContainerDynamicMethodReturnTypeExtensionTest.php
  • tests/type/HeaderCollectionDynamicMethodReturnTypeExtensionTest.php
  • tests/type/LoggerMessagesExpressionTypeResolverExtensionTest.php
  • tests/type/ServiceLocatorDynamicMethodReturnTypeExtensionTest.php
  • tests/type/ServiceMapDefinitionTypeTest.php
  • tests/web/property/ApplicationParamsTypeTest.php
  • tests/web/property/ApplicationPropertiesClassReflectionExtensionTest.php
  • tests/web/type/ApplicationParamsTypeTest.php
  • tests/web/type/ParamsAwkwardKeysTypeTest.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 28
  • GitHub Check: phpunit / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.5-windows-2022
  • GitHub Check: phpunit-compatibility / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit-compatibility / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit-compatibility / PHP 8.4-windows-2022
  • GitHub Check: quality / EditorConfig (ubuntu-latest)
  • GitHub Check: quality / Prettier (ubuntu-latest)
  • GitHub Check: phpunit / PHP 8.4-ubuntu-latest
  • GitHub Check: phpunit-compatibility / PHP 8.5-windows-2022
  • GitHub Check: phpunit-compatibility / PHP 8.3-windows-2022
  • GitHub Check: quality / Markdown (ubuntu-latest)
  • GitHub Check: phpunit-compatibility / PHP 8.3-ubuntu-latest
  • GitHub Check: easy-coding-standard / PHP 8.5-ubuntu-latest
  • GitHub Check: phpstan-console / PHP 8.3-ubuntu-latest
  • GitHub Check: phpstan-console / PHP 8.5-ubuntu-latest
  • GitHub Check: phpstan / PHP 8.5-ubuntu-latest
  • GitHub Check: phpstan / PHP 8.3-ubuntu-latest
  • GitHub Check: composer-require-checker / PHP 8.5-ubuntu-latest
  • GitHub Check: Analyze (actions)
  • GitHub Check: phpunit-compatibility / PHP 8.5-windows-2022
  • GitHub Check: phpunit-compatibility / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.4-windows-2022
  • GitHub Check: phpunit-compatibility / PHP 8.3-windows-2022
  • GitHub Check: phpunit / PHP 8.5-windows-2022
🧰 Additional context used
📚 Code guidelines: 1
AGENTS.md — auto-discovered
📓 Path-based instructions: 2
Source excerpt: Use the commands in `docs/testing.md`.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • CHANGELOG.md
  • docs/examples.md
  • tests/ServiceMapResultCacheValueExtensionTest.php
  • tests/data/type/ActiveQueryDerivedModelEdgeType.php
  • src/ServiceMapResultCacheValueExtension.php
  • tests/provider/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionProvider.php
  • composer-require-checker.json
  • tests/type/ActiveRecordRelationReturnTypeTest.php
  • tests/provider/CustomApplicationPropertiesClassReflectionExtensionProvider.php
  • tests/provider/HeaderCollectionDynamicMethodReturnTypeExtensionProvider.php
  • tests/data/type/LoggerMessagesExpressionTypeResolver.php
  • tests/config/result-cache/component-states.php
  • tests/provider/ServiceMapDefinitionTypeProvider.php
  • tests/provider/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionProvider.php
  • tests/provider/WebApplicationParamsPropertyProvider.php
  • tests/provider/UserPropertiesClassReflectionExtensionProvider.php
  • tests/provider/ConsoleApplicationPropertiesClassReflectionExtensionProvider.php
  • README.md
  • tests/provider/WebApplicationPropertiesClassReflectionExtensionProvider.php
  • tests/provider/WebParamsAwkwardKeysTypeProvider.php
  • tests/web/property/ApplicationPropertiesClassReflectionExtensionTest.php
  • tests/type/HeaderCollectionDynamicMethodReturnTypeExtensionTest.php
  • tests/provider/BehaviorMethodsClassReflectionExtensionProvider.php
  • tests/provider/ServiceLocatorDynamicMethodReturnTypeExtensionProvider.php
  • tests/provider/ActiveQueryDynamicReturnTypeExtensionProvider.php
  • tests/type/ServiceLocatorDynamicMethodReturnTypeExtensionTest.php
  • tests/support/bootstrap.php
  • tests/provider/LoggerMessagesExpressionTypeResolverExtensionProvider.php
  • tests/type/ActiveRecordStaticMethodReturnTypeTest.php
  • tests/provider/WebApplicationParamsTypeProvider.php
  • tests/provider/ContainerDynamicMethodReturnTypeExtensionProvider.php
  • tests/provider/ActiveRecordRelationReturnTypeProvider.php
  • tests/provider/ParamsTypeBuilderProvider.php
  • tests/provider/BehaviorPropertiesClassReflectionExtensionProvider.php
  • src/type/LoggerMessagesExpressionTypeResolverExtension.php
  • tests/type/ServiceMapDefinitionTypeTest.php
  • tests/property/BehaviorPropertiesClassReflectionExtensionTest.php
  • skills/yii2-phpstan-analysis/SKILL.md
  • tests/provider/ActiveRecordStaticMethodReturnTypeProvider.php
  • tests/web/property/ApplicationParamsTypeTest.php
  • tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php
  • tests/support/stub/VirtualAttributeRecord.php
  • src/ParamsTypeBuilder.php
  • tests/type/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest.php
  • docs/testing.md
  • tests/ParamsTypeBuilderTest.php
  • tests/console/property/ApplicationPropertiesClassReflectionExtensionTest.php
  • docs/migration.md
  • tests/type/ActiveQueryDynamicReturnTypeExtensionTest.php
  • tests/support/stub/DerivedModelNativeQuery.php
  • tests/property/UserPropertiesClassReflectionExtensionTest.php
  • src/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtension.php
  • src/type/ActiveQueryDynamicMethodReturnTypeExtension.php
  • tests/type/ContainerDynamicMethodReturnTypeExtensionTest.php
  • tests/web/type/ParamsAwkwardKeysTypeTest.php
  • tests/web/type/ApplicationParamsTypeTest.php
  • tests/type/LoggerMessagesExpressionTypeResolverExtensionTest.php
  • tests/method/BehaviorMethodsClassReflectionExtensionTest.php
  • tests/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionTest.php
  • tests/data/type/ActiveRecordGetAttributeDynamicMethodReturnType.php
Source excerpt: Application integration guidance belongs to `skills/yii2-phpstan-analysis/SKILL.md`.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • CHANGELOG.md
  • README.md
🪛 PHPMD (2.15.0)
tests/ServiceMapResultCacheValueExtensionTest.php

[warning] 18-212: The class ServiceMapResultCacheValueExtensionTest has 12 public methods. Consider refactoring ServiceMapResultCacheValueExtensionTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)

[error] 40-40: Avoid using static access to class '\yii2\extensions\phpstan\ServiceMapResultCacheValueExtension' in method 'testGetValueDistinguishesClasslessComponentFromUnresolvedFactory'. (undefined)

(StaticAccess)

[error] 43-43: Avoid using static access to class '\yii2\extensions\phpstan\ServiceMapResultCacheValueExtension' in method 'testGetValueDistinguishesClasslessComponentFromUnresolvedFactory'. (undefined)

(StaticAccess)

[error] 48-48: Avoid using static access to class '\yii2\extensions\phpstan\ServiceMapResultCacheValueExtension' in method 'testGetValueDistinguishesClasslessComponentFromUnresolvedFactory'. (undefined)

(StaticAccess)

[error] 53-53: Avoid using static access to class '\yii2\extensions\phpstan\ServiceMapResultCacheValueExtension' in method 'testGetValueDistinguishesClasslessComponentFromUnresolvedFactory'. (undefined)

(StaticAccess)

tests/data/type/ActiveQueryDerivedModelEdgeType.php

[error] 36-186: The class ActiveQueryDerivedModelEdgeType has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)

tests/provider/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionProvider.php

[warning] 16-47: Avoid excessively long class names like ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 25-27: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 28-30: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 31-33: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 34-36: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 37-39: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 42-44: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/CustomApplicationPropertiesClassReflectionExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like CustomApplicationPropertiesClassReflectionExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\custom\property\ApplicationPropertiesClassReflectionExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/HeaderCollectionDynamicMethodReturnTypeExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like HeaderCollectionDynamicMethodReturnTypeExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\HeaderCollectionDynamicMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/ServiceMapDefinitionTypeProvider.php

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ServiceMapDefinitionTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/WebApplicationParamsPropertyProvider.php

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\web\property\ApplicationParamsTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/UserPropertiesClassReflectionExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like UserPropertiesClassReflectionExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\property\UserPropertiesClassReflectionExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/ConsoleApplicationPropertiesClassReflectionExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like ConsoleApplicationPropertiesClassReflectionExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\console\property\ApplicationPropertiesClassReflectionExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/WebApplicationPropertiesClassReflectionExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like WebApplicationPropertiesClassReflectionExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\web\property\ApplicationPropertiesClassReflectionExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/WebParamsAwkwardKeysTypeProvider.php

[error] 21-21: Avoid using static access to class '\yii2\extensions\phpstan\tests\web\type\ParamsAwkwardKeysTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/web/property/ApplicationPropertiesClassReflectionExtensionTest.php

[warning] 16-28: Avoid excessively long class names like ApplicationPropertiesClassReflectionExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/type/HeaderCollectionDynamicMethodReturnTypeExtensionTest.php

[warning] 18-30: Avoid excessively long class names like HeaderCollectionDynamicMethodReturnTypeExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/provider/BehaviorMethodsClassReflectionExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like BehaviorMethodsClassReflectionExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\method\BehaviorMethodsClassReflectionExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/ServiceLocatorDynamicMethodReturnTypeExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like ServiceLocatorDynamicMethodReturnTypeExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ServiceLocatorDynamicMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/ActiveQueryDynamicReturnTypeExtensionProvider.php

[warning] 12-31: Avoid excessively long class names like ActiveQueryDynamicReturnTypeExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveQueryDynamicReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 24-26: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveQueryDynamicReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 27-29: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveQueryDynamicReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/type/ServiceLocatorDynamicMethodReturnTypeExtensionTest.php

[warning] 18-30: Avoid excessively long class names like ServiceLocatorDynamicMethodReturnTypeExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/provider/LoggerMessagesExpressionTypeResolverExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like LoggerMessagesExpressionTypeResolverExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\LoggerMessagesExpressionTypeResolverExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/WebApplicationParamsTypeProvider.php

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\web\type\ApplicationParamsTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 24-26: Avoid using static access to class '\yii2\extensions\phpstan\tests\web\type\ApplicationParamsTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 27-29: Avoid using static access to class '\yii2\extensions\phpstan\tests\web\type\ApplicationParamsTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 30-32: Avoid using static access to class '\yii2\extensions\phpstan\tests\web\type\ApplicationParamsTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/ContainerDynamicMethodReturnTypeExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like ContainerDynamicMethodReturnTypeExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ContainerDynamicMethodReturnTypeExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/ActiveRecordRelationReturnTypeProvider.php

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordRelationReturnTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 24-26: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordRelationReturnTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/provider/BehaviorPropertiesClassReflectionExtensionProvider.php

[warning] 12-25: Avoid excessively long class names like BehaviorPropertiesClassReflectionExtensionProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\property\BehaviorPropertiesClassReflectionExtensionTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

src/type/LoggerMessagesExpressionTypeResolverExtension.php

[error] 39-153: The class LoggerMessagesExpressionTypeResolverExtension has a coupling between objects value of 22. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)

[warning] 39-153: Avoid excessively long class names like LoggerMessagesExpressionTypeResolverExtension. Keep class name length under 40. (undefined)

(LongClassName)

tests/property/BehaviorPropertiesClassReflectionExtensionTest.php

[warning] 16-28: Avoid excessively long class names like BehaviorPropertiesClassReflectionExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/provider/ActiveRecordStaticMethodReturnTypeProvider.php

[warning] 12-28: Avoid excessively long class names like ActiveRecordStaticMethodReturnTypeProvider. Keep class name length under 40. (undefined)

(LongClassName)

[error] 21-23: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordStaticMethodReturnTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

[error] 24-26: Avoid using static access to class '\yii2\extensions\phpstan\tests\type\ActiveRecordStaticMethodReturnTypeTest' in method 'dataFileAsserts'. (undefined)

(StaticAccess)

tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php

[warning] 17-29: Avoid excessively long class names like ApplicationPropertiesClassReflectionExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

src/ParamsTypeBuilder.php

[error] 31-87: The class ParamsTypeBuilder has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)

tests/type/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest.php

[warning] 23-35: Avoid excessively long class names like ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/console/property/ApplicationPropertiesClassReflectionExtensionTest.php

[warning] 17-29: Avoid excessively long class names like ApplicationPropertiesClassReflectionExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/type/ActiveQueryDynamicReturnTypeExtensionTest.php

[warning] 24-36: Avoid excessively long class names like ActiveQueryDynamicReturnTypeExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/support/stub/DerivedModelNativeQuery.php

[warning] 17-17: Avoid variables with short names like $db. Configured minimum length is 3. (undefined)

(ShortVariable)

[warning] 17-17: Avoid unused parameters such as '$db'. (undefined)

(UnusedFormalParameter)

[warning] 22-22: Avoid variables with short names like $db. Configured minimum length is 3. (undefined)

(ShortVariable)

[warning] 22-22: Avoid unused parameters such as '$db'. (undefined)

(UnusedFormalParameter)

tests/property/UserPropertiesClassReflectionExtensionTest.php

[warning] 16-28: Avoid excessively long class names like UserPropertiesClassReflectionExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

src/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtension.php

[warning] 30-214: Avoid excessively long class names like ActiveRecordGetAttributeDynamicMethodReturnTypeExtension. Keep class name length under 40. (undefined)

(LongClassName)

src/type/ActiveQueryDynamicMethodReturnTypeExtension.php

[warning] 61-555: The class ActiveQueryDynamicMethodReturnTypeExtension has an overall complexity of 67 which is very high. The configured complexity threshold is 50. (undefined)

(ExcessiveClassComplexity)

[error] 61-555: The class ActiveQueryDynamicMethodReturnTypeExtension has a coupling between objects value of 20. Consider to reduce the number of dependencies under 13. (undefined)

(CouplingBetweenObjects)

[warning] 61-555: Avoid excessively long class names like ActiveQueryDynamicMethodReturnTypeExtension. Keep class name length under 40. (undefined)

(LongClassName)

[warning] 115-173: The method getTypeFromMethodCall() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. (undefined)

(CyclomaticComplexity)

[warning] 115-173: The method getTypeFromMethodCall() has an NPath complexity of 216. The configured NPath complexity threshold is 200. (undefined)

(NPathComplexity)

tests/type/ContainerDynamicMethodReturnTypeExtensionTest.php

[warning] 17-29: Avoid excessively long class names like ContainerDynamicMethodReturnTypeExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/type/LoggerMessagesExpressionTypeResolverExtensionTest.php

[warning] 16-31: Avoid excessively long class names like LoggerMessagesExpressionTypeResolverExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/method/BehaviorMethodsClassReflectionExtensionTest.php

[warning] 16-28: Avoid excessively long class names like BehaviorMethodsClassReflectionExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionTest.php

[warning] 28-55: Avoid excessively long class names like ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionTest. Keep class name length under 40. (undefined)

(LongClassName)

tests/data/type/ActiveRecordGetAttributeDynamicMethodReturnType.php

[warning] 30-135: The class ActiveRecordGetAttributeDynamicMethodReturnType has 13 public methods. Consider refactoring ActiveRecordGetAttributeDynamicMethodReturnType to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)

[warning] 30-135: Avoid excessively long class names like ActiveRecordGetAttributeDynamicMethodReturnType. Keep class name length under 40. (undefined)

(LongClassName)

🔇 Additional comments: 61
src/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtension.php: 1

114-116: LGTM!

Also applies to: 152-169, 204-204

tests/data/type/ActiveRecordGetAttributeDynamicMethodReturnType.php: 1

18-18: LGTM!

Also applies to: 67-82

tests/support/stub/VirtualAttributeRecord.php: 1

1-28: LGTM!

tests/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionTest.php: 1

8-10: LGTM!

Also applies to: 26-26, 35-35, 40-54

src/ServiceMapResultCacheValueExtension.php: 1

67-70: LGTM!

Also applies to: 225-227

tests/ServiceMapResultCacheValueExtensionTest.php: 1

36-57: LGTM!

tests/config/result-cache/component-states.php: 1

7-8: LGTM!

src/type/LoggerMessagesExpressionTypeResolverExtension.php: 1

27-27: LGTM!

Also applies to: 105-108

tests/support/bootstrap.php: 1

20-28: LGTM!

tests/data/type/LoggerMessagesExpressionTypeResolver.php: 1

22-22: LGTM!

Also applies to: 34-34, 87-87, 92-92

composer-require-checker.json: 1

45-45: LGTM!

tests/console/property/ApplicationPropertiesClassReflectionExtensionTest.php: 1

8-9: LGTM!

Also applies to: 14-15, 24-24

tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php: 1

8-9: LGTM!

Also applies to: 14-15, 24-24

tests/method/BehaviorMethodsClassReflectionExtensionTest.php: 1

8-9: LGTM!

Also applies to: 13-14, 23-23

tests/property/BehaviorPropertiesClassReflectionExtensionTest.php: 1

8-9: LGTM!

Also applies to: 13-14, 23-23

tests/property/UserPropertiesClassReflectionExtensionTest.php: 1

8-9: LGTM!

Also applies to: 13-14, 23-23

tests/provider/ActiveQueryDynamicReturnTypeExtensionProvider.php: 1

1-31: LGTM!

tests/provider/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionProvider.php: 1

1-25: LGTM!

tests/provider/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionProvider.php: 1

1-47: LGTM!

tests/provider/ActiveRecordRelationReturnTypeProvider.php: 1

1-28: LGTM!

tests/provider/ActiveRecordStaticMethodReturnTypeProvider.php: 1

1-28: LGTM!

tests/provider/BehaviorMethodsClassReflectionExtensionProvider.php: 1

1-25: LGTM!

tests/provider/BehaviorPropertiesClassReflectionExtensionProvider.php: 1

1-25: LGTM!

tests/provider/ConsoleApplicationPropertiesClassReflectionExtensionProvider.php: 1

1-25: LGTM!

tests/provider/ContainerDynamicMethodReturnTypeExtensionProvider.php: 1

1-25: LGTM!

tests/provider/CustomApplicationPropertiesClassReflectionExtensionProvider.php: 1

1-25: LGTM!

tests/provider/HeaderCollectionDynamicMethodReturnTypeExtensionProvider.php: 1

1-25: LGTM!

tests/provider/ServiceLocatorDynamicMethodReturnTypeExtensionProvider.php: 1

1-25: LGTM!

tests/provider/ServiceMapDefinitionTypeProvider.php: 1

1-25: LGTM!

tests/provider/UserPropertiesClassReflectionExtensionProvider.php: 1

1-25: LGTM!

tests/provider/WebApplicationParamsPropertyProvider.php: 1

1-25: LGTM!

tests/provider/WebApplicationParamsTypeProvider.php: 1

1-34: LGTM!

tests/provider/WebApplicationPropertiesClassReflectionExtensionProvider.php: 1

1-25: LGTM!

tests/provider/WebParamsAwkwardKeysTypeProvider.php: 1

1-23: LGTM!

tests/type/ActiveQueryDynamicReturnTypeExtensionTest.php: 1

8-8: LGTM!

Also applies to: 10-10, 21-22, 31-31

tests/type/ActiveRecordQueryDynamicStaticMethodReturnTypeExtensionTest.php: 1

8-10: LGTM!

Also applies to: 20-21, 30-30

tests/type/ActiveRecordRelationReturnTypeTest.php: 1

8-8: LGTM!

Also applies to: 10-10, 18-19, 28-28

tests/type/ActiveRecordStaticMethodReturnTypeTest.php: 1

8-8: LGTM!

Also applies to: 10-10, 19-20, 29-29

tests/type/ContainerDynamicMethodReturnTypeExtensionTest.php: 1

8-8: LGTM!

Also applies to: 10-10, 14-15, 24-24

tests/type/HeaderCollectionDynamicMethodReturnTypeExtensionTest.php: 1

8-8: LGTM!

Also applies to: 10-10, 15-16, 25-25

tests/type/LoggerMessagesExpressionTypeResolverExtensionTest.php: 1

8-9: LGTM!

Also applies to: 13-14, 26-26

tests/type/ServiceLocatorDynamicMethodReturnTypeExtensionTest.php: 1

8-8: LGTM!

Also applies to: 10-10, 15-16, 25-25

tests/type/ServiceMapDefinitionTypeTest.php: 1

8-8: LGTM!

Also applies to: 10-10, 15-16, 25-25

tests/web/property/ApplicationParamsTypeTest.php: 1

8-9: LGTM!

Also applies to: 16-17, 26-26

tests/web/property/ApplicationPropertiesClassReflectionExtensionTest.php: 1

8-9: LGTM!

Also applies to: 13-14, 23-23

tests/web/type/ApplicationParamsTypeTest.php: 1

8-9: LGTM!

Also applies to: 15-16, 25-25

tests/web/type/ParamsAwkwardKeysTypeTest.php: 1

8-9: LGTM!

Also applies to: 15-16, 25-25

tests/provider/LoggerMessagesExpressionTypeResolverExtensionProvider.php: 1

12-25: 🎯 Functional Correctness

The PsrMessage filtering does not need to be restored. The fixture uses PHPSTAN_TEST_LOG_PAYLOAD_TYPE, and the bootstrap defines that constant according to the installed Yii version. PHPStan loads this bootstrap through phpstan.neon.

src/ParamsTypeBuilder.php: 1

48-53: LGTM!

tests/data/type/ActiveQueryDerivedModelEdgeType.php: 1

163-166: LGTM!

tests/support/stub/DerivedModelNativeQuery.php: 1

10-24: LGTM!

tests/ParamsTypeBuilderTest.php: 1

26-53: LGTM!

tests/provider/ParamsTypeBuilderProvider.php: 1

16-27: LGTM!

src/type/ActiveQueryDynamicMethodReturnTypeExtension.php: 1

128-142: 📐 Maintainability & Code Quality

Do not add the proposed nullable all() case.

The isSuperTypeOf direction is correct. A derived type that is a supertype of the declared type causes PHPStan to keep the equal or narrower declared type. Existing DerivedModelNativeQuery assertions cover this for both one(): Post and all(): list<Post>.

array<Post>|null is not a narrower all() return than the derived array type. The model-derivation logic also rejects nullable all() declarations before this comparison runs, so that case cannot exercise the new branch.

CHANGELOG.md: 1

10-10: LGTM!

README.md: 1

222-223: LGTM!

Also applies to: 225-230, 231-243

docs/examples.md: 1

117-119: LGTM!

docs/migration.md: 1

117-118: LGTM!

Also applies to: 132-133

docs/testing.md: 2

36-37: LGTM!

31-34: 📐 Maintainability & Code Quality

phpunit.xml.dist:5 loads tests/support/bootstrap.php. The direct PHPStan configurations also load that bootstrap, so both paths use PHPSTAN_TEST_LOG_PAYLOAD_TYPE. The requested verification concern is not actionable.

skills/yii2-phpstan-analysis/SKILL.md: 1

15-26: LGTM!

Also applies to: 37-40

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved Yii/PHPStan type inference for derived ActiveQuery results, including preservation of more precise declared return types.
    • Corrected getAttribute() inference so virtual getters and read-only tags are not treated as stored attributes.
    • Fixed parameter-array key inference and cache handling for classless components.
    • Improved compatibility with Yii versions that do not provide PsrMessage.
  • Documentation

    • Clarified attribute inference, component typing, and guidance for AI-assisted analysis and package checks.
    • Updated the changelog for version 0.5.1.

The changes update Yii/PHPStan type inference for parameter shapes, ActiveQuery results, and ActiveRecord attribute access. They also distinguish classless component cache states, make logger message typing conditional on installed Yii classes, reorganize assertion data providers, and revise repository guidance.

Changes: Inference and compatibility updates

Layer / File(s) Summary
Parameter and ActiveQuery inference
src/ParamsTypeBuilder.php, src/type/ActiveQueryDynamicMethodReturnTypeExtension.php, tests/ParamsTypeBuilderTest.php, tests/provider/ParamsTypeBuilderProvider.php, tests/data/type/ActiveQueryDerivedModelEdgeType.php, tests/support/stub/DerivedModelNativeQuery.php
Parameter-shape construction now calculates the next integer index from integer keys. ActiveQuery inference yields to an equally precise or narrower declared return type. Tests cover appended array offsets and derived-query return types.
ActiveRecord attribute access
src/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtension.php, tests/data/type/ActiveRecordGetAttributeDynamicMethodReturnType.php, tests/support/stub/VirtualAttributeRecord.php, tests/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtensionTest.php
Read-only tags resolve to mixed for attribute access. Tests cover read-only relation tags and confirm that getAttribute() does not invoke a virtual getter.
Cache states and logger compatibility
src/ServiceMapResultCacheValueExtension.php, tests/ServiceMapResultCacheValueExtensionTest.php, tests/config/result-cache/component-states.php, src/type/LoggerMessagesExpressionTypeResolverExtension.php, tests/support/bootstrap.php, tests/data/type/LoggerMessagesExpressionTypeResolver.php, composer-require-checker.json
Component cache values now distinguish classless components from unresolved or absent components. Logger typing and test expectations include yii\log\PsrMessage only when reflection finds the class.
External assertion providers
tests/provider/*, tests/{console,custom,method,property,type,web}/...Test.php
Type assertion tests now use external PHPUnit data providers. New provider classes gather assertion datasets from the existing fixture files.
Guides and release notes
CHANGELOG.md, README.md, docs/examples.md, docs/migration.md, docs/testing.md, skills/yii2-phpstan-analysis/SKILL.md
The guides describe attribute access and component inference. Testing guidance covers version-aware logger expectations and isolated-consumer checks. The skill instructions update package-version and documentation lookup steps.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to d328d

The inference and test changes have no identified issue requiring correction before merge.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 41.03% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 78 functions across 50 files. (10 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the pull request as a fix covering the main inference, cache, compatibility, regression coverage, and documentation changes.
Description check Passed The description identifies the pull request as a non-breaking bugfix, which is related to the implementation changes.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 41.03% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 78 functions across 50 files. (10 skipped: 7 unsupported, 3 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit with a changelog to read,
And sharper type hints for every need.
Cache states now have names of their own,
Logger checks adapt to the classes shown.
Test providers hop to a shared new place,
While docs trace each inference case.
I nibble the notes, then bound with delight.

Comment @coderabbitai help to get the list of available commands.

@terabytesoftw terabytesoftw added the bug Something isn't working label Oct 18, 2026
@terabytesoftw

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T12:14:21.906528Z d328ddd Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: d328ddd9d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@terabytesoftw
terabytesoftw merged commit ff4a892 into main Oct 18, 2026
59 checks passed
@terabytesoftw
terabytesoftw deleted the fix/improve-yii-phpstan-inference branch October 18, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant