Skip to content

Conversation

@MatusBoa
Copy link
Contributor

@MatusBoa MatusBoa commented Oct 6, 2025

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds Iterables::filter (preserving keys; yields entries only when callback returns boolean true), many new focused unit tests for Iterables utilities, removes an older consolidated test file, and updates CI: expands GitHub Actions PHPUnit matrix to include PHP 8.5.

Changes

Cohort / File(s) Summary
CI workflow update
.github/workflows/phpunit.yaml
Adds PHP 8.5 to the PHPUnit test matrix (['8.1','8.2','8.3','8.4','8.5']).
New job: code style workflow
.github/workflows/code-style.yaml
Adds a "Code Style" workflow with php-cs-fixer and rector jobs using PHP 8.4 and composer install steps.
New tooling configs
.php-cs-fixer.php, rector.php
Adds PHP-CS-Fixer and Rector configuration files (finder/paths and rule/level settings).
Repo metadata
composer.json, .gitignore
Adds dev deps friendsofphp/php-cs-fixer and rector/rector; ignores .php-cs-fixer.cache.
New API method
src/Iterables.php
Adds public static function filter(iterable $iterable, callable $callback): \Generator which iterates input and yields only entries where callback(value, key) === true, preserving original keys and values.
Added test suites
tests/FilterTest.php, tests/FirstTest.php, tests/IsEmptyTest.php, tests/IsNotEmptyTest.php, tests/KeysTest.php, tests/MapTest.php, tests/MapWithKeysTest.php, tests/TestCase.php
Adds comprehensive unit tests covering filter (strict-true semantics), first, isEmpty, isNotEmpty, keys, map, and mapWithKeys across arrays, generators, ArrayObject/ArrayIterator, mixed keys/values, and edge cases; small test file formatting change.
Removed legacy tests
tests/IterablesTest.php
Deletes previous consolidated test file for mapping, emptiness checks, first, and keys.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant Filter as Iterables::filter
  participant CB as callback(value, key)

  Caller->>Filter: filter(iterable, callback)
  loop for each key,value in iterable
    Filter->>CB: invoke(value, key)
    alt returns === true
      Note right of Filter #E6F7FF: yield preserved key => value
      Filter-->>Caller: yield key => value
    else
      Note right of Filter #FFF3E6: skip entry
    end
  end
  Filter-->>Caller: complete Generator
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is missing and does not describe any part of the changeset, leaving reviewers without a summary of the modifications. Please provide a brief description summarizing the added filter method, the CI workflow update, and the restructuring and additional edge-case tests to aid reviewer understanding.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title “Add filter method, split tests & add more edge cases” accurately summarizes the primary feature addition of the filter method and the restructuring and expansion of test cases without extraneous detail, making it clear and concise.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c28add9 and b456ab7.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • .github/workflows/code-style.yaml (1 hunks)
  • .gitignore (1 hunks)
  • .php-cs-fixer.php (1 hunks)
  • composer.json (1 hunks)
  • rector.php (1 hunks)
  • src/Iterables.php (2 hunks)
  • tests/FilterTest.php (1 hunks)
  • tests/FirstTest.php (1 hunks)
  • tests/IsEmptyTest.php (1 hunks)
  • tests/IsNotEmptyTest.php (1 hunks)
  • tests/KeysTest.php (1 hunks)
  • tests/MapTest.php (1 hunks)
  • tests/MapWithKeysTest.php (1 hunks)
  • tests/TestCase.php (1 hunks)

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

@coveralls
Copy link
Collaborator

coveralls commented Oct 6, 2025

Pull Request Test Coverage Report for Build 18282606420

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 18270453806: 0.0%
Covered Lines: 23
Relevant Lines: 23

💛 - Coveralls

Copy link

@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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/phpunit.yaml (1)

46-46: Update Coveralls carryforward for new matrix flag

Include phpunit-8.5 so the finish step considers all jobs.

-          carryforward: "phpunit-8.1,phpunit-8.2,phpunit-8.3,phpunit-8.4"
+          carryforward: "phpunit-8.1,phpunit-8.2,phpunit-8.3,phpunit-8.4,phpunit-8.5"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee513ac and 4ad86ca.

