Use ->action(...)) instead of ->callback([$this, 'action']);#9967
Use ->action(...)) instead of ->callback([$this, 'action']);#9967
Conversation
📝 WalkthroughWalkthroughThis update refactors callback registrations throughout the codebase by replacing the traditional array callable syntax Changes
Sequence Diagram(s)sequenceDiagram
participant Request
participant HandlerClass
participant ActionMethod
Request->>HandlerClass: instantiate (constructor)
HandlerClass->>HandlerClass: register callback as $this->action(...)
Request->>HandlerClass: invoke callback
HandlerClass->>ActionMethod: execute action(...)
ActionMethod-->>Request: return result
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (57)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (55)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ 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
|
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php (1)
19-19: 💡 Verification agent🧩 Analysis chain
Verify Action class import.
The class extends
Actionbut I don't see the corresponding import statement in the file. Please ensureuse Utopia\Platform\Action;is included in the imports section.
🏁 Script executed:
#!/bin/bash # Search for Action import in this file and similar files to verify the pattern echo "Checking Action imports in similar files:" rg -A 5 -B 5 "class.*extends Action" src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/ echo -e "\nChecking if Action import exists in this file:" cat src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php | grep -n "use.*Action"Length of output: 2487
Add missing Action import in XList
The
XListclass extendsActionbut never imports it, leading to an undefined class error. Add the import below the existingusestatements:• File:
src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.phpuse Utopia\Platform\Scope\HTTP; +use Utopia\Platform\Action; class XList extends Action
🧹 Nitpick comments (1)
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php (1)
75-75: Verify PHP 8.1+ support in composer.json
First-class callables ($this->action(...)) require PHP 8.1 or newer. Confirm yourcomposer.json(and deployment targets) specify"php": "^8.1". If not, apply:--- composer.json +++ composer.json @@ -10,7 +10,7 @@ "require": { - "php": "^8.0", + "php": "^8.1", // other dependencies... },
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (95)
src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php(1 hunks)src/Appwrite/Platform/Modules/Functions/Workers/Builds.php(1 hunks)src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php(1 hunks)src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php(1 hunks)src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php(1 hunks)src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php(1 hunks)src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php(1 hunks)src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php(1 hunks)src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php(1 hunks)src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php(1 hunks)src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php(1 hunks)src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php(1 hunks)src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php(1 hunks)src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php(1 hunks)src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php(1 hunks)src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php(1 hunks)src/Appwrite/Platform/Tasks/Doctor.php(1 hunks)src/Appwrite/Platform/Tasks/Install.php(1 hunks)src/Appwrite/Platform/Tasks/Maintenance.php(1 hunks)src/Appwrite/Platform/Tasks/QueueRetry.php(1 hunks)src/Appwrite/Platform/Tasks/SDKs.php(1 hunks)src/Appwrite/Platform/Tasks/SSL.php(1 hunks)src/Appwrite/Platform/Tasks/Screenshot.php(1 hunks)src/Appwrite/Platform/Tasks/StatsResources.php(1 hunks)src/Appwrite/Platform/Tasks/Upgrade.php(1 hunks)src/Appwrite/Platform/Tasks/Vars.php(1 hunks)src/Appwrite/Platform/Workers/Audits.php(1 hunks)src/Appwrite/Platform/Workers/Databases.php(1 hunks)src/Appwrite/Platform/Workers/Functions.php(1 hunks)src/Appwrite/Platform/Workers/Mails.php(1 hunks)src/Appwrite/Platform/Workers/Messaging.php(1 hunks)src/Appwrite/Platform/Workers/Migrations.php(1 hunks)src/Appwrite/Platform/Workers/StatsResources.php(1 hunks)src/Appwrite/Platform/Workers/StatsUsage.php(1 hunks)src/Appwrite/Platform/Workers/StatsUsageDump.php(1 hunks)src/Appwrite/Platform/Workers/Webhooks.php(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: scan
- GitHub Check: Setup & Build Appwrite Image
- GitHub Check: Setup & Build Appwrite Image
🔇 Additional comments (104)
src/Appwrite/Platform/Tasks/Vars.php (1)
21-21: Use PHP 8.1 first-class callable syntax in constructor
The change to$this->action(...)correctly leverages PHP 8.1’s first-class callables and matches the pattern applied across other Task classes. No behavior or signature is altered.src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php (1)
52-52: Ensure PHP 8.1 support for first-class callables
You’ve correctly replaced->callback([$this,'action'])with->callback($this->action(...)). This syntax requires PHP 8.1+. Please verify that yourcomposer.json(and any CI matrix) enforces PHP >= 8.1 to avoid compatibility issues at runtime.src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php (1)
49-49: Use PHP 8.1 first-class callable syntax
Switching from the array callback to$this->action(...)is correct and improves readability by leveraging the new language feature.src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php (1)
51-51: Adopt PHP 8.1 first-class callable syntax
Good update—replacing the array callable with$this->action(...)aligns with PHP 8.1+ and improves readability.src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php (1)
53-53: Valid first-class callable usage.
The new$this->action(...)syntax leverages PHP 8.1’s first-class callables for cleaner callback registration.Please confirm that
composer.json(or project config) declares PHP >= 8.1 to support this syntax.src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php (1)
100-100: Ensure PHP 8.1+ support when using first-class callable syntax
The new->callback($this->action(...));correctly leverages PHP 8.1 first-class callables. Please verify that the project’s minimum PHP version has been raised to ≥8.1 incomposer.jsonand CI pipelines to avoid breaking compatibility.src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php (1)
74-74: Use first-class callable correctly
The updated$this->action(...)syntax is valid in PHP 8.1+ and produces a proper Closure for the callback.src/Appwrite/Platform/Workers/Audits.php (2)
50-50: Correct adoption of first-class callable syntax.
Switching from->callback([$this, 'action'])to->callback($this->action(...))is concise and aligns with PHP 8.1’s new callable feature.
50-50: Verify minimum PHP version requirement.
Using$this->action(...)demands PHP >= 8.1. Ensurecomposer.json, CI workflows, and project metadata reflect this bump to avoid parse errors on older runtimes.src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php (1)
56-56: Modernized callable syntax is correct. The PHP 8.1 first-class callable$this->action(...)cleanly replaces[$this, 'action']and produces the expectedClosurefor the callback.src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php (2)
60-60: Modernize callback to PHP 8.1 first-class callable
Using$this->action(...)improves readability and aligns with the rest of the codebase’s modernization to first-class callables.
60-60: Verify PHP 8.1+ support
First-class callable syntax requires PHP 8.1 or higher. Please confirm thatcomposer.jsonand CI workflows enforce aphp: ">=8.1"constraint so this update doesn’t introduce compatibility issues.src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php (1)
75-75: Modernized callback syntax
The change from->callback([$this, 'action'])to->callback($this->action(...))correctly adopts PHP 8.1 first-class callables without altering behavior.src/Appwrite/Platform/Tasks/Screenshot.php (2)
23-24: Upgrade to first-class callable is correct
The callback registration now leverages PHP 8.1’s first-class callable syntax ($this->action(...)), making the code more concise and readable.
23-24: Verify PHP version compatibility
First-class callables require PHP >= 8.1. Please ensure yourcomposer.json(platform.php) and CI matrix enforce this minimum version.src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php (1)
63-63: Verified PHP 8.1 first‐class callable usage
Replacing the legacy array syntax[$this, 'action']with->callback($this->action(...))is correct, preserves behavior, and matches the PR’s modernization across modules.src/Appwrite/Platform/Workers/StatsUsage.php (1)
122-122: Excellent modernization to PHP 8.1's first-class callable syntax!The change from
[$this, 'action']to$this->action(...)successfully adopts PHP 8.1's first-class callable feature, making the code more concise and readable while maintaining identical functionality.src/Appwrite/Platform/Tasks/StatsResources.php (1)
48-48: Correct use of PHP 8.1 first-class callable syntax
Replacing->callback([$this, 'action'])with->callback($this->action(...))is concise and leverages modern PHP features without altering behavior.src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php (1)
73-73: LGTM! Modern first-class callable syntax adopted correctly.The change from
[$this, 'action']to$this->action(...)successfully modernizes the callback registration to use PHP 8.1's first-class callable syntax. The functionality remains identical, and theactionmethod signature correctly matches the injected parameters.src/Appwrite/Platform/Workers/StatsUsageDump.php (1)
98-98: LGTM! Clean modernization to PHP 8.1 first-class callable syntax.The change from
[$this, 'action']to$this->action(...)correctly adopts PHP 8.1's first-class callable feature. The targetactionmethod exists with the appropriate signature, and this change maintains the same functionality while using more modern, concise syntax.src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php (1)
60-60: LGTM! Modern callable syntax correctly implemented.The change from
[$this, 'action']to$this->action(...)properly adopts PHP 8.1's first-class callable syntax. The method signature on line 63 correctly matches the expected parameters from the constructor configuration.src/Appwrite/Platform/Tasks/Maintenance.php (1)
30-30: LGTM! Modern PHP 8.1 callable syntax applied correctly.The change from
[$this, 'action']to$this->action(...)successfully adopts PHP 8.1's first-class callable syntax, making the code more concise and readable while maintaining identical functionality.src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php (1)
74-74: LGTM! Excellent modernization to PHP 8.1's first-class callable syntax.This change correctly adopts PHP 8.1's first-class callable feature, replacing the array callable syntax with the more concise
$this->action(...)syntax. The functionality remains identical while providing better static analysis support and improved code readability.Note: This change requires PHP 8.1+ for the first-class callable syntax support.
src/Appwrite/Platform/Tasks/Upgrade.php (1)
26-26: LGTM! Correct implementation of first-class callable syntax.The update to use
$this->action(...)properly implements PHP 8.1's first-class callable syntax, replacing the older array-based callback approach. This modernization maintains the same functionality while using cleaner, more concise syntax.src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php (1)
68-68:Details
✅ Verification successful
Modernize callback registration with PHP 8.1 first-class callable syntax.
The change from
->callback([$this, 'action'])to->callback($this->action(...))improves readability and consistency. Please confirm that your codebase’scomposer.jsonenforcesphp >=8.1to avoid runtime issues on unsupported PHP versions.Run the following to verify the PHP version requirement:
🏁 Script executed:
#!/usr/bin/env bash # Check PHP version requirement in composer.json jq '.require.php' composer.jsonLength of output: 41
Confirmed PHP ≥8.3.0 supports first-class callables
composer.jsonrequiresphp >=8.3.0, so the->callback($this->action(...))syntax is fully supported. No further changes needed.src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php (2)
55-57: Appropriate use of PHP 8.1 first-class callable.Switching to
$this->action(...)simplifies callback registration without altering behavior, and the preceding->inject('response')correctly aligns with the method signature.
1-1:Details
✅ Verification successful
Verify PHP version requirement for first-class callables.
First-class callable syntax requires PHP 8.1+. Ensure your root
composer.jsonenforces"php": ">=8.1"(or higher) to prevent runtime errors on older PHP versions.
🏁 Script executed:
#!/bin/bash # Check that composer.json requires PHP >=8.1 rg '"php"\s*:\s*".*"' -n composer.jsonLength of output: 98
No changes needed—project already requires PHP >= 8.3
The root composer.json specifies PHP">=8.3.0"(line 34) and configures platform PHP8.3(line 102), so first-class callable syntax is fully supported.src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php (2)
68-68: Modern callable syntax applied correctly
The transition from the array-style callback to PHP 8.1’s first-class callable ($this->action(...)) is syntactically correct and improves readability without altering behavior.
1-113:Details
✅ Verification successful
Verify PHP 8.1 as minimum requirement
First-class callable syntax requires PHP 8.1+. Please confirm thatcomposer.json,.github/workflowsor Docker images enforce PHP >=8.1 to prevent parse errors on older versions.Run this script to check your composer constraint:
🏁 Script executed:
#!/bin/bash # Ensure composer.json requires PHP 8.1 or newer jq '.require.php' composer.jsonLength of output: 41
Composer PHP version constraint covers first-class callables
The
composer.jsonalready requires PHP >= 8.3.0, which is above the PHP 8.1 minimum needed for first-class callable syntax. No further changes are required.• composer.json –
"require": { "php": ">=8.3.0" }src/Appwrite/Platform/Workers/Mails.php (2)
32-32: Modern callable syntax usage approved.Replacing the array-style callable with PHP 8.1’s first-class callable
->callback($this->action(...))is correct and yields cleaner, more concise code.
32-32:Details
✅ Verification successful
Verify PHP version requirement for first-class callables.
First-class callables require PHP 8.1 or higher. Please confirm your
composer.json(or build configs) specifyphp≥ 8.1.
🏁 Script executed:
#!/bin/bash # Check PHP version requirement in composer.json jq -r '.require.php' composer.jsonLength of output: 42
No action needed: PHP version requirement covers first-class callables
- The project’s composer.json specifies
"php": ">=8.3.0", which is well above the 8.1 minimum required for first-class callables.src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php (1)
56-56: Approve first-class callable usage; ensure PHP ≥8.1 support.Replacing
->callback([$this, 'action'])with->callback($this->action(...))is correct and more concise. Confirm that yourcomposer.jsonor CI configuration now requires PHP 8.1+ so this syntax parses without errors.src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php (2)
80-80: Adopt PHP 8.1 First-Class Callable Syntax
The change from->callback([$this, 'action'])to->callback($this->action(...))correctly modernizes the callable without altering behavior.
80-80:Details
✅ Verification successful
Verify PHP Version Requirement
First-class callable syntax requires PHP ≥ 8.1. Please confirm yourcomposer.json/platform config specifies PHP 8.1+ to prevent compatibility issues.Run:
and ensure it includes
^8.1or higher.
🏁 Script executed:
grep -E '"php"\s*:' composer.jsonLength of output: 86
PHP Version Requirement Verified
composer.json specifies PHP “>=8.3.0” (and “8.3”), which exceeds the PHP 8.1 requirement for first-class callable syntax—no changes needed.src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php (1)
52-52:Details
✅ Verification successful
Correct use of PHP 8.1 first-class callable syntax
Replacing the old array-callable[$this, 'action']with$this->action(...)aligns with modern PHP and matches patterns in other modules.
Please verify that your project’s minimum PHP version has been bumped to 8.1 (incomposer.jsonand CI workflows) to avoid runtime errors in environments running older PHP versions.
🏁 Script executed:
#!/bin/bash # Verify minimum PHP version requirement in composer.json jq '.require.php' composer.jsonLength of output: 41
Minimum PHP version requirement is satisfied
Thecomposer.jsonalready requires PHP >= 8.3.0, so using the PHP 8.1+ first-class callable syntax ($this->action(...)) is safe.src/Appwrite/Platform/Tasks/QueueRetry.php (1)
26-28:Details
✅ Verification successful
Use PHP 8.1 first-class callable syntax
The new$this->action(...)is concise and functionally identical to the array callable. Ensure yourcomposer.jsonenforces PHP 8.1+ so this syntax won’t break on older installations.You can verify the PHP version requirement with:
🏁 Script executed:
#!/bin/bash # Verify composer.json requires PHP 8.1 or higher version=$(jq -r '.require.php' composer.json 2>/dev/null) echo "Required PHP version: $version"Length of output: 124
PHP requirement satisfied – first-class callable is safe
composer.json specifies"php": ">=8.3.0", which exceeds PHP 8.1. The use of the first-class callable syntax ($this->action(...)) is therefore fully supported in your supported environments.src/Appwrite/Platform/Tasks/SSL.php (2)
26-27: Use of first-class callable is correct and consistent.
Replacing->callback([$this, 'action'])with->callback($this->action(...))cleanly adopts PHP 8.1 first-class callables without altering behavior.
1-4:Details
✅ Verification successful
Verify PHP version compatibility.
First-class callables require PHP >= 8.1. Please ensure yourcomposer.json(and CI configurations) enforce a minimum PHP 8.1 runtime to avoid syntax errors on older versions.You can run:
🏁 Script executed:
#!/bin/bash rg '"php":' composer.json -A 2Length of output: 177
PHP version requirement is satisfied
Your composer.json already enforces"php": ">=8.3.0", which exceeds the PHP 8.1 requirement for first-class callables. No changes needed.src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php (2)
64-64: Approve modernization of callback syntax.The change to PHP 8.1 first-class callable syntax (
$this->action(...)) is correctly applied and enhances readability.
64-64:Details
✅ Verification successful
Ensure PHP 8.1 requirement is declared.
First-class callable syntax requires PHP 8.1+. Please verify that your
composer.json(and any CI or Docker setup) has been updated to reflect PHP >= 8.1.Run the following script to confirm the PHP version constraint in
composer.json:
🏁 Script executed:
#!/bin/bash set -e # Verify composer.json requires PHP >= 8.1 version=$(jq -r '.require.php' composer.json) if [[ "$version" < "8.1" ]]; then echo "Error: composer.json requires PHP $version; update to >=8.1 for first-class callables." exit 1 fi echo "composer.json PHP requirement: $version"Length of output: 173
PHP version constraint confirmed
composer.json specifies PHP >= 8.3.0, which already covers the PHP 8.1+ requirement for first-class callables. No further changes needed here.
src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php (1)
56-56: LGTM! Excellent modernization to PHP 8.1 syntax.The update to first-class callable syntax
$this->action(...)is a clean modernization that maintains identical functionality while adopting newer PHP language features.src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php (1)
57-57: LGTM! Consistent modernization with PHP 8.1 syntax.The first-class callable syntax update is correctly implemented and maintains consistency with the broader codebase modernization effort.
src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php (1)
61-61: LGTM! Proper implementation of first-class callable syntax.The modernization to
$this->action(...)correctly adopts PHP 8.1's first-class callable feature while preserving all existing functionality.src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php (1)
65-65: LGTM! Excellent conclusion to the callback syntax modernization.The final update to first-class callable syntax completes a consistent and well-executed modernization effort across the Sites Variables module. The adoption of PHP 8.1's
$this->action(...)syntax improves code readability while maintaining identical functionality.src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php (1)
55-55:Details
✅ Verification successful
LGTM! Modern first-class callable syntax adopted correctly.
The update to use
$this->action(...)instead of[$this, 'action']correctly adopts PHP 8.1's first-class callable syntax, improving code readability while maintaining identical functionality.Verify that the project's minimum PHP version requirement supports this syntax:
🌐 Web query:
What is the minimum PHP version required for first-class callable syntax?💡 Result:
The minimum PHP version required for first-class callable syntax is PHP 8.1.
First-class callable syntax was introduced in PHP 8.1, allowing you to get a first-class representation of a function or method by using the
(...)syntax. For example:$callable = strlen(...);This feature is not available in any PHP versions prior to 8.1.
🏁 Script executed:
#!/bin/bash # Check project's PHP version requirement in composer.json if [[ -f composer.json ]]; then echo "composer.json found. PHP version requirement:" grep -R '"php"' -n composer.json | sed 's/^[0-9]\+://' else echo "composer.json not found" fiLength of output: 233
✅ PHP Version Compatibility Confirmed
- composer.json specifies
"php": ">=8.3.0", which exceeds the PHP 8.1 minimum required for first-class callables.- The change in
src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php(line 55) from[$this, 'action']to$this->action(...)is fully supported and maintains existing functionality.LGTM!
src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php (1)
60-60:Details
✅ Verification successful
Use of PHP 8.1 first-class callable is correct; ensure PHP requirement is updated
The new syntax
$this->action(...)leverages PHP 8.1’s first-class callable feature. Please confirm thatcomposer.json(and any CI matrices) specify a minimum PHP version >= 8.1 so this change won’t break compatibility.
🏁 Script executed:
#!/bin/bash # Verify minimum PHP version in composer.json for first-class callables jq -r '.require.php' composer.jsonLength of output: 42
PHP 8.1+ first-class callable usage approved
composer.json already requires PHP >=8.3.0, which exceeds the 8.1 minimum needed for first-class callables:
- composer.json (
require.php): ">=8.3.0"No further changes required.
src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php (1)
52-52:Details
✅ Verification successful
Approve modernization to first-class callable. The new
$this->action(...)syntax is concise and aligns with PHP 8.1+ best practices.
Ensure yourcomposer.jsonis updated to require PHP >= 8.1, as first-class callables won’t work on older versions.To verify the PHP requirement:
🏁 Script executed:
#!/bin/bash # Description: Check composer.json for its PHP version requirement phpReq=$(grep -Po '"php"\s*:\s*"\K[^"]+' composer.json) echo "composer.json requires PHP version: $phpReq"Length of output: 176
Approved: First-class callable usage is supported
- composer.json requires PHP >=8.3.0, which exceeds the 8.1+ minimum for first-class callables
- No further changes needed
src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php (1)
55-55:Details
✅ Verification successful
LGTM! Successful modernization to PHP 8.1+ first-class callable syntax.
The change correctly adopts the modern first-class callable syntax
$this->action(...)which is more concise and readable than the traditional array syntax[$this, 'action'].Please confirm that the codebase supports PHP 8.1+ as this syntax requires that minimum version:
🌐 Web query:
What is the minimum PHP version requirement for using first-class callable syntax?💡 Result:
First-class callable syntax was introduced in PHP 8.1 and requires this version or later to use. This feature provides a more streamlined way to create callable functions compared to previous methods[1][4][5].
Before PHP 8.1, developers needed to use
Closure::fromCallable()to create a callable from a function name, method, or anonymous function. The first-class callable syntax significantly reduces this boilerplate code[1]. For example, instead of writing$fn = Closure::fromCallable('strlen');, you can now write$fn = strlen(...);[5][6].This syntax is not backward compatible with older PHP versions. If you attempt to use it in PHP versions prior to 8.1, it will result in a parse error: "Parse error: syntax error, unexpected token ")" in ... on line ..."[1]. Applications that need to maintain compatibility with older PHP versions must continue to use
Closure::fromCallableinstead[1].The syntax returns a Closure object, not just a callable type (string or array), which ensures that the scope is bound at the time the callable is created rather than when it's called[9]. This makes it particularly useful for static analysis tools, as it respects the scope at the point where the callable is created[6].
When choosing minimum PHP requirements for a library or application that uses this feature, you would need to set PHP 8.1 as the minimum version to ensure compatibility[10].
Citations:
- 1: https://php.watch/versions/8.1/first-class-callable-syntax
- 2: https://www.php.net/manual/en/language.types.callable.php
- 3: phan/phan#4464
- 4: https://dev.to/damms005/phps-first-class-callable-syntax-1kjl
- 5: https://www.php.net/releases/8.1/en.php
- 6: https://wiki.php.net/rfc/first_class_callable_syntax
- 7: https://make.wordpress.org/core/2020/03/20/updating-the-coding-standards-for-modern-php/
- 8: https://externals.io/message/114532
- 9: https://derickrethans.nl/phpinternalsnews-92.html
- 10: https://sandfox.me/php/choosing-php-version.html
🏁 Script executed:
#!/bin/bash # Check PHP version requirement in composer.json if [ -f composer.json ]; then grep -R '"php"' -n composer.json || echo "No php requirement found in composer.json" else echo "composer.json not found" fiLength of output: 119
Confirmed PHP ≥8.3 requirement – first-class callable syntax is fully supported
• composer.json specifies
"php": ">=8.3.0", which exceeds the PHP 8.1+ minimum for first-class callables.
• The change from[$this, 'action']to$this->action(...)is valid and introduces no behavioral changes.LGTM – approving these modernizations.
src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php (1)
52-52:Details
✅ Verification successful
Approve modernization to first-class callable syntax.
The update to use
$this->action(...)instead of[$this, 'action']is a good modernization that adopts PHP 8.1's first-class callable syntax. This makes the code more concise and aligns with modern PHP practices.Please verify that the codebase officially supports PHP 8.1+ since first-class callables require this minimum version:
🏁 Script executed:
#!/bin/bash # Description: Check PHP version requirements in composer.json and documentation # Check composer.json for PHP version requirement fd -t f "composer.json" --exec cat {} \; | jq -r '.require.php // empty' # Check for any PHP version documentation fd -t f -e md -e txt | xargs rg -l -i "php.*version|php.*requirement" | head -5 | xargs catLength of output: 96874
Composer.json requires PHP ≥ 8.3.0 – first-class callables are fully supported.
The root
composer.jsonspecifies"php": ">=8.3.0", so migrating to the PHP 8.1+ first-class callable syntax is safe and consistent across the codebase.src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php (1)
58-58:Details
❓ Verification inconclusive
Ensure PHP 8.1+ is declared for first-class callables
The new syntax$this->action(...)requires PHP 8.1’s first-class callable feature. Verify that yourcomposer.json, Docker images, and CI matrices enforcephp: ">=8.1.0", so this change doesn’t break on older PHP versions.
🏁 Script executed:
#!/bin/bash # Verify PHP engine requirement in composer.json rg '"php"\s*:\s*">=8\.1' composer.jsonLength of output: 40
🏁 Script executed:
#!/bin/bash # Extract the PHP engine requirement from composer.json rg -n '"php"\s*:' composer.json -A3Length of output: 279
🏁 Script executed:
#!/bin/bash # Check Dockerfile(s) for PHP base image versions rg -n '^FROM php' -R . # Check GitHub Actions workflows for PHP setup/version if [ -d .github/workflows ]; then find .github/workflows -type f -name '*.yml' -print0 | xargs -0 rg -n 'setup-php|php[-_]version' else echo "No .github/workflows directory found" fiLength of output: 559
🏁 Script executed:
#!/bin/bash # Recursively search for PHP base images in Dockerfiles rg -n '^FROM php' . # Search GitHub Actions workflows for PHP setup/version if [ -d .github/workflows ]; then find .github/workflows -type f -name '*.yml' -print0 | xargs -0 rg -n 'setup-php|php[-_]version' else echo "No GitHub Actions workflows detected" fiLength of output: 151
Confirm PHP 8.1+ environment
Composer already requires PHP >=8.3.0, so first-class callables ($this->action(...)) are supported. However, no Dockerfile or GitHub Actions workflow was found that pins your PHP runtime. Please verify that all your build, CI and deployment environments enforce PHP >=8.1 to avoid runtime failures.• composer.json (line 34):
"php": ">=8.3.0"
• NoDockerfiledetected in the repo
• No PHP version setup in.github/workflows/**src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php (1)
60-60: Excellent modernization to PHP 8.1's first-class callable syntax.The change from
[$this, 'action']to$this->action(...)correctly adopts the modern first-class callable syntax while maintaining identical functionality. This improves code readability and aligns with current PHP best practices.src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php (1)
61-61: Consistent modernization with first-class callable syntax.The update correctly replaces the traditional array callable with PHP 8.1's first-class callable syntax. This maintains the same functionality while improving code consistency across the codebase.
src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php (1)
58-58: Proper adoption of first-class callable syntax.The callback registration correctly uses the modern
$this->action(...)syntax, maintaining consistency with the codebase modernization effort.src/Appwrite/Platform/Workers/Webhooks.php (1)
41-41: Consistent modernization in Worker class.The callback registration properly adopts the first-class callable syntax, completing the modernization effort across both HTTP modules and Worker classes. The syntax change maintains identical functionality while improving code clarity.
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php (1)
52-52: Excellent modernization to PHP 8.1 syntax!The update to first-class callable syntax
$this->action(...)improves code readability and leverages modern PHP features. The referenced action method is properly defined.src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php (1)
60-60: Clean syntax modernization.The first-class callable syntax update is correctly implemented and maintains the same functionality while using more modern PHP 8.1 features.
src/Appwrite/Platform/Tasks/SDKs.php (1)
49-49: Consistent modernization applied.The callback syntax update correctly adopts PHP 8.1's first-class callable feature. The action method is properly defined and the change maintains existing functionality.
src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php (1)
53-53: Modernization successfully completed.The first-class callable syntax update is correctly implemented. This completes the consistent modernization across the reviewed files, successfully adopting PHP 8.1's cleaner callable syntax.
src/Appwrite/Platform/Workers/Migrations.php (1)
72-72: Excellent modernization to PHP 8.1 first-class callable syntax!The update from
[$this, 'action']to$this->action(...)properly adopts PHP 8.1's first-class callable feature, making the code more concise and modern while maintaining identical functionality.src/Appwrite/Platform/Tasks/Doctor.php (1)
37-37: LGTM! Clean adoption of first-class callable syntax.The transition to
$this->action(...)modernizes the callback registration while preserving the exact same functionality as the previous array callable syntax.src/Appwrite/Platform/Tasks/Install.php (1)
34-34: Perfect implementation of PHP 8.1 first-class callables.The syntax update correctly replaces the array callable with the modern first-class callable syntax, aligning with the PR's modernization objectives.
src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php (1)
69-69: Consistent modernization with first-class callable syntax.The callback update properly implements PHP 8.1's first-class callable feature, maintaining consistency with the broader codebase modernization effort described in the PR objectives.
src/Appwrite/Platform/Workers/Functions.php (1)
56-56: LGTM! Modern first-class callable syntax adopted.The update to
$this->action(...)correctly implements PHP 8.1's first-class callable syntax, providing cleaner and more readable code while maintaining identical functionality.src/Appwrite/Platform/Workers/Databases.php (1)
41-41: LGTM! Consistent first-class callable syntax adoption.The callback syntax has been correctly modernized to use PHP 8.1's first-class callable feature, maintaining consistency with the codebase-wide update.
src/Appwrite/Platform/Workers/Messaging.php (1)
75-75: LGTM! First-class callable syntax correctly implemented.The modernization to
$this->action(...)syntax is correctly applied, following the consistent pattern across all worker classes in this PR.src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php (1)
89-89: LGTM! Comprehensive first-class callable modernization.The callback syntax modernization extends correctly to HTTP action classes, demonstrating a comprehensive and consistent codebase-wide adoption of PHP 8.1's first-class callable syntax.
src/Appwrite/Platform/Modules/Functions/Workers/Builds.php (1)
78-78: LGTM! Callback syntax successfully modernized.The change from
[$this, 'action']to$this->action(...)correctly implements PHP 8.1's first-class callable syntax. This modernization improves code readability while maintaining identical functionality.src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php (1)
65-65: LGTM! First-class callable syntax properly implemented.The callback registration has been correctly updated to use the modern PHP 8.1+ syntax. The functionality remains unchanged while improving code consistency.
src/Appwrite/Platform/Workers/StatsResources.php (1)
52-52: LGTM! Consistent modernization applied.The callback syntax update follows the same pattern as other files in this PR, correctly implementing first-class callable syntax for improved code consistency.
src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php (1)
52-52: LGTM! Callback modernization completed successfully.The transition to first-class callable syntax is correctly implemented, maintaining the same behavior while adopting modern PHP conventions.
src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php (1)
65-65: LGTM! Modernization to PHP 8.1 first-class callable syntax.The change correctly updates the callback registration to use the more concise and modern first-class callable syntax introduced in PHP 8.1.
src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php (1)
64-64: Consistent modernization to first-class callable syntax.This change aligns with the codebase-wide update to adopt PHP 8.1's first-class callable syntax, maintaining consistency across modules.
src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php (1)
60-60: LGTM! Consistent with the first-class callable modernization.The callback registration has been correctly updated to use the modern PHP 8.1 syntax.
src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php (1)
56-56:Details
✅ Verification successful
Approved with verification recommendation.
The syntax modernization is correct and consistent. Consider verifying that all similar callback patterns across the codebase have been updated and that the project's minimum PHP version supports 8.1+ features.
🏁 Script executed:
#!/bin/bash # Description: Verify that all callback patterns have been consistently updated and check PHP version requirements # Check for any remaining old-style callback patterns echo "=== Checking for remaining old-style callback patterns ===" rg -n '\->callback\(\[\$this,' --type php # Check composer.json for PHP version requirements echo "=== Checking PHP version requirements ===" if [ -f "composer.json" ]; then cat composer.json | jq '.require.php // "Not specified"' else echo "composer.json not found" fi # Count total callback pattern updates to verify completeness echo "=== Counting new-style callback patterns ===" rg -c '\->callback\(\$this->[a-zA-Z_]+\(\.\.\.\)\)' --type phpLength of output: 6614
All callback patterns modernized and PHP version supports first-class callables
- No legacy
->callback([$this, '…'])usages remain in the codebase.- composer.json requires PHP >= 8.3.0, which fully supports first-class callable syntax.
- All
->callback($this->method(...))patterns have been applied consistently.You can safely merge these changes.
src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php (1)
56-56: LGTM: Clean modernization to first-class callable syntax.The update from
[$this, 'action']to$this->action(...)correctly adopts PHP 8.1's first-class callable syntax while maintaining identical functionality.src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php (1)
51-51: LGTM: Proper adoption of first-class callable syntax.The callback registration correctly modernizes to use
$this->action(...)syntax, maintaining the same functionality while improving code readability.src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php (1)
64-64: LGTM: Successful migration to modern callable syntax.The transformation to
$this->action(...)is correctly implemented and maintains compatibility with the existing method signature and dependency injection pattern.src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php (2)
64-64: LGTM: Correct first-class callable implementation.The callback registration properly uses the modern
$this->action(...)syntax while preserving all existing functionality.
64-64:Details
✅ Verification successful
Verify PHP 8.1+ compatibility across the project.
Since this PR adopts PHP 8.1's first-class callable syntax across the codebase, ensure that the project's minimum PHP version requirement is set to 8.1 or higher.
🏁 Script executed:
#!/bin/bash # Check if PHP version requirements are properly set for PHP 8.1+ echo "Checking composer.json for PHP version requirements..." if [ -f "composer.json" ]; then cat composer.json | jq '.require.php // .require."php"' 2>/dev/null || grep -E '"php".*:' composer.json else echo "composer.json not found" fi echo -e "\nChecking for any PHP version documentation..." fd -e md -e txt README CHANGELOG REQUIREMENTS | head -5 | xargs grep -l -i "php.*version\|php.*requirement" 2>/dev/null || echo "No PHP version docs found"Length of output: 647
PHP version requirement is already set to ≥8.1
The project’s composer.json specifies"php": ">=8.3.0", which more than satisfies the PHP 8.1+ requirement introduced by first-class callables. No further changes needed.src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php (1)
78-78: Adopted PHP 8.1 first-class callable syntax
Updated the callback registration to$this->action(...), which is equivalent to the old array syntax but more concise and expressive.src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php (1)
59-59: Adopted PHP 8.1 first-class callable syntax
Replaced the legacycallback([$this, 'action'])with$this->action(...), improving consistency and readability without changing behavior.src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php (1)
65-65: Adopted PHP 8.1 first-class callable syntax
Switched to$this->action(...)for the callback, aligning with the modern callable style across the codebase.src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php (1)
61-61: Adopted PHP 8.1 first-class callable syntax
Modernized the callback assignment to$this->action(...), preserving functionality while improving syntax clarity.src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php (1)
68-68: Adopted PHP 8.1 first-class callable syntax
Updated callback to$this->action(...), ensuring a consistent, concise style with no impact on logic.src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php (1)
75-75: Excellent modernization to first-class callable syntax.This change successfully adopts PHP 8.1's first-class callable syntax, making the code more concise and readable while maintaining identical functionality.
src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php (1)
55-55: LGTM - consistent modernization.The first-class callable syntax is correctly applied and improves code readability.
src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php (1)
56-56: Consistent modernization applied correctly.The callback registration follows the same improved pattern as other files in this PR.
src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php (1)
52-52: Proper implementation of the modernization.The syntax update is correctly applied and maintains consistency with the broader refactor.
src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php (1)
50-50:Details
✅ Verification successful
Modernization completed successfully.
The first-class callable syntax is properly implemented. Please verify that this modernization has been consistently applied across the entire codebase and that PHP 8.1+ is supported.
🏁 Script executed:
#!/bin/bash # Verify consistent application of first-class callable syntax across codebase echo "=== Checking for remaining old syntax ===" rg "\->callback\(\[\$this,\s*['\"][^'\"]+['\"]\s*\]\)" --type php echo "=== Checking new syntax usage ===" rg "\->callback\(\$this->[a-zA-Z_][a-zA-Z0-9_]*\(\.\.\.\)\)" --type php | head -20 echo "=== Checking composer.json for PHP version requirement ===" if [ -f "composer.json" ]; then jq '.require.php // .["require"]["php"] // "not specified"' composer.json else echo "composer.json not found" fiLength of output: 566
Modern first-class callables verified across codebase
- No remaining legacy array-callable syntax (
->callback([$this, 'method'])) detected.composer.jsonrequires PHP >= 8.3.0, which fully supports first-class callables.All callback invocations now use the modern syntax. Approving these changes.
src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php (1)
55-55: LGTM! Modern callable syntax adopted correctly.The change from
[$this, 'action']to$this->action(...)correctly adopts PHP 8.1's first-class callable syntax, making the code more concise while maintaining the same functionality.src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php (1)
97-97: Excellent modernization of callable syntax.The update to first-class callable syntax
$this->action(...)is correctly implemented and aligns with the broader codebase modernization effort.src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php (1)
65-65: Clean adoption of first-class callable syntax.The callback registration correctly uses the modern
$this->action(...)syntax, improving code readability and consistency.src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php (1)
62-62: Proper implementation of modern callable syntax.The transition to
$this->action(...)syntax is correctly executed, completing the modernization of callback registration in this module.src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php (1)
65-65: LGTM: Clean modernization to first-class callable syntax.The update from array callable syntax to PHP 8.1+ first-class callable syntax improves code readability and adopts modern PHP features without changing functionality.
src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php (1)
52-52: Excellent modernization to first-class callable syntax.The transition to
$this->action(...)aligns with PHP 8.1+ best practices and maintains the same functionality while improving code clarity.src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php (1)
60-60: Perfect adoption of first-class callable syntax.The update correctly implements PHP 8.1+ first-class callables, making the callback registration more concise and readable.
src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php (1)
90-90:Details
✅ Verification successful
Verify PHP 8.1+ compatibility for first-class callable syntax.
The modernization to first-class callable syntax is excellent and improves code readability. However, please ensure the codebase is running on PHP 8.1+ since this syntax was introduced in that version.
🏁 Script executed:
#!/bin/bash # Check if the codebase specifies PHP 8.1+ requirement echo "Checking composer.json for PHP version requirements..." fd composer.json --exec cat {} \; | jq '.require.php // .require."php"' 2>/dev/null || echo "No JSON found, checking raw content..." fd composer.json --exec grep -i "php" {} \; echo -e "\nChecking for any PHP version specifications in other config files..." rg -i "php.*8\.[1-9]|php.*[9-9]" --type-add 'config:*.{json,yml,yaml,ini,conf}' -t configLength of output: 2878
Confirmed PHP 8.1+ Compatibility
Composer manifests specify PHP >= 8.3.0 across the codebase, so first-class callables are fully supported. No further action required—approving this change.
src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php (1)
117-117: LGTM! Proper implementation of PHP 8.1 first-class callable syntax.The change correctly updates from the array callable syntax to the modern first-class callable syntax using the spread operator. This modernizes the code while maintaining the same functionality.
src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php (1)
58-58: LGTM! Clean modernization to PHP 8.1 syntax.The callback registration has been correctly updated to use first-class callable syntax, improving code readability and utilizing modern PHP features.
src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php (1)
107-107: LGTM! Consistent with the codebase modernization.The callback syntax has been correctly updated to use PHP 8.1's first-class callable feature, maintaining consistency with the broader codebase updates mentioned in the PR.
src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php (1)
59-59:Details
✅ Verification successful
Adopt PHP 8.1 first-class callable syntax
Callback updated to$this->action(...)for modern, concise callables. Ensure your project’s PHP version constraint is set to>=8.1to support this syntax.Run this script to validate the PHP requirement in composer.json:
🏁 Script executed:
#!/bin/bash # Description: Verify composer.json requires PHP >= 8.1 required=$(jq -r '.require.php' composer.json) if [[ "$required" == *">=8.1"* ]]; then echo "✅ PHP constraint OK: $required" else echo "❌ PHP constraint missing >=8.1: $required" exit 1 fiLength of output: 186
PHP 8.1+ Requirement Satisfied
Your adoption of the first-class callable syntax ($this->action(...)) is valid. The project’scomposer.jsonalready requires PHP >= 8.3.0, which fully satisfies the PHP 8.1 minimum. No further changes are needed.src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php (1)
92-92:Details
✅ Verification successful
Adopt PHP 8.1 first-class callable syntax
Callback updated to$this->action(...)for modern, concise callables. Ensure your project’s PHP version constraint is set to>=8.1to support this syntax.Run this script to validate the PHP requirement in composer.json:
🏁 Script executed:
#!/bin/bash # Description: Verify composer.json requires PHP >= 8.1 required=$(jq -r '.require.php' composer.json) if [[ "$required" == *">=8.1"* ]]; then echo "✅ PHP constraint OK: $required" else echo "❌ PHP constraint missing >=8.1: $required" exit 1 fiLength of output: 186
PHP version constraint covers first-class callables
composer.json requires PHP >= 8.3.0, which exceeds the PHP 8.1 minimum for first-class callable syntax. ✅src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php (1)
61-61:Details
✅ Verification successful
Adopt PHP 8.1 first-class callable syntax
Callback updated to$this->action(...)for modern, concise callables. Ensure your project’s PHP version constraint is set to>=8.1to support this syntax.Run this script to validate the PHP requirement in composer.json:
🏁 Script executed:
#!/bin/bash # Description: Verify composer.json requires PHP >= 8.1 required=$(jq -r '.require.php' composer.json) if [[ "$required" == *">=8.1"* ]]; then echo "✅ PHP constraint OK: $required" else echo "❌ PHP constraint missing >=8.1: $required" exit 1 fiLength of output: 186
Approve code changes – PHP constraint OK
The repository’scomposer.jsonalready requires PHP>=8.3.0, which fully satisfies the PHP 8.1 requirement for first-class callables. No further updates needed for the callback syntax insrc/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php.src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php (1)
58-58:Details
❓ Verification inconclusive
Modernize callback syntax using PHP 8.1 first-class callable
This update correctly replaces->callback([$this, 'action'])with->callback($this->action(...)), improving readability and consistency across modules. Ensure the project’s PHP requirement has been bumped to 8.1+ incomposer.jsonand CI configurations to avoid breaking builds.
🏁 Script executed:
#!/bin/bash # Verify that composer.json now requires PHP >= 8.1 jq -r '.require.php' composer.jsonLength of output: 42
🏁 Script executed:
#!/bin/bash # Verify that CI workflows are testing on PHP ≥ 8.1 rg -n "php" .github/workflows/*.ymlLength of output: 768
🏁 Script executed:
#!/bin/bash # Check PHP versions in CI test matrix rg -n "php-version:" -A3 .github/workflows/tests.ymlLength of output: 52
🏁 Script executed:
#!/bin/bash # Inspect PHP versions in the CI test workflow rg -n "uses:.*setup-php" -A5 .github/workflows/tests.ymlLength of output: 58
🏁 Script executed:
#!/bin/bash # Search for PHP setup action across all CI workflows rg -n "uses: .*setup-php" -A3 .github/workflows/*.ymlLength of output: 455
🏁 Script executed:
#!/bin/bash # Display the CI test workflow to verify PHP versions in the matrix or setup-php step sed -n '1,200p' .github/workflows/tests.ymlLength of output: 5387
Verify PHP requirement bump in CI
- composer.json now requires PHP “>=8.3.0” ✅
- CI “tests” job runs inside the
appwrite-devDocker image (no hostsetup-phpstep found)- Please confirm:
- The Docker image is based on PHP 8.1+
- Any host-run workflows (linter, static-analysis, code scanning) are pinned to PHP 8.1 or newer
| ->inject('queueForEvents') | ||
| ->inject('dbForPlatform') | ||
| ->callback([$this, 'action']); | ||
| ->callback($this->action(...)); |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Proper use of PHP 8.1 first-class callable
The updated callback syntax correctly leverages PHP 8.1’s first-class callable without altering behavior. Please verify that composer.json enforces PHP >= 8.1 to avoid compatibility issues.
Run the following script to confirm the PHP version constraint:
🏁 Script executed:
#!/usr/bin/env bash
# Confirm PHP minimum version requirement in composer.json
rg '"php":\s*">=8\.1"' composer.json || echo "ERROR: composer.json does not enforce PHP >= 8.1"Length of output: 145
Update composer.json to enforce PHP >= 8.1
The callback syntax in Update.php requires PHP 8.1+. However, running the verification script shows your composer.json does not enforce this. Please update your composer.json require section accordingly:
{
"require": {
- "php": ">=7.4",
+ "php": ">=8.1",
// …
}
}If there’s no existing PHP requirement, add the "php": ">=8.1", line under "require".
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ->callback($this->action(...)); | |
| { | |
| "require": { | |
| - "php": ">=7.4", | |
| + "php": ">=8.1", | |
| // … | |
| } | |
| } |
🤖 Prompt for AI Agents
In src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php at line
63, the code uses PHP 8.1 first-class callable syntax which requires PHP version
8.1 or higher. To fix compatibility issues, update the composer.json file to
enforce PHP >= 8.1 by adding or modifying the "php" version requirement under
the "require" section to ">=8.1".
✨ Benchmark results
⚡ Benchmark Comparison
|
What does this PR do?
Use first-class callable syntax: https://www.php.net/releases/8.1/en.php#first_class_callable_syntax
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)
Related PRs and Issues
Checklist