Skip to content

The "withHeader" method expects the type "string|iterable", "int" is passed #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2025

Conversation

xav-developer
Copy link
Contributor

@xav-developer xav-developer commented Jun 10, 2025

Description

The "withHeader" method of the "\Spiral\RoadRunner\Jobs\Task\WritableHeadersInterface" interface expects the type "string|iterable", "int" is passed

Fixes # (issue)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I wrote unit tests for my code (if tests is required for my changes)
  • I have made changes in CHANGELOG.md file

Summary by CodeRabbit

  • Bug Fixes
    • Corrected the handling of the "attempts" header to ensure the value is properly incremented and formatted, preventing type errors.
  • Documentation
    • Updated the changelog to reflect the fix related to the "attempts" header issue.

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
xav-developer Alexander
…HeadersInterface" interface expects the type "string|iterable", "int" is passed

Verified

This commit was signed with the committer’s verified signature.
xav-developer Alexander
…HeadersInterface" interface expects the type "string|iterable", "int" is passed
Copy link

coderabbitai bot commented Jun 10, 2025

Walkthrough

A new entry was added to the changelog documenting a fix for the withHeader method argument type in the WritableHeadersInterface. The RoadRunnerJob class was updated to increment and cast the "attempts" header value as a string before passing it to withHeader in the failed method.

Changes

File(s) Change Summary
CHANGELOG.md Added a "Fixed" section noting the correction of argument type for withHeader method.
src/Queue/RoadRunnerJob.php Updated header increment logic to pre-increment and explicitly cast "attempts" to string.

Poem

A bug with headers, now set right,
Attempts now stringed, not just in spite!
The changelog sings of fixes made,
In RoadRunner’s queue, no mistakes parade.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sorry, something went wrong.

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: 0

🧹 Nitpick comments (1)
CHANGELOG.md (1)

7-10: Fix markdown heading structure and approve changelog entry.

The changelog entry accurately documents the type safety fix. However, there's a markdown formatting issue where the heading level jumps directly to h3.

Apply this diff to fix the markdown structure:

+## Unreleased
+
 ### Fixed

- The "withHeader" method of the "\Spiral\RoadRunner\Jobs\Task\WritableHeadersInterface" interface expects the type "string|iterable", "int" is passed
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

7-7: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2207f31 and 4889d7f.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • src/Queue/RoadRunnerJob.php (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CHANGELOG.md

7-7: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🔇 Additional comments (1)
src/Queue/RoadRunnerJob.php (1)

56-56: Excellent type safety fix!

The explicit string casting resolves the type mismatch issue where withHeader expects string|iterable but was receiving an int. The pre-increment with explicit casting maintains the same logical behavior while ensuring type correctness.

@butschster butschster self-assigned this Jun 10, 2025
@butschster butschster added the type:bug Something isn't working label Jun 10, 2025
@butschster butschster merged commit 8893e21 into roadrunner-php:master Jun 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants