Skip to content

Replace static stub files with dynamic stub generation for Yii::$app type inference, adding support for custom application types.#83

Merged
terabytesoftw merged 3 commits into
mainfrom
fix_mini_49
Apr 2, 2026
Merged

Replace static stub files with dynamic stub generation for Yii::$app type inference, adding support for custom application types.#83
terabytesoftw merged 3 commits into
mainfrom
fix_mini_49

Conversation

@terabytesoftw
Copy link
Copy Markdown
Member

Pull Request

Q A
Is bugfix? ✔️
New feature?
Breaks BC?

…` type inference, adding support for custom application types.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 2, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Replaced static stub files with dynamic stub generation for improved type inference of Yii::$app.
    • Extended support for custom application types with accurate type hints.
  • Tests

    • Added comprehensive tests for dynamic stub generation across base, console, web, and custom application types.
    • Added caching validation and error handling tests.
  • Chores

    • Updated PHPStan configuration to exclude additional test directories from analysis.
    • Updated workflow configuration for PHP version compatibility.

Walkthrough

Replaces packaged static Yii stub files with runtime-generated PHPStan stubs in StubFilesExtension, caches generated stubs by content hash, removes three static stub files, updates PHPStan config to ignore tests/custom/, and adds tests/configs for custom application-type inference.

Changes

Cohort / File(s) Summary
Changelog & PHPStan config
CHANGELOG.md, phpstan.neon
Added changelog entry about dynamic stub generation; excluded tests/custom/ from PHPStan analysis.
Core implementation
src/StubFilesExtension.php
Replaced static stub-file mapping with runtime stub generation. Constructor accepts optional stubDirectory. getFiles() returns a single generated stub path; new generateStub()/declaration builders, deterministic cache by md5(content), atomic publish with POSIX/Windows fallback, throws on unwritable temp dir.
Removed packaged stubs
stub/BaseYii.stub, stub/BaseYiiConsole.stub, stub/BaseYiiWeb.stub
Deleted all three static stub files; their prior declarations are now generated at runtime.
Tests for dynamic stubs
tests/StubFilesExtensionTest.php
Expanded tests to validate generated stub caching, existence, content for base/console/web/custom/default/global namespace types, lifecycle cleanup, and error on non-writable dir.
Custom app test infra
tests/config/phpstan-custom-app-config.php, tests/custom/extension-custom-test.neon, tests/custom/data/property/ApplicationPropertiesClassReflectionType.php, tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php
Added config, NEON, test data, and a PHPStan TypeInferenceTestCase to validate type inference for a custom application class and properties accessed via Yii::$app.
Additional test configs
tests/config/phpstan-base-app-config.php, tests/config/phpstan-global-class-app-config.php
Added configs for base and global-class application-type test scenarios.
CI workflow
.github/workflows/ecs.yml
Set explicit with.php-version input to ["8.3"] for the reusable ECS workflow.

Sequence Diagram(s)

sequenceDiagram
  participant PHPStan as PHPStan Runner
  participant StubExt as StubFilesExtension
  participant ServiceMap as ServiceMap
  participant FS as Filesystem (tmp)

  PHPStan->>StubExt: request getFiles()
  StubExt->>ServiceMap: getApplicationType()
  ServiceMap-->>StubExt: ApplicationType string
  StubExt->>FS: compute md5(of generated stub content) -> target path
  alt stub exists
    FS-->>StubExt: return existing stub path
  else stub missing
    StubExt->>FS: write PID-suffixed temp file with content (atomic rename)
    FS-->>StubExt: write success / file exists / error
    alt write success
      FS-->>StubExt: rename -> publish stub path
    else name collision
      FS-->>StubExt: return existing published path
    else write error
      StubExt-->>PHPStan: throw RuntimeException
    end
  end
  StubExt-->>PHPStan: return [stub path]
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

"I hop through code with whiskers bright,
Stubs once boxed now bloom at night.
Hash crumbs mark the perfect trail,
Yii::$app sings without fail.
🐇✨"

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: replacing static stub files with dynamic generation and adding custom application type support, which aligns with the core modifications in StubFilesExtension.php and test files.
Description check ✅ Passed The description is related to the changeset, correctly identifying it as a bugfix that adds custom application type support without breaking backward compatibility, though it provides minimal detail.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix_mini_49

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

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #83   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        71        81   +10     
===========================================
  Files              2         2           
  Lines            126       156   +30     
===========================================
+ Hits             126       156   +30     

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

@coderabbitai coderabbitai Bot added the bug Something isn't working label Apr 2, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/StubFilesExtension.php`:
- Around line 118-151: The current stub cache key is derived only from
$applicationType and can return a half-written file or stale content; instead
build the $content (using buildApplicationTypeDeclaration($escapedType)) first
and compute the cache key from the content (or include an explicit generator
version), then check for existence of the final stubPath; if missing, write to a
temporary file (e.g., $stubPath . '.tmp.' . uniqid()) and rename() it to
$stubPath to publish atomically; replace the direct file_put_contents($stubPath,
$content) call with this temp-write+rename flow and ensure you throw the same
RuntimeException if the rename/write fails.

In `@tests/custom/data/property/ApplicationPropertiesClassReflectionType.php`:
- Around line 23-40: Add an assertion that accesses the custom-only property
defined in ApplicationCustom (named $virtualProperty) to ensure PHPStan sees
PHPDoc-backed members on the custom app class; update the test suite by adding
an assertType('string' or the correct type, Yii::$app->virtualProperty) (e.g.,
in testReturnCustomApplicationInstanceFromYiiApp or as a new test method) so the
custom ApplicationCustom class's virtualProperty is verified rather than only
inherited yii\web\Application properties.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 49451754-e6a9-4c33-8694-a26c06a2afc0

📥 Commits

Reviewing files that changed from the base of the PR and between a2fe54e and 5b1fb99.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • phpstan.neon
  • src/StubFilesExtension.php
  • stub/BaseYii.stub
  • stub/BaseYiiConsole.stub
  • stub/BaseYiiWeb.stub
  • tests/StubFilesExtensionTest.php
  • tests/config/phpstan-custom-app-config.php
  • tests/custom/data/property/ApplicationPropertiesClassReflectionType.php
  • tests/custom/extension-custom-test.neon
  • tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php
💤 Files with no reviewable changes (3)
  • stub/BaseYii.stub
  • stub/BaseYiiWeb.stub
  • stub/BaseYiiConsole.stub
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: phpunit-compatibility / PHP 8.1-ubuntu-latest
  • GitHub Check: phpunit-compatibility / PHP 8.2-ubuntu-latest
  • GitHub Check: phpunit-compatibility / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.5-windows-2022
  • GitHub Check: phpunit / PHP 8.3-windows-2022
  • GitHub Check: phpunit-compatibility / PHP 8.1-windows-2022
  • GitHub Check: phpunit-compatibility / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit-compatibility / PHP 8.4-windows-2022
  • GitHub Check: phpunit / PHP 8.1-windows-2022
  • GitHub Check: phpunit / PHP 8.3-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.2-windows-2022
  • GitHub Check: phpunit-compatibility / PHP 8.2-windows-2022
  • GitHub Check: phpunit / PHP 8.5-ubuntu-latest
  • GitHub Check: phpunit / PHP 8.1-ubuntu-latest
  • GitHub Check: linter / Super Linter
  • GitHub Check: phpunit-compatibility / PHP 8.3-windows-2022
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 40
File: src/ServiceMap.php:0-0
Timestamp: 2025-06-14T17:41:48.820Z
Learning: The yii2-extensions/phpstan repository contains a PHPStan extension specifically designed for static analysis of Yii framework applications.
📚 Learning: 2025-10-10T12:54:50.152Z
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 77
File: .github/linters/actionlint.yml:5-7
Timestamp: 2025-10-10T12:54:50.152Z
Learning: In the yii2-extensions/phpstan repository, the maintainer prefers to keep the actionlint.yml configuration with the generic ignore entry `"section is alias node but mapping node is expected"` as it works correctly for their workflows, and previous suggestions to change it have failed in other repositories.