📒 Files selected for processing (10)
  • .github/workflows/phpunit.yaml (1 hunks)
  • src/Iterables.php (1 hunks)
  • tests/FilterTest.php (1 hunks)
  • tests/FirstTest.php (1 hunks)
  • tests/IsEmptyTest.php (1 hunks)
  • tests/IsNotEmptyTest.php (1 hunks)
  • tests/IterablesTest.php (0 hunks)
  • tests/KeysTest.php (1 hunks)
  • tests/MapTest.php (1 hunks)
  • tests/MapWithKeysTest.php (1 hunks)
💤 Files with no reviewable changes (1)
  • tests/IterablesTest.php
🧰 Additional context used
🧬 Code graph analysis (7)
tests/IsEmptyTest.php (3)
src/Iterables.php (2)
  • Iterables (7-115)
  • isEmpty (65-72)
tests/TestCase.php (1)
  • TestCase (7-10)
tests/IsNotEmptyTest.php (6)
  • itHandlesEmptyGenerator (70-78)
  • itHandlesNonEmptyGenerator (83-90)
  • itHandlesEmptyArrayObject (95-99)
  • itHandlesNonEmptyArrayObject (104-108)
  • itHandlesArrayIterator (113-120)
  • itHandlesSingleElementIterables (125-130)
tests/MapTest.php (1)
src/Iterables.php (2)
  • Iterables (7-115)
  • map (19-24)
tests/IsNotEmptyTest.php (2)
src/Iterables.php (2)
  • Iterables (7-115)
  • isNotEmpty (79-82)
tests/IsEmptyTest.php (6)
  • itHandlesEmptyGenerator (70-78)
  • itHandlesNonEmptyGenerator (83-90)
  • itHandlesEmptyArrayObject (95-99)
  • itHandlesNonEmptyArrayObject (104-108)
  • itHandlesArrayIterator (113-120)
  • itHandlesSingleElementIterables (125-130)
tests/FilterTest.php (1)
src/Iterables.php (2)
  • Iterables (7-115)
  • filter (107-114)
tests/MapWithKeysTest.php (1)
src/Iterables.php (2)
  • Iterables (7-115)
  • mapWithKeys (37-42)
tests/KeysTest.php (2)
src/Iterables.php (2)
  • Iterables (7-115)
  • keys (91-96)
tests/TestCase.php (1)
  • TestCase (7-10)
tests/FirstTest.php (2)
src/Iterables.php (2)
  • Iterables (7-115)
  • first (51-58)
tests/TestCase.php (1)
  • TestCase (7-10)
🪛 PHPMD (2.15.0)
tests/IsEmptyTest.php

9-131: The class IsEmptyTest has 12 public methods. Consider refactoring IsEmptyTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


16-16: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsIfIterableIsEmpty'. (undefined)

(StaticAccess)


17-17: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsIfIterableIsEmpty'. (undefined)

(StaticAccess)


25-25: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForEmptyArrayWithMixedKeys'. (undefined)

(StaticAccess)


26-26: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForEmptyArrayWithMixedKeys'. (undefined)

(StaticAccess)


34-34: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithNullValue'. (undefined)

(StaticAccess)


35-35: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithNullValue'. (undefined)

(StaticAccess)


43-43: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithFalsyValues'. (undefined)

(StaticAccess)


44-44: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithFalsyValues'. (undefined)

(StaticAccess)


45-45: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithFalsyValues'. (undefined)

(StaticAccess)


46-46: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithFalsyValues'. (undefined)

(StaticAccess)


54-54: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithStringKeys'. (undefined)

(StaticAccess)


55-55: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithStringKeys'. (undefined)

(StaticAccess)


63-63: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithNumericKeys'. (undefined)

(StaticAccess)


64-64: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForArrayWithNumericKeys'. (undefined)

(StaticAccess)


77-77: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesEmptyGenerator'. (undefined)

(StaticAccess)


89-89: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesNonEmptyGenerator'. (undefined)

(StaticAccess)


97-97: Missing class import via use statement (line '97', column '33'). (undefined)

(MissingImport)


98-98: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesEmptyArrayObject'. (undefined)

(StaticAccess)


106-106: Missing class import via use statement (line '106', column '28'). (undefined)

(MissingImport)


107-107: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesNonEmptyArrayObject'. (undefined)

(StaticAccess)


115-115: Missing class import via use statement (line '115', column '30'). (undefined)

(MissingImport)


116-116: Missing class import via use statement (line '116', column '33'). (undefined)

(MissingImport)


118-118: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesArrayIterator'. (undefined)

(StaticAccess)


119-119: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesArrayIterator'. (undefined)

(StaticAccess)


127-127: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesSingleElementIterables'. (undefined)

(StaticAccess)


128-128: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesSingleElementIterables'. (undefined)

(StaticAccess)


129-129: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesSingleElementIterables'. (undefined)

(StaticAccess)

tests/MapTest.php

9-167: The class MapTest has 11 public methods. Consider refactoring MapTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


16-19: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsIterableViaGivenCallback'. (undefined)

(StaticAccess)


29-32: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsEmptyIterable'. (undefined)

(StaticAccess)


31-31: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


42-45: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsSingleElementIterable'. (undefined)

(StaticAccess)


55-58: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithNullValues'. (undefined)

(StaticAccess)


68-71: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithMixedTypes'. (undefined)

(StaticAccess)


81-84: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithStringKeys'. (undefined)

(StaticAccess)


94-97: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithNumericKeys'. (undefined)

(StaticAccess)


113-116: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsGenerator'. (undefined)

(StaticAccess)


126-126: Missing class import via use statement (line '126', column '28'). (undefined)

(MissingImport)


128-131: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsArrayObject'. (undefined)

(StaticAccess)


141-144: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithCallbackUsingBothValueAndKey'. (undefined)

(StaticAccess)


160-163: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsPreservingOriginalKeys'. (undefined)

(StaticAccess)

tests/IsNotEmptyTest.php

9-141: The class IsNotEmptyTest has 13 public methods. Consider refactoring IsNotEmptyTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


16-16: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsIfIterableIsNotEmpty'. (undefined)

(StaticAccess)


17-17: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsIfIterableIsNotEmpty'. (undefined)

(StaticAccess)


25-25: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForEmptyArrayWithMixedKeys'. (undefined)

(StaticAccess)


26-26: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalseForEmptyArrayWithMixedKeys'. (undefined)

(StaticAccess)


34-34: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithNullValue'. (undefined)

(StaticAccess)


35-35: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithNullValue'. (undefined)

(StaticAccess)


43-43: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithFalsyValues'. (undefined)

(StaticAccess)


44-44: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithFalsyValues'. (undefined)

(StaticAccess)


45-45: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithFalsyValues'. (undefined)

(StaticAccess)


46-46: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithFalsyValues'. (undefined)

(StaticAccess)


54-54: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithStringKeys'. (undefined)

(StaticAccess)


55-55: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithStringKeys'. (undefined)

(StaticAccess)


63-63: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithNumericKeys'. (undefined)

(StaticAccess)


64-64: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsTrueForArrayWithNumericKeys'. (undefined)

(StaticAccess)


77-77: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesEmptyGenerator'. (undefined)

(StaticAccess)


89-89: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesNonEmptyGenerator'. (undefined)

(StaticAccess)


97-97: Missing class import via use statement (line '97', column '33'). (undefined)

(MissingImport)


98-98: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesEmptyArrayObject'. (undefined)

(StaticAccess)


106-106: Missing class import via use statement (line '106', column '28'). (undefined)

(MissingImport)


107-107: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesNonEmptyArrayObject'. (undefined)

(StaticAccess)


115-115: Missing class import via use statement (line '115', column '30'). (undefined)

(MissingImport)


116-116: Missing class import via use statement (line '116', column '33'). (undefined)

(MissingImport)


118-118: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesArrayIterator'. (undefined)

(StaticAccess)


119-119: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesArrayIterator'. (undefined)

(StaticAccess)


127-127: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesSingleElementIterables'. (undefined)

(StaticAccess)


128-128: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesSingleElementIterables'. (undefined)

(StaticAccess)


129-129: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesSingleElementIterables'. (undefined)

(StaticAccess)


137-137: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesMultipleElementIterables'. (undefined)

(StaticAccess)


138-138: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesMultipleElementIterables'. (undefined)

(StaticAccess)


139-139: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itHandlesMultipleElementIterables'. (undefined)

(StaticAccess)

tests/FilterTest.php

9-187: The class FilterTest has 13 public methods. Consider refactoring FilterTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


16-19: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersIterableWithCallback'. (undefined)

(StaticAccess)


29-32: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersEmptyIterable'. (undefined)

(StaticAccess)


31-31: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


42-45: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithNoMatches'. (undefined)

(StaticAccess)


55-58: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithAllMatches'. (undefined)

(StaticAccess)


57-57: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


68-71: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithNullValues'. (undefined)

(StaticAccess)


81-84: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithMixedTypes'. (undefined)

(StaticAccess)


