Skip to content

Change/uncompress remove length #71

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 3 commits into from
May 19, 2025
Merged

Conversation

kjdev
Copy link
Owner

@kjdev kjdev commented May 19, 2025

Summary by CodeRabbit

  • Documentation
    • Updated documentation to remove references to the unused $length parameter in the brotli_uncompress function.
  • Bug Fixes
    • Simplified the brotli_uncompress and Brotli\uncompress function signatures by removing the unused $length parameter.
  • Tests
    • Updated tests to match the new function signatures and removed test cases related to the removed $length parameter.

Copy link

coderabbitai bot commented May 19, 2025

Walkthrough

The changes remove the optional $length parameter from the brotli_uncompress function and its Brotli namespace variant, simplifying their signatures to accept only the compressed data and an optional dictionary. Documentation, stubs, implementation, and tests are updated to reflect this change, eliminating all usage and references to the $length parameter.

Changes

File(s) Change Summary
README.md, brotli.stub.php Updated documentation and function stubs to remove the $length parameter from brotli_uncompress and Brotli\uncompress signatures.
brotli.c Removed the $length parameter from the implementation and argument parsing of brotli_uncompress. Logic using this parameter was deleted.
tests/dictionary_args.phpt,
tests/dictionary_basic.phpt,
tests/dictionary_incremental.phpt,
tests/dictionary_streams.phpt
Updated test calls to brotli_uncompress and Brotli\uncompress to remove the $length argument, passing only data and dictionary.
tests/dictionary_named_args.phpt,
tests/named_args.phpt
Removed test cases involving the length: named argument for brotli_uncompress.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BrotliExtension

    User->>BrotliExtension: brotli_uncompress(data, dict?)
    BrotliExtension->>BrotliExtension: Decompress data using optional dict
    BrotliExtension-->>User: Return decompressed string or false
Loading

Poem

In the warren of code, a carrot was found,
The length parameter hopped right out of town!
Now decompression’s simple, just data and dict,
No more counting bytes—oh, what a neat trick!
The tests all agree, with a jubilant cheer,
Cleaner and leaner, the code’s crystal clear!
🥕✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between c95295d and 4ea67bf.

📒 Files selected for processing (9)
  • README.md (2 hunks)
  • brotli.c (1 hunks)
  • brotli.stub.php (2 hunks)
  • tests/dictionary_args.phpt (1 hunks)
  • tests/dictionary_basic.phpt (1 hunks)
  • tests/dictionary_incremental.phpt (1 hunks)
  • tests/dictionary_named_args.phpt (0 hunks)
  • tests/dictionary_streams.phpt (1 hunks)
  • tests/named_args.phpt (0 hunks)
💤 Files with no reviewable changes (2)
  • tests/named_args.phpt
  • tests/dictionary_named_args.phpt
🧰 Additional context used
🧬 Code Graph Analysis (1)
brotli.stub.php (1)
brotli.c (1)
  • brotli_uncompress (1662-1713)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.0-alpine, ghcr.io/kjdev/php, linux/amd64)
  • GitHub Check: ci (7.3-alpine, ghcr.io/kjdev/php, linux/amd64)
🔇 Additional comments (11)
tests/dictionary_incremental.phpt (1)

29-29: Function signature update correctly applied.

The brotli_uncompress call has been properly updated to reflect the removal of the unused $length parameter, now directly passing the dictionary as the second argument.

tests/dictionary_streams.phpt (1)

33-33: Function signature update correctly applied.

The brotli_uncompress call has been properly updated to reflect the removal of the unused $length parameter, now directly passing the dictionary as the second argument.

tests/dictionary_args.phpt (1)

33-33: Function signature update correctly applied.

The brotli_uncompress call inside the conditional expression has been properly updated to reflect the removal of the unused $length parameter, now correctly passing the dictionary as the second argument.

brotli.stub.php (3)

74-74: API signature simplification aligns with implementation.

The removal of the unused $length parameter from the brotli_uncompress function signature properly aligns the stub declaration with the actual C implementation, which never used this parameter.


101-101: API signature simplification aligns with implementation.

The removal of the unused $length parameter from the Brotli\uncompress function signature properly aligns the stub declaration with the actual C implementation, which never used this parameter.


1-137:

✅ Verification successful

Verify that all API documentation has been updated.

The signature changes look good, but it's important to make sure that any API documentation (like the README.md) is also updated to reflect the removal of the $length parameter from both brotli_uncompress and Brotli\uncompress functions.


🏁 Script executed:

#!/bin/bash
# Check if README.md or other documentation mentions the removed length parameter

echo "Checking for any remaining references to length parameter in documentation:"
rg -i "uncompress.*length|length.*uncompress" --type md

Length of output: 218


🏁 Script executed:

#!/bin/bash
echo "Searching for any references to the removed \$length parameter or brotli_uncompress in documentation files"

# Search markdown and reStructuredText docs for function names
rg -n "brotli_uncompress" -g "*.md" -g "*.rst" || true
rg -n "Brotli\\\uncompress" -g "*.md" -g "*.rst" || true

# Search for standalone mentions of "length" in docs, which may indicate outdated parameter docs
rg -n "length" -g "*.md" -g "*.rst" || true

Length of output: 1583


Documentation Updated: No Remaining References to the Removed $length Parameter

I’ve checked all occurrences in the README and other docs—every brotli_uncompress and Brotli\uncompress signature and example has been updated to remove the $length parameter, and there are no stray “length” mentions in the markdown or reStructuredText files.

No further documentation changes are needed.

tests/dictionary_basic.phpt (2)

20-23: Code simplification looks good

The function calls have been properly updated to match the new brotli_uncompress and \Brotli\uncompress signatures after the removal of the $length parameter. The dictionary is now passed directly as the second parameter, which improves readability.


27-28: Function signature update correctly applied

The test cases with a non-functional 'dictionary' string are correctly updated to pass the string directly as the second parameter, maintaining the test coverage for invalid dictionary scenarios.

brotli.c (1)

1669-1673: Function parameter parsing properly updated

The parameter parsing has been correctly updated to accept 1-2 parameters instead of the previous 1-3, removing the optional $length parameter. The function now only accepts the compressed data and an optional dictionary.

README.md (2)

141-142: Documentation correctly updated for brotli_uncompress

The function signature in the documentation has been properly updated to reflect the removal of the $length parameter, maintaining consistency between the code and documentation.


288-288: Documentation correctly updated for \Brotli\uncompress

The namespace function signature documentation has been properly updated to reflect the removal of the $length parameter, maintaining consistency with the procedural function changes.

✨ 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.

@kjdev
Copy link
Owner Author

kjdev commented May 19, 2025

@coderabbitai review

Copy link

coderabbitai bot commented May 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kjdev kjdev merged commit 4ea67bf into master May 19, 2025
92 of 156 checks passed
@kjdev kjdev deleted the change/uncompress-remove-length branch May 19, 2025 22:01
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