Skip to content

Migrate to utopia-php/di 0.3#9

Merged
loks0n merged 2 commits intomainfrom
fix/utopia-di-0-3
Mar 13, 2026
Merged

Migrate to utopia-php/di 0.3#9
loks0n merged 2 commits intomainfrom
fix/utopia-di-0-3

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Mar 12, 2026

Summary

  • bump utopia-php/di to 0.3.* and align the package PHP requirement to >=8.2
  • migrate Base away from the removed Dependency / inject() API to the new scoped container API
  • refresh composer.lock for the dependency and platform changes

Testing

  • vendor/bin/phpunit
  • vendor/bin/phpstan analyse

Summary by CodeRabbit

  • Documentation

    • System requirements updated to require PHP 8.2 or later.
  • Dependencies

    • Dependency constraints updated to align with PHP 8.2 compatibility and newer library versions.
  • Refactor

    • Internal parameter handling and validation redesigned to use isolated runtime scope, improving reliability and predictability.

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aa27cd56-8058-4707-9de4-0e55afa454b1

📥 Commits

Reviewing files that changed from the base of the PR and between c7becb1 and 28cc9e7.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • src/Servers/Base.php

Walkthrough

This pull request updates system requirements in README.md from PHP 8.0 to PHP 8.2 and updates composer.json to require PHP >=8.2 and bump utopia-php/di from 0.1.* to 0.3.*. In src/Servers/Base.php the prepare/validation flow was refactored to create and use a dedicated local scope container for parameter injection, validation, and storage instead of mutating the passed context; callable validators are registered and retrieved via keys on that scope and prepare now returns the scope.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Migrate to utopia-php/di 0.3' accurately and concisely summarizes the primary change: upgrading the utopia-php/di dependency and adapting code to its new API.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/utopia-di-0-3
📝 Coding Plan
  • Generate coding plan for human review comments

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

@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 the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Line 30: Replace the generic project name in the compatibility line: change
"Utopia Framework requires PHP 8.2 or later." to explicitly reference this
package (e.g., "utopia-php/servers requires PHP 8.2 or later.") so the README
uses the package/library name instead of "Utopia Framework" (update the sentence
that currently contains "Utopia Framework requires PHP 8.2 or later" in
README.md).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: efc6be10-d562-4901-858c-08c1724b5227

📥 Commits

Reviewing files that changed from the base of the PR and between 4770e87 and 268b51c.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • README.md
  • composer.json
  • src/Servers/Base.php

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Servers/Base.php`:
- Line 269: Add a guarded internal prefix and reject param names that collide
with it: declare a constant (e.g., INTERNAL_VALIDATOR_PREFIX = '_validator:') in
the class and, at the point where params are registered (the code calling
$scope->set($key, fn () => $value, [])), validate the provided $key and
throw/return an error if it begins with that prefix; then continue to store
validators under the reserved prefixed id (use $validatorKey =
self::INTERNAL_VALIDATOR_PREFIX . $key where validators are set) so that param
keys and validator keys cannot silently overwrite each other via
Container::set().

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4454fafc-9fff-448a-b006-a7f21364828e

📥 Commits

Reviewing files that changed from the base of the PR and between 268b51c and c7becb1.

⛔ Files ignored due to path filters (1)
  • composer.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • README.md
  • composer.json
  • src/Servers/Base.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • README.md
  • composer.json

@loks0n loks0n merged commit 235be31 into main Mar 13, 2026
6 checks passed
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.

2 participants