Skip to content

Use array_key_exists instead of isset in Task::offsetExists#870

Open
norkunas wants to merge 1 commit intomeilisearch:mainfrom
norkunas:offsetExists
Open

Use array_key_exists instead of isset in Task::offsetExists#870
norkunas wants to merge 1 commit intomeilisearch:mainfrom
norkunas:offsetExists

Conversation

@norkunas
Copy link
Collaborator

@norkunas norkunas commented Feb 4, 2026

Pull Request

Related issue

Fixes #<issue_number>

What does this PR do?

  • Replaces isset with array_key_exists to respect null values

PR checklist

Please check if your PR fulfills the following requirements:

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of null-valued task properties so null entries are correctly recognized as present rather than missing, preventing incorrect control flow when task fields contain null.

@norkunas norkunas added the bug Something isn't working label Feb 4, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

The offsetExists method in src/Contracts/Task.php was changed to use array_key_exists($offset, $this->raw) instead of isset($this->raw[$offset]), so offset checks now distinguish between absent keys and keys explicitly set to null.

Changes

Cohort / File(s) Summary
ArrayAccess Method Update
src/Contracts/Task.php
Replaced isset($this->raw[$offset]) with array_key_exists($offset, $this->raw) in offsetExists to treat null values as existing keys.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop and a check, now more clear,
Keys with nulls no longer disappear,
array_key_exists sees what used to hide,
No phantom gaps where values reside,
I nibble bugs and bound with cheer! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change in the pull request: replacing isset with array_key_exists in Task::offsetExists.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.25%. Comparing base (0078a8c) to head (cdcac0f).
⚠️ Report is 118 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #870      +/-   ##
==========================================
- Coverage   89.78%   87.25%   -2.53%     
==========================================
  Files          59       81      +22     
  Lines        1449     1766     +317     
==========================================
+ Hits         1301     1541     +240     
- Misses        148      225      +77     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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