-
-
Notifications
You must be signed in to change notification settings - Fork 27
Add doesntEndWith and doesntStartWith macros to Str and Stringable #874
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
Conversation
- Added doesntEndWith() macro to StrMixin that returns the inverse of endsWith() - Added doesntStartWith() macro to StrMixin that returns the inverse of startsWith() - Added doesntEndWith() macro to StringableMixin for fluent string operations - Added doesntStartWith() macro to StringableMixin for fluent string operations - Added comprehensive unit tests covering edge cases including empty strings and arrays - All tests pass and follow existing code patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Walkthrough此次变更新增了两份文档文件,分别为针对 Claude AI 的项目指导和修复 GitHub Issue 的操作指南。同时在 Changes
Sequence Diagram(s)sequenceDiagram
participant 调用者
participant StrMixin
participant StringableMixin
调用者->>StrMixin: doesntEndWith($haystack, $needles)
StrMixin->>Str: endsWith($haystack, $needles)
Str-->>StrMixin: bool
StrMixin-->>调用者: !endsWith 结果
调用者->>StrMixin: doesntStartWith($haystack, $needles)
StrMixin->>Str: startsWith($haystack, $needles)
Str-->>StrMixin: bool
StrMixin-->>调用者: !startsWith 结果
调用者->>StringableMixin: doesntEndWith($needles)
StringableMixin->>Stringable: endsWith($needles)
Stringable-->>StringableMixin: bool
StringableMixin-->>调用者: !endsWith 结果
调用者->>StringableMixin: doesntStartWith($needles)
StringableMixin->>Stringable: startsWith($needles)
Stringable-->>StringableMixin: bool
StringableMixin-->>调用者: !startsWith 结果
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.1.17)Note: Using configuration file /phpstan.neon.dist. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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 (4)
.claude/CLAUDE.md (2)
7-8: 项目规模描述建议使用更灵活的措辞
“40+ modular packages” 随时间推移容易失真,可改为“数十个”或“几十个”,避免日后维护成本。
107-112: 代码标准段落缺少 CS Fixer 规则来源说明
建议补充.php-cs-fixer.php所使用的规则集或链接,方便贡献者了解格式要求。.claude/commands/fix-github-issue.md (2)
1-2: 占位符变量不够直观
$ARGUMENTS未说明具体格式,例如 “issue-number” 还是 “owner/repo#number”。建议改为更明确的<ISSUE_NUMBER>并在开头给出示例。
8-10: 动词“implement”略口语,可替换为更正式表述
将 “Implement the necessary changes” 调整为 “Apply the necessary changes” 或 “Make the necessary modifications”,使语气与其余步骤保持一致。
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.claude/CLAUDE.md(1 hunks).claude/commands/fix-github-issue.md(1 hunks)src/macros/src/StrMixin.php(1 hunks)src/macros/src/StringableMixin.php(1 hunks)tests/Macros/StrTest.php(1 hunks)tests/Macros/StringableTest.php(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/macros/src/StrMixin.php (2)
src/macros/src/StringableMixin.php (2)
doesntEndWith(84-88)doesntStartWith(90-94)src/macros/output/Hyperf/Stringable/Str.php (1)
Str(14-70)
src/macros/src/StringableMixin.php (1)
src/macros/src/StrMixin.php (2)
doesntEndWith(76-81)doesntStartWith(83-88)
🪛 LanguageTool
.claude/commands/fix-github-issue.md
[style] ~8-~8: Consider using a different verb for a more formal wording.
Context: ...s 4. Implement the necessary changes to fix the issue 5. Write and run tests to ver...
(FIX_RESOLVE)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Test on PHP 8.2 with Swoole 5.1.7
- GitHub Check: Test on PHP 8.2 with Swoole 6.0.2
- GitHub Check: Test on PHP 8.1 with Swoole 5.1.7
- GitHub Check: Test on PHP 8.3 with Swoole 5.1.7
- GitHub Check: Test on PHP 8.1 with Swoole 6.0.2
- GitHub Check: Test on PHP 8.3 with Swoole 6.0.2
- GitHub Check: Test on PHP 8.1 with Swoole 5.1.7
- GitHub Check: Test on PHP 8.2 with Swoole 5.1.7
- GitHub Check: Test on PHP 8.3 with Swoole 5.1.7
🔇 Additional comments (5)
.claude/CLAUDE.md (1)
26-28: 脚本名称与常见约定不一致
多数团队使用composer analyze而不是composer analyse。若当前仓库脚本名为analyse没问题;若并不存在,将导致文档误导。请确认并保持一致。src/macros/src/StrMixin.php (1)
76-88: 实现正确,遵循了现有代码模式新增的
doesntEndWith和doesntStartWith方法实现正确,通过对现有Str::endsWith和Str::startsWith方法结果取反来提供逆向功能。方法签名和闭包结构与该类中其他方法保持一致。tests/Macros/StrTest.php (1)
68-86: 测试覆盖全面且实现正确新增的测试用例覆盖了各种场景,包括单个字符串、字符串数组、空字符串等边界情况。测试逻辑正确,断言清晰,与现有测试风格保持一致。
src/macros/src/StringableMixin.php (1)
84-94: Stringable 上下文的实现正确新增的方法正确地适配了 Stringable 对象上下文,使用
$this->endsWith()和$this->startsWith()实例方法而非静态方法。包含了必要的 PHPStan 忽略注释,与类中其他方法的模式保持一致。tests/Macros/StringableTest.php (1)
88-106: Stringable 对象的测试实现完整测试用例正确使用了
$this->stringable()辅助方法,提供了与StrTest相对应的测试覆盖。测试场景全面,包括各种边界情况,断言逻辑正确。
) - Added doesntEndWith() macro to StrMixin that returns the inverse of endsWith() - Added doesntStartWith() macro to StrMixin that returns the inverse of startsWith() - Added doesntEndWith() macro to StringableMixin for fluent string operations - Added doesntStartWith() macro to StringableMixin for fluent string operations - Added comprehensive unit tests covering edge cases including empty strings and arrays - All tests pass and follow existing code patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
🤖 Generated with Claude Code
Summary by CodeRabbit
新功能
文档
测试