Repository navigation
Make ArrayHash stub generic - #225
Merged
Merged
Conversation
The ArrayHash stub now follows the PHPDoc of nette/utils: ArrayHash is generic over its values and extends stdClass. Generic types like ArrayHash<mixed> from nette/forms 3.2.9+ PHPDoc are no longer collapsed into non-generic ArrayHash. ArrayHash is added to skipCheckGenericClasses so that ArrayHash without a type argument is not reported as missing its generic types. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
ArrayHashstub now follows the PHPDoc ofNette\Utils\ArrayHashin nette/utils 4.x:@template T, with@implements \IteratorAggregate<array-key, T>and@implements \ArrayAccess<array-key, T>extends \stdClass(cosmetic, the real class extends it too)getIterator()returns\Iterator<array-key, T>Previously the stub made
ArrayHashnon-generic, so types likeArrayHash<mixed>from the nette/forms 3.2.9+ PHPDoc, orArrayHash<int>written by users, were collapsed into plainArrayHash.Nette\Utils\ArrayHashis added toskipCheckGenericClasses, soArrayHashwithout a type argument is not reported withmissingType.generics. Bleeding edge empties this list (skipCheckGenericClasses!: []), so projects using it will see these errors, as with other generic classes.@property ArrayHash $valuesin theContainerstub is nowArrayHash<mixed>.On nette/utils 2.x and 3.x,
getIterator()is natively declared as\RecursiveArrayIterator, so PHPStan uses the native return type there andforeachoverArrayHashkeeps givingmixedvalues, as before. The iterator test only runs on nette/utils 4.0+.🤖 Generated with Claude Code