Applied to files:

  • phpstan.neon
  • tests/custom/extension-custom-test.neon
📚 Learning: 2025-06-14T17:41:48.820Z
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 40
File: src/ServiceMap.php:0-0
Timestamp: 2025-06-14T17:41:48.820Z
Learning: The yii2-extensions/phpstan repository contains a PHPStan extension specifically designed for static analysis of Yii framework applications.

Applied to files:

  • tests/config/phpstan-custom-app-config.php
  • tests/custom/extension-custom-test.neon
  • tests/custom/data/property/ApplicationPropertiesClassReflectionType.php
  • tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php
  • src/StubFilesExtension.php
  • tests/StubFilesExtensionTest.php
📚 Learning: 2025-06-17T22:22:55.915Z
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 47
File: src/type/ActiveRecordGetAttributeDynamicMethodReturnTypeExtension.php:107-110
Timestamp: 2025-06-17T22:22:55.915Z
Learning: In PHPStan extensions for this repository, `instanceof` must not be used in PHPStan runtime mode; instead, use `::class` comparisons for reliable type checks (e.g., `$obj::class === SomeClass::class` instead of `$obj instanceof SomeClass`).

Applied to files:

  • tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php
📚 Learning: 2025-06-12T16:41:20.240Z
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 36
File: src/type/ActiveQueryDynamicMethodReturnTypeExtension.php:153-157
Timestamp: 2025-06-12T16:41:20.240Z
Learning: In PHPStan extensions for this repository, `instanceof` must not be used to compare `PHPStan\Type\*` objects (e.g., `ThisType`) because it is not compatible with PHPStan’s runtime mode; instead, use `$type::class === SomeType::class` for reliable checks.

Applied to files:

  • tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php
🪛 GitHub Actions: ecs
src/StubFilesExtension.php

[error] 1-1: ECS code style check failed for src/StubFilesExtension.php (diff indicates formatting changes; also shows \ No newline at end of file).

🪛 PHPMD (2.15.0)
tests/custom/property/ApplicationPropertiesClassReflectionExtensionTest.php

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

(LongClassName)

src/StubFilesExtension.php

[error] 84-87: The method buildApplicationTypeDeclaration uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. (undefined)

(ElseExpression)


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

(ShortVariable)

tests/StubFilesExtensionTest.php

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

(ShortVariable)


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

(ShortVariable)


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

(ShortVariable)

🔇 Additional comments (1)
tests/StubFilesExtensionTest.php (1)

21-33: Nice coverage expansion for generated stubs.

The new assertions check existence, reuse, and emitted @var types across default, web, console, and custom application configurations, which is a solid safety net for this refactor.

Also applies to: 35-65, 67-98, 100-127, 129-158

Comment thread src/StubFilesExtension.php Outdated
@terabytesoftw
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 2, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/StubFilesExtensionTest.php`:
- Around line 50-51: Replace the short local variable $ds that holds
DIRECTORY_SEPARATOR with a private class constant (e.g., add private const DS =
DIRECTORY_SEPARATOR; to the StubFilesExtensionTest class) and update all
occurrences where $ds is used (for example in the expressions that build
$configPath and other path variables) to use self::DS instead (e.g., __DIR__ .
self::DS . 'config' . self::DS . 'phpstan-base-app-config.php'), which will
silence PHPMD short-name warnings and keep path construction consistent across
methods.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 34f3a4f9-cf75-4125-a818-15f63e5ce78e

📥 Commits

Reviewing files that changed from the base of the PR and between c44d8b2 and 47125f8.

📒 Files selected for processing (5)
  • src/StubFilesExtension.php
  • tests/StubFilesExtensionTest.php
  • tests/config/phpstan-base-app-config.php
  • tests/config/phpstan-global-class-app-config.php
  • tests/custom/data/property/ApplicationPropertiesClassReflectionType.php
📜 Review details
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 40
File: src/ServiceMap.php:0-0
Timestamp: 2025-06-14T17:41:48.820Z
Learning: The yii2-extensions/phpstan repository contains a PHPStan extension specifically designed for static analysis of Yii framework applications.
📚 Learning: 2025-06-14T17:41:48.820Z
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 40
File: src/ServiceMap.php:0-0
Timestamp: 2025-06-14T17:41:48.820Z
Learning: The yii2-extensions/phpstan repository contains a PHPStan extension specifically designed for static analysis of Yii framework applications.

Applied to files:

  • tests/config/phpstan-base-app-config.php
  • tests/config/phpstan-global-class-app-config.php
  • tests/custom/data/property/ApplicationPropertiesClassReflectionType.php
  • src/StubFilesExtension.php
  • tests/StubFilesExtensionTest.php
📚 Learning: 2025-10-10T12:54:50.152Z
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 77
File: .github/linters/actionlint.yml:5-7
Timestamp: 2025-10-10T12:54:50.152Z
Learning: In the yii2-extensions/phpstan repository, the maintainer prefers to keep the actionlint.yml configuration with the generic ignore entry `"section is alias node but mapping node is expected"` as it works correctly for their workflows, and previous suggestions to change it have failed in other repositories.

Applied to files:

  • tests/config/phpstan-base-app-config.php
📚 Learning: 2025-06-12T16:41:20.240Z
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 36
File: src/type/ActiveQueryDynamicMethodReturnTypeExtension.php:153-157
Timestamp: 2025-06-12T16:41:20.240Z
Learning: In PHPStan extensions for this repository, `instanceof` must not be used to compare `PHPStan\Type\*` objects (e.g., `ThisType`) because it is not compatible with PHPStan’s runtime mode; instead, use `$type::class === SomeType::class` for reliable checks.

Applied to files:

  • tests/config/phpstan-base-app-config.php
  • tests/custom/data/property/ApplicationPropertiesClassReflectionType.php
🪛 PHPMD (2.15.0)
src/StubFilesExtension.php

[error] 94-97: The method buildApplicationTypeDeclaration uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. (undefined)

(ElseExpression)

tests/StubFilesExtensionTest.php

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

(ShortVariable)


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

(ShortVariable)


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

(ShortVariable)


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

(ShortVariable)


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

(ShortVariable)


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

(ShortVariable)


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

(ShortVariable)

🔇 Additional comments (10)
src/StubFilesExtension.php (3)

46-49: LGTM! Clean constructor with optional stub directory.

The constructor properly accepts an optional $stubDirectory parameter with an empty string default, deferring to sys_get_temp_dir() in generateStub(). This design allows for both production use and testability (e.g., testing non-writable directories).


77-108: Namespace extraction logic is correct; else clause is acceptable here.

The static analysis hint about the else clause is a style preference. In this context, the if/else structure clearly expresses the two distinct cases (global namespace vs. namespaced class) and is readable. The early return alternative would require duplicating the heredoc template.

The logic correctly handles:

  • Base \yii\base\Application returns only the base declaration
  • Classes with namespaces extract namespace and class name properly
  • Global namespace classes (no backslash) use namespace { } syntax

160-198: Well-implemented atomic write pattern with content-based caching.

The implementation correctly:

  1. Derives the cache key from md5($content) to prevent stale files when generator logic changes
  2. Uses PID-suffixed temp file to avoid collisions between concurrent processes
  3. Applies LOCK_EX for exclusive write lock
  4. Uses atomic rename() for POSIX systems
  5. Handles Windows/non-POSIX edge cases where rename() fails if target exists

The @codeCoverageIgnoreStart block appropriately marks the race-condition fallback path that's difficult to test deterministically.

tests/config/phpstan-global-class-app-config.php (1)

1-9: LGTM! Valid test configuration for global namespace application type.

This configuration correctly tests the edge case where an application class exists in the global namespace (no backslash prefix). The StubFilesExtension::buildApplicationTypeDeclaration() handles this by emitting namespace { class GlobalApplication extends \yii\base\Application {} }.

tests/config/phpstan-base-app-config.php (1)

1-11: LGTM! Proper test configuration for base application type.

Using Application::class constant ensures type safety and IDE support. This configuration tests the special case in buildApplicationTypeDeclaration() where the application type equals \yii\base\Application, returning only the base declaration without a child class.

tests/custom/data/property/ApplicationPropertiesClassReflectionType.php (1)

21-47: LGTM! Comprehensive type assertion coverage for custom application.

The test methods properly validate:

  1. Yii::$app resolves to the configured ApplicationCustom type
  2. Inherited properties (charset, defaultRoute, language) resolve to string
  3. The custom @property string $virtualProperty from ApplicationCustom is correctly inferred

This ensures the dynamic stub generation correctly exposes both inherited and PHPDoc-defined properties on custom application classes. Based on learnings, this aligns with the PHPStan extension purpose for Yii framework static analysis.

tests/StubFilesExtensionTest.php (4)

32-44: LGTM! Good caching behavior test.

This test correctly validates that consecutive calls to getFiles() return the same cached stub path, verifying the content-based md5($content) caching mechanism works as expected.


50-88: Solid test for base application type with negative assertion.

The test correctly validates both the positive case (@var \yii\base\Application is present) and the negative case (no child class Application extends declaration). This ensures the special-case handling in buildApplicationTypeDeclaration() works correctly for the base type.


276-287: Good error handling test with appropriate expectations.

The test correctly validates that a RuntimeException is thrown when the stub directory is non-writable. Using an absolute non-existent path (/nonexistent/directory/path) ensures the test works cross-platform.


289-313: Proper test lifecycle management.

The tearDown() method correctly cleans up only tracked stubs, while cleanGeneratedStubs() provides isolation between tests by removing all matching stubs before each test runs. The file_exists() guard in tearDown() is good defensive coding against double-deletion attempts.

Comment thread tests/StubFilesExtensionTest.php
@terabytesoftw
Copy link
Copy Markdown
Member Author

@coderabbitai approve?

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 2, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

Let me review the key changes before considering approval.


🏁 Script executed:

#!/bin/bash
# Read the main changed file
cat src/StubFilesExtension.php

echo "---TEST FILE---"
cat tests/StubFilesExtensionTest.php

Length of output: 16316


@terabytesoftw After reviewing the key implementation in src/StubFilesExtension.php and tests/StubFilesExtensionTest.php, the changes look well-engineered:

  • Atomic writes: The PID-suffixed temp file + rename() pattern is correct, with a proper Windows/non-POSIX fallback.
  • Content-based caching: Using md5($content) as the cache key means the stub is automatically invalidated when the generator logic changes — a smart approach.
  • Namespace handling: All three cases are correctly handled — base yii\base\Application, namespaced custom types, and global-namespace types (e.g. GlobalApplication).
  • ltrim($applicationType, '\\'): Correctly strips any leading backslash for consistent type rendering.
  • Test coverage: Comprehensive — covers all application type variants, caching behaviour, and the error path for a non-writable directory. tearDown and cleanGeneratedStubs() ensure no temp file leakage between tests.
  • BC safety: The new $stubDirectory constructor parameter is optional with a sensible default (''sys_get_temp_dir()), preserving backward compatibility.

No issues found. I'm approving the PR. ✅

[approve]


🧠 Learnings used
Learnt from: terabytesoftw
Repo: yii2-extensions/phpstan PR: 40
File: src/ServiceMap.php:0-0
Timestamp: 2025-06-14T17:41:48.820Z
Learning: The yii2-extensions/phpstan repository contains a PHPStan extension specifically designed for static analysis of Yii framework applications.

@terabytesoftw terabytesoftw merged commit 79d8441 into main Apr 2, 2026
86 of 89 checks passed
@terabytesoftw terabytesoftw deleted the fix_mini_49 branch April 2, 2026 23:59
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