Skip to content

Document that StringCase is unused internally#92

Open
koriym wants to merge 1 commit into1.xfrom
deprecate-string-case
Open

Document that StringCase is unused internally#92
koriym wants to merge 1 commit into1.xfrom
deprecate-string-case

Conversation

@koriym
Copy link
Copy Markdown
Member

@koriym koriym commented May 7, 2026

Summary

StringCase was added in 1.0.0-rc1 as a replacement for the removed CamelCaseTrait, but neither hydration path actually uses it:

  • FetchClass uses PDO::FETCH_CLASS (column name = property name; no conversion)
  • FetchNewInstance uses PDO::FETCH_FUNC with positional binding (column name irrelevant)

grep StringCase:: src/ returns zero hits across the entire git history of src/. The class has effectively been dead code since it shipped.

This PR adds a class-level PHPDoc note explaining the situation and flagging the class as a candidate for removal in a future major release. No behavioral change.

Test plan

  • ./vendor/bin/phpunit --no-coverage tests/StringCaseTest.php passes
  • ./vendor/bin/phpcs --standard=PSR12 src/StringCase.php passes

Related

Surfaced while reviewing the Ray.MediaQuery 1.0 docs (bearsunday/bearsunday.github.io#348), which incorrectly described an "automatic snake_case → camelCase conversion" that does not exist.

Summary by CodeRabbit

  • Documentation
    • Updated documentation for the StringCase utility class with additional context and historical information.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

Warning

Rate limit exceeded

@koriym has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 16 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 691fa766-083b-4930-bf58-1dc36ce3aa37

📥 Commits

Reviewing files that changed from the base of the PR and between 51b0ae5 and 9307894.

📒 Files selected for processing (1)
  • src/StringCase.php
📝 Walkthrough

Walkthrough

A docblock comment was added to the StringCase class in src/StringCase.php. The documentation describes the utility's purpose for converting between snake_case and camelCase formats, its history as a replacement for CamelCaseTrait, and clarifies that while it is not currently used by the library's hydration paths, it remains available as a public API.

Changes

Documentation Addition

Layer / File(s) Summary
Class Documentation
src/StringCase.php
Docblock added to StringCase class documenting conversion utility purpose, historical context as CamelCaseTrait replacement, and clarifying non-usage in current hydration while remaining as public API.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops through docblocks bright,
Where StringCase stands in careful light—
From camelCase to snake it bends,
With documented purpose, history commends! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding documentation to the StringCase class to clarify it is unused internally.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deprecate-string-case

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.

Copy link
Copy Markdown
Contributor

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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/StringCase.php`:
- Around line 16-19: The docblock claiming StringCase is unused conflicts with
the hydration contract; update code or docs so they match: either implement
snake_case→camelCase conversion using the StringCase utility in the hydration
paths (locations using FetchClass / FetchNewInstance and PDO::FETCH_CLASS /
PDO::FETCH_FUNC, and any hydrate() implementations) so StringCase (and the old
CamelCaseTrait) is actually applied during entity hydration, or modify this
docblock to remove the claim that StringCase is unused and explicitly document
that hydration relies on StringCase per the coding guideline; ensure references
to StringCase, CamelCaseTrait, FetchClass, FetchNewInstance, and the hydrate
flow are consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e1cbcd74-6662-469c-8c12-c0f992cae844

📥 Commits

Reviewing files that changed from the base of the PR and between 507d1ef and 51b0ae5.

📒 Files selected for processing (1)
  • src/StringCase.php

Comment thread src/StringCase.php Outdated
Comment on lines +16 to +19
* 1.0.0-rc1 で `CamelCaseTrait` の代替として追加されたが、現在の hydrate 経路
* (`FetchClass` の `PDO::FETCH_CLASS` と `FetchNewInstance` の `PDO::FETCH_FUNC`)
* はいずれも列名→プロパティ名の変換を行わないため、ライブラリ内部からは利用されていない。
* 公開APIとして残しているだけで、将来のメジャーリリースで削除する可能性がある。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Documentation conflicts with the repository hydration contract.

This docblock states hydration does not perform snake_case→camelCase conversion and that StringCase is effectively dead, which contradicts the project rule that hydration should use StringCase conversion. Please reconcile this by either implementing the documented guideline in hydration paths or updating the guideline/spec before merging this statement.

As per coding guidelines, "Use snake_case to camelCase conversion via StringCase utility for entity hydration".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/StringCase.php` around lines 16 - 19, The docblock claiming StringCase is
unused conflicts with the hydration contract; update code or docs so they match:
either implement snake_case→camelCase conversion using the StringCase utility in
the hydration paths (locations using FetchClass / FetchNewInstance and
PDO::FETCH_CLASS / PDO::FETCH_FUNC, and any hydrate() implementations) so
StringCase (and the old CamelCaseTrait) is actually applied during entity
hydration, or modify this docblock to remove the claim that StringCase is unused
and explicitly document that hydration relies on StringCase per the coding
guideline; ensure references to StringCase, CamelCaseTrait, FetchClass,
FetchNewInstance, and the hydrate flow are consistent.

@koriym koriym force-pushed the deprecate-string-case branch 2 times, most recently from 2865d52 to 465765a Compare May 7, 2026 06:50
StringCase was added in 1.0.0-rc1 as a replacement for the removed
CamelCaseTrait, but neither hydration path uses it. FetchClass relies
on PDO::FETCH_CLASS (column name = property name; no conversion) and
FetchNewInstance uses PDO::FETCH_FUNC with positional binding (column
name irrelevant). The class is kept only for backward compatibility.
@koriym koriym force-pushed the deprecate-string-case branch from 465765a to 9307894 Compare May 7, 2026 06:52
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