Skip to content

Conversation

@MauricioFauth
Copy link
Member

No description provided.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
Copy link
Contributor

@kamil-tekiela kamil-tekiela left a comment

Choose a reason for hiding this comment

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

And with this change it makes the loader leaner and faster:

return static function (ContainerConfigurator $configurator): void {
    $services = $configurator->services();
    /** @param array<'services', array<string, array{class: string, arguments?: array<string>, factory?: callable}>> $servicesFile */
    $loadServices = static function (array $servicesFile, ServicesConfigurator $services): void {
        foreach ($servicesFile['services'] as $serviceName => $service) {
            $theService = $services->set($serviceName, $service['class']);
            if (isset($service['arguments'])) {
                foreach ($service['arguments'] as &$argumentName) {
                    if ($argumentName[0] !== '@') {
                        continue;
                    }

                    $argumentName = new Reference(substr($argumentName, 1));
                }

                $theService->args($service['arguments']);
            }

            if (! isset($service['factory'])) {
                continue;
            }

            $theService->factory($service['factory']);
        }
    };

    $servicesFile = include ROOT_PATH . 'app/services.php';
    $loadServices($servicesFile, $services);
    $servicesFile = include ROOT_PATH . 'app/services_controllers.php';
    $loadServices($servicesFile, $services);
};

As only other services are used as arguments, there's no need for it.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.14%. Comparing base (3c8ea24) to head (b4e3ba8).
⚠️ Report is 115 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #20013      +/-   ##
============================================
+ Coverage     62.05%   62.14%   +0.08%     
+ Complexity    16112    16099      -13     
============================================
  Files           676      676              
  Lines         59990    59981       -9     
============================================
+ Hits          37227    37274      +47     
+ Misses        22763    22707      -56     
Flag Coverage Δ
unit-8.2-ubuntu-latest 62.14% <ø> (?)
unit-8.4-ubuntu-latest 62.14% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
@MauricioFauth MauricioFauth merged commit f7f22ad into phpmyadmin:master Jan 7, 2026
41 of 42 checks passed
@MauricioFauth MauricioFauth deleted the services-file-refactor branch January 7, 2026 21:43
@MauricioFauth MauricioFauth self-assigned this Jan 7, 2026
@MauricioFauth MauricioFauth added this to the 6.0.0 milestone Jan 7, 2026
Comment on lines 16 to 19
if (is_string($service)) {
$services->alias($serviceName, $service);
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why this remains? Didn't you remove all aliases in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

This can be used for example to register an an interface as a service and make it an alias to a concrete implementation. I want to experiment with that to see if makes sense for phpMyAdmin. If it does not I'll remove that part.
Thinking about it now. It would have been better to remove that and add it back later if needed, because now it's just dead code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed by #20015.

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