94-97: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithKeyBasedCallback'. (undefined)

(StaticAccess)


96-96: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


107-110: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithStrictBooleanCheck'. (undefined)

(StaticAccess)


120-123: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithCallbackReturningNonBoolean'. (undefined)

(StaticAccess)


133-136: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersWithCallbackReturningTruthyButNotTrue'. (undefined)

(StaticAccess)


146-149: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersStringKeys'. (undefined)

(StaticAccess)


148-148: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


165-168: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersGenerator'. (undefined)

(StaticAccess)


178-178: Missing class import via use statement (line '178', column '28'). (undefined)

(MissingImport)


180-183: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itFiltersArrayObject'. (undefined)

(StaticAccess)

tests/MapWithKeysTest.php

9-204: The class MapWithKeysTest has 12 public methods. Consider refactoring MapWithKeysTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


16-21: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsIterableWithKeysViaGivenCallable'. (undefined)

(StaticAccess)


31-34: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsEmptyIterable'. (undefined)

(StaticAccess)


33-33: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


44-47: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsSingleElementIterable'. (undefined)

(StaticAccess)


57-64: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithMultipleKeysPerElement'. (undefined)

(StaticAccess)


74-79: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithNullValues'. (undefined)

(StaticAccess)


89-94: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithMixedTypes'. (undefined)

(StaticAccess)


104-110: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithOriginalKeys'. (undefined)

(StaticAccess)


129-134: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithNumericKeys'. (undefined)

(StaticAccess)


149-154: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsGenerator'. (undefined)

(StaticAccess)


164-164: Missing class import via use statement (line '164', column '28'). (undefined)

(MissingImport)


166-171: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsArrayObject'. (undefined)

(StaticAccess)


181-184: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithEmptyArrayReturned'. (undefined)

(StaticAccess)


183-183: Avoid unused parameters such as '$value'. (undefined)

(UnusedFormalParameter)


194-199: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itMapsWithOverlappingKeys'. (undefined)

(StaticAccess)

tests/KeysTest.php

9-203: The class KeysTest has 17 public methods. Consider refactoring KeysTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


16-19: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsKeys'. (undefined)

(StaticAccess)


29-29: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsEmptyArrayForEmptyIterable'. (undefined)

(StaticAccess)


38-38: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsSingleKey'. (undefined)

(StaticAccess)


41-41: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsSingleKey'. (undefined)

(StaticAccess)


50-50: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsNumericKeys'. (undefined)

(StaticAccess)


53-53: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsNumericKeys'. (undefined)

(StaticAccess)


62-62: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsNegativeNumericKeys'. (undefined)

(StaticAccess)


71-71: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsStringKeys'. (undefined)

(StaticAccess)


80-80: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsEmptyStringKey'. (undefined)

(StaticAccess)


89-89: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsMixedKeyTypes'. (undefined)

(StaticAccess)


98-98: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsKeysWithNullValues'. (undefined)

(StaticAccess)


107-113: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsKeysWithFalsyValues'. (undefined)

(StaticAccess)


129-129: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsKeysFromGenerator'. (undefined)

(StaticAccess)


143-143: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsEmptyForEmptyGenerator'. (undefined)

(StaticAccess)


152-152: Missing class import via use statement (line '152', column '28'). (undefined)

(MissingImport)


153-153: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsKeysFromArrayObject'. (undefined)

(StaticAccess)


162-162: Missing class import via use statement (line '162', column '33'). (undefined)

(MissingImport)


163-163: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsEmptyForEmptyArrayObject'. (undefined)

(StaticAccess)


172-172: Missing class import via use statement (line '172', column '25'). (undefined)

(MissingImport)


173-173: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsKeysFromArrayIterator'. (undefined)

(StaticAccess)


183-183: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itPreservesKeyOrder'. (undefined)

(StaticAccess)


186-186: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itPreservesKeyOrder'. (undefined)

(StaticAccess)


195-199: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsKeysWithComplexValues'. (undefined)

(StaticAccess)


197-197: Missing class import via use statement (line '197', column '29'). (undefined)

(MissingImport)

tests/FirstTest.php

9-148: The class FirstTest has 13 public methods. Consider refactoring FirstTest to keep number of public methods under 10. (undefined)

(TooManyPublicMethods)


18-18: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueInIterable'. (undefined)

(StaticAccess)


27-27: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsNullIfIterableIsEmptyWhileGettingFirstValue'. (undefined)

(StaticAccess)


35-35: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromSingleElementIterable'. (undefined)

(StaticAccess)


36-36: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromSingleElementIterable'. (undefined)

(StaticAccess)


37-37: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromSingleElementIterable'. (undefined)

(StaticAccess)


45-45: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsNullAsFirstValue'. (undefined)

(StaticAccess)


46-46: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsNullAsFirstValue'. (undefined)

(StaticAccess)


54-54: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalsyValuesAsFirst'. (undefined)

(StaticAccess)


55-55: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalsyValuesAsFirst'. (undefined)

(StaticAccess)


56-56: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalsyValuesAsFirst'. (undefined)

(StaticAccess)


57-57: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFalsyValuesAsFirst'. (undefined)

(StaticAccess)


65-65: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueWithStringKeys'. (undefined)

(StaticAccess)


66-66: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueWithStringKeys'. (undefined)

(StaticAccess)


74-74: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueWithNumericKeys'. (undefined)

(StaticAccess)


75-75: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueWithNumericKeys'. (undefined)

(StaticAccess)


89-89: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromGenerator'. (undefined)

(StaticAccess)


102-102: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsNullFromEmptyGenerator'. (undefined)

(StaticAccess)


110-110: Missing class import via use statement (line '110', column '28'). (undefined)

(MissingImport)


111-111: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromArrayObject'. (undefined)

(StaticAccess)


113-113: Missing class import via use statement (line '113', column '33'). (undefined)

(MissingImport)


114-114: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromArrayObject'. (undefined)

(StaticAccess)


122-122: Missing class import via use statement (line '122', column '25'). (undefined)

(MissingImport)


123-123: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromArrayIterator'. (undefined)

(StaticAccess)


125-125: Missing class import via use statement (line '125', column '30'). (undefined)

(MissingImport)


126-126: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueFromArrayIterator'. (undefined)

(StaticAccess)


134-134: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueWithMixedTypes'. (undefined)

(StaticAccess)


135-135: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueWithMixedTypes'. (undefined)

(StaticAccess)


136-136: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueWithMixedTypes'. (undefined)

(StaticAccess)


145-145: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueRegardlessOfKeyOrder'. (undefined)

(StaticAccess)


146-146: Avoid using static access to class '\Bonu\Iterable\Iterables' in method 'itReturnsFirstValueRegardlessOfKeyOrder'. (undefined)

(StaticAccess)

🪛 YAMLlint (1.37.1)
.github/workflows/phpunit.yaml

[error] 14-14: too many spaces inside brackets

(brackets)


[error] 14-14: too many spaces inside brackets

(brackets)

🔇 Additional comments (5)
tests/KeysTest.php (1)

1-203: Comprehensive coverage for keys() — looks good

Scenarios are thorough and align with implementation.

tests/FirstTest.php (1)

1-148: Excellent test coverage for Iterables::first().

This test suite comprehensively validates the first() method across diverse scenarios including empty inputs, falsy values, null handling, various key types, and different iterable implementations. The edge case coverage is thorough and well-structured.

tests/MapTest.php (1)

1-167: Excellent test coverage for Iterables::map().

This test suite thoroughly validates the map() method including key preservation, value transformation with various callback types, and proper handling of different iterable implementations. The tests appropriately verify that both value and key are passed to callbacks.

tests/MapWithKeysTest.php (1)

1-204: Excellent test coverage for Iterables::mapWithKeys().

This test suite comprehensively validates the mapWithKeys() method including multiple keys per input element, empty array handling, and overlapping key behavior (where later values correctly overwrite earlier ones). The test coverage properly exercises the yield from implementation.

tests/FilterTest.php (1)

1-187: Excellent test coverage for Iterables::filter() with proper strict comparison validation.

This test suite comprehensively validates the filter() method including the critical strict === true comparison behavior. The tests at lines 118-126 and 131-139 properly verify that only callbacks returning exactly true will include elements, not truthy values or integers. This ensures the filter implementation's type safety is well-tested.

@MatusBoa MatusBoa changed the title Add filter method, split tests & add more edge cases Add filter method, split tests & add more edge cases, code style Oct 6, 2025
@MatusBoa MatusBoa merged commit 3c39dba into main Oct 6, 2025
12 of 14 checks passed
@MatusBoa MatusBoa deleted the feat-filter branch October 6, 2025 13:34
@coderabbitai coderabbitai bot mentioned this pull request Oct 6, 2025
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.

3 participants