From c4d3e1aa7b882a41a73d52d31f4b7462657e86f5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 26 Dec 2022 14:07:53 +0100 Subject: [PATCH] [ticket/16955] Resolve psalm issues in di files PHPBB3-16955 --- build/psalm_bootstrap.php | 4 ++++ phpBB/phpbb/di/container_builder.php | 3 ++- phpBB/phpbb/di/extension/config.php | 4 ++-- phpBB/phpbb/di/ordered_service_collection.php | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build/psalm_bootstrap.php b/build/psalm_bootstrap.php index 4d5a3ea85a..4fc5628459 100644 --- a/build/psalm_bootstrap.php +++ b/build/psalm_bootstrap.php @@ -45,3 +45,7 @@ require_once $phpbb_root_path . 'includes/compatibility_globals.' . $phpEx; $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', $phpbb_root_path . 'phpbb/', "php"); $phpbb_class_loader->register(); + +class phpbb_cache_container extends \Symfony\Component\DependencyInjection\Container +{ +} diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index 20e87e7660..b9dc8bba63 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -46,7 +46,7 @@ class container_builder /** * The container under construction * - * @var ContainerBuilder + * @var \phpbb_cache_container|ContainerBuilder */ protected $container; @@ -449,6 +449,7 @@ class container_builder $ext_container->register('cache.driver', '\\phpbb\\cache\\driver\\dummy'); $ext_container->compile(); + /** @var \phpbb\config\config $config */ $config = $ext_container->get('config'); if (@is_file($this->phpbb_root_path . $config['exts_composer_vendor_dir'] . '/autoload.php')) { diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index 6274f0f020..775de380ec 100644 --- a/phpBB/phpbb/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php @@ -32,12 +32,12 @@ class config extends Extension /** * Loads a specific configuration. * - * @param array $config An array of configuration values + * @param array $configs An array of configuration values * @param ContainerBuilder $container A ContainerBuilder instance * * @throws \InvalidArgumentException When provided tag is not defined in this extension */ - public function load(array $config, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container) { $parameters = array( 'core.adm_relative_path' => $this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/', diff --git a/phpBB/phpbb/di/ordered_service_collection.php b/phpBB/phpbb/di/ordered_service_collection.php index 046012ae5b..57b674b986 100644 --- a/phpBB/phpbb/di/ordered_service_collection.php +++ b/phpBB/phpbb/di/ordered_service_collection.php @@ -85,13 +85,13 @@ class ordered_service_collection extends service_collection /** * Adds a service ID to the collection * - * @param string $service_id + * @param string $name * @param int $order */ - public function add($service_id, $order = 0) + public function add($name, $order = 0) { $order = (int) $order; - $this->service_ids[$order][] = $service_id; + $this->service_ids[$order][] = $name; $this->is_ordered = false; }