Skip to content

Fix properties with hooks#567

Merged
Tigrov merged 10 commits intomasterfrom
fix-hooks
May 3, 2026
Merged

Fix properties with hooks#567
Tigrov merged 10 commits intomasterfrom
fix-hooks

Conversation

@Tigrov
Copy link
Copy Markdown
Member

@Tigrov Tigrov commented May 2, 2026

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixed issues #525

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 42658344-0261-4f5c-9c32-a740359f4fef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-hooks

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@Tigrov Tigrov requested a review from Copilot May 2, 2026 04:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an infinite recursion that can occur with PHP property hooks (e.g., relation properties implemented via get hooks) by changing how ActiveRecord reads raw property values, and adds regression coverage.

Changes:

  • Switch ActiveRecord::propertyValuesInternal() from get_object_vars() to a new ArArrayHelper::propertyValues() implementation based on (array)$object casting.
  • Add a stub model property hook for a relation (Item::$category) and a regression test covering relation access/mutation through the hook.
  • Simplify PrivatePropertiesTrait by removing its propertyValuesInternal() override.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Stubs/ActiveRecord/Item.php Adds a relation defined via a property hook (category) to reproduce the hook scenario.
tests/ActiveRecordTest.php Adds a regression test validating relation access/assignment through the property hook.
src/Trait/PrivatePropertiesTrait.php Removes the now-unneeded propertyValuesInternal() override (but leaves an unused import).
src/Internal/ArArrayHelper.php Adds propertyValues() helper to extract raw object properties without triggering hooks.
src/ActiveRecord.php Uses the new helper for propertyValuesInternal() to avoid hook-triggered recursion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Trait/PrivatePropertiesTrait.php
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (83d557a) to head (12b6631).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master      #567   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       656       658    +2     
===========================================
  Files             43        43           
  Lines           1626      1638   +12     
===========================================
+ Hits            1626      1638   +12     

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

@Tigrov Tigrov added the status:code review The pull request needs review. label May 2, 2026
@Tigrov Tigrov requested review from a team and Copilot May 2, 2026 09:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Stubs/ActiveRecord/ItemWithProperyHooks.php Outdated
Comment thread tests/ActiveRecordTest.php Outdated
Comment thread CHANGELOG.md
Comment thread src/Internal/ArArrayHelper.php
Tigrov added 2 commits May 3, 2026 15:24
# Conflicts:
#	tests/ActiveRecordTest.php
@Tigrov Tigrov merged commit 2ebdf1b into master May 3, 2026
46 of 47 checks passed
@Tigrov Tigrov deleted the fix-hooks branch May 3, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants