Skip to content

Correct isList type documentation#342

Merged
shadowhand merged 2 commits intomasterfrom
fix/is-list-type
Feb 13, 2026
Merged

Correct isList type documentation#342
shadowhand merged 2 commits intomasterfrom
fix/is-list-type

Conversation

@shadowhand
Copy link
Collaborator

Also adds missing import for Throwable in Mixin.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR corrects the type documentation for isList and isNonEmptyList methods by adding generic type parameters (<T>) to make them properly type-safe. It also adds a missing Throwable import to both the Mixin.php file and the MixinGenerator.php file that generates it.

Changes:

  • Added <T> generic type parameters to isList and isNonEmptyList type annotations in Assert.php and their mixin variants in Mixin.php
  • Added missing Throwable import to Mixin.php and updated MixinGenerator.php to generate this import

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 8 comments.

File Description
src/Assert.php Added @template T and updated @psalm-assert and @psalm-return annotations for isList and isNonEmptyList methods to use generic type list<T> and non-empty-list<T>
src/Mixin.php Added Throwable import and updated type annotations for nullOr*, all*, and allNullOr* variants of isList and isNonEmptyList methods with generic type parameters
bin/src/MixinGenerator.php Added Throwable import and updated generator to include Throwable in generated Mixin.php namespace imports
CHANGELOG.md Added version 2.1.3 entry documenting the isList type documentation correction

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4844 to +4847
* @psalm-assert non-empty-list<T>|null $array
*
* @return non-empty-list|null
* @template T
* @return non-empty-list<T>|null
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 4922-4923), and allNullOrIsMap method (line 4945-4946). The correct order should be: @psalm-pure, @template T, @psalm-assert.

Copilot uses AI. Check for mistakes.
Comment on lines +4861 to +4864
* @psalm-assert iterable<non-empty-list<T>> $array
*
* @return iterable<non-empty-list>
* @template T
* @return iterable<non-empty-list<T>>
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 4922-4923), and allNullOrIsMap method (line 4945-4946). The correct order should be: @psalm-pure, @template T, @psalm-assert.

Copilot uses AI. Check for mistakes.
Comment on lines +4882 to +4885
* @psalm-assert iterable<non-empty-list<T>|null> $array
*
* @return iterable<non-empty-list|null>
* @template T
* @return iterable<non-empty-list<T>|null>
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 4922-4923), and allNullOrIsMap method (line 4945-4946). The correct order should be: @psalm-pure, @template T, @psalm-assert.

Copilot uses AI. Check for mistakes.
Comment on lines +1987 to +1991
* @psalm-assert list<T> $array
*
* @psalm-return list
* @psalm-return list<T>
*
* @template T
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The @template annotation should be placed at the beginning of the docblock (after @psalm-pure), before @psalm-assert, to maintain consistency with other templated methods in this file. For example, see the isInstanceOf method (line 475), notInstanceOf method (line 503), isAOf method (line 558), isNotA method (line 587), and isMap method (line 2028). The correct order should be: @psalm-pure, @template T, @psalm-assert, @psalm-return.

Copilot uses AI. Check for mistakes.
Comment on lines +2009 to +2013
* @psalm-assert non-empty-list<T> $array
*
* @psalm-return non-empty-list
* @psalm-return non-empty-list<T>
*
* @template T
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The @template annotation should be placed at the beginning of the docblock (after @psalm-pure), before @psalm-assert, to maintain consistency with other templated methods in this file. For example, see the isInstanceOf method (line 475), notInstanceOf method (line 503), isAOf method (line 558), isNotA method (line 587), and isMap method (line 2028). The correct order should be: @psalm-pure, @template T, @psalm-assert, @psalm-return.

Copilot uses AI. Check for mistakes.
Comment on lines +4785 to +4788
* @psalm-assert list<T>|null $array
*
* @return list|null
* @template T
* @return list<T>|null
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The @template annotation should be placed before @psalm-assert to maintain consistency with other templated methods in this file. For example, see the nullOrIsInstanceOf method (line 1146-1147), allIsInstanceOf method (line 1165-1166), nullOrIsMap method (line 4903-4904), allIsMap method (line 4922-4923), and allNullOrIsMap method (line 4945-4946). The correct order should be: @psalm-pure, @template T, @psalm-assert.

Copilot uses AI. Check for mistakes.
@shadowhand shadowhand merged commit b428c3f into master Feb 13, 2026
15 checks passed
@shadowhand shadowhand deleted the fix/is-list-type branch February 13, 2026 19:16
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