Skip to content

Internal improvements 2 - #18

Merged
rcalicdan merged 6 commits into
mainfrom
internal-improvements-2
Aug 12, 2026
Merged

Internal improvements 2#18
rcalicdan merged 6 commits into
mainfrom
internal-improvements-2

Conversation

@rcalicdan

Copy link
Copy Markdown
Member
  • Added support for typecheking magic method and property annotation
  • Improve generic bound for object pseudo type
  • Improve and enhances documentation

Summary of the major bug

  • Fixes a false-positive TypeError when validating class-string parameters bounded by pseudo-types (e.g. @template T of object).
    Root Cause
  • ParamChecker::resolveClassStringTemplate() executed PHP's native is_a($val, 'object', true). Since 'object' is a pseudo-type keyword rather than a class name, is_a() evaluated to false for valid class-strings.
    Fix
  • ParamChecker: Updated resolveClassStringTemplate() to recognize object and mixed pseudo-type bounds without calling is_a().
    Tests: Added GenericTemplateBoundsStressTest.php covering pseudo-type bounds, array shapes, ranges, and default template fallbacks.

- Implemented validation for magic methods and properties in ParamChecker and ReturnChecker.
- Added support for dynamic @method and @Property annotations in DocblockExtractor.
- Introduced new tests for inherited magic methods and properties.
- Improved error handling for non-existent methods and properties.
- Updated configuration to manage magic methods and properties validation.
- Refactored SpecialTypeResolver to handle reflection context more gracefully.
- Added new fixtures for testing dynamic method and property behavior.
@rcalicdan
rcalicdan merged commit 739840c into main Aug 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant