From b486e6404332e61aa8d96edcede1964d8205110c Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sat, 6 Mar 2021 19:06:01 +0100 Subject: [PATCH] Fix arguments type hint --- .../Component/Resource/Template.php | 2 +- src/CoreBundle/Component/Utils/ChamiloApi.php | 70 ++++++++----------- src/CoreBundle/Composer/ScriptHandler.php | 14 ++-- .../Controller/Admin/AdminController.php | 4 +- .../Controller/Admin/SettingsController.php | 8 +-- .../Controller/CourseController.php | 2 +- .../Controller/CourseHomeController.php | 32 ++++----- .../Controller/EditorController.php | 4 +- src/CoreBundle/Controller/NewsController.php | 4 +- .../Controller/OnlineController.php | 4 +- .../Controller/ResetPasswordController.php | 4 +- .../Controller/ResourceController.php | 6 +- .../Controller/ResourceUploadController.php | 3 - .../Controller/SessionController.php | 2 +- src/CoreBundle/Controller/UserController.php | 4 +- .../Extension/CDocumentExtension.php | 2 +- .../Compiler/DoctrineEntityListenerPass.php | 2 +- .../Compiler/ToolCompilerClass.php | 2 +- 18 files changed, 67 insertions(+), 102 deletions(-) diff --git a/src/CoreBundle/Component/Resource/Template.php b/src/CoreBundle/Component/Resource/Template.php index d57d9ddd43..1d030377a9 100644 --- a/src/CoreBundle/Component/Resource/Template.php +++ b/src/CoreBundle/Component/Resource/Template.php @@ -60,7 +60,7 @@ class Template return $this->{$action}; } - throw new InvalidArgumentException("No template found for action: {$action}"); + throw new InvalidArgumentException(sprintf('No template found for action: %s', $action)); } public function setIndex(string $index): self diff --git a/src/CoreBundle/Component/Utils/ChamiloApi.php b/src/CoreBundle/Component/Utils/ChamiloApi.php index 695d92343c..0dc112ade1 100644 --- a/src/CoreBundle/Component/Utils/ChamiloApi.php +++ b/src/CoreBundle/Component/Utils/ChamiloApi.php @@ -36,11 +36,9 @@ class ChamiloApi } /** - * @param string $variable - * * @return bool|string */ - public static function getConfigurationValue($variable) + public static function getConfigurationValue(string $variable) { $configuration = self::getConfigurationArray(); if (array_key_exists($variable, $configuration)) { @@ -74,13 +72,9 @@ class ChamiloApi /** * Get the platform logo path. * - * @param string $theme - * @param bool $getSysPath - * @param bool $forcedGetter - * * @return null|string */ - public static function getPlatformLogoPath($theme = '', $getSysPath = false, $forcedGetter = false) + public static function getPlatformLogoPath(string $theme = '', bool $getSysPath = false, bool $forcedGetter = false) { static $logoPath; @@ -99,22 +93,22 @@ class ChamiloApi } } $themeDir = Template::getThemeDir($theme); - $customLogoPath = $themeDir."images/header-logo-custom{$accessUrlId}.png"; + $customLogoPath = $themeDir.sprintf('images/header-logo-custom%s.png', $accessUrlId); $svgIcons = api_get_setting('icons_mode_svg'); if ('true' === $svgIcons) { $customLogoPathSVG = substr($customLogoPath, 0, -3).'svg'; - if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPathSVG}")) { + if (file_exists(api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPathSVG))) { if ($getSysPath) { - return api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPathSVG}"; + return api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPathSVG); } return api_get_path(WEB_CSS_PATH).$customLogoPathSVG; } } - if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPath}")) { + if (file_exists(api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPath))) { if ($getSysPath) { - return api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPath}"; + return api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPath); } return api_get_path(WEB_CSS_PATH).$customLogoPath; @@ -147,20 +141,16 @@ class ChamiloApi /** * Get the platform logo. - * Return a if the logo image exists. Otherwise return a

with the institution name. - * - * @param string $theme - * @param array $imageAttributes optional - * @param bool $getSysPath - * @param bool $forcedGetter + * Return a if the logo image exists. + * Otherwise return a

with the institution name. * * @return string */ public static function getPlatformLogo( - $theme = '', - $imageAttributes = [], - $getSysPath = false, - $forcedGetter = false + string $theme = '', + array $imageAttributes = [], + bool $getSysPath = false, + bool $forcedGetter = false ) { $logoPath = self::getPlatformLogoPath($theme, $getSysPath, $forcedGetter); $institution = api_get_setting('Institution'); @@ -204,12 +194,11 @@ class ChamiloApi /** * Like strip_tags(), but leaves an additional space and removes only the given tags. * - * @param string $string - * @param array $tags Tags to be removed + * @param array $tags Tags to be removed * * @return string The original string without the given tags */ - public static function stripGivenTags($string, $tags) + public static function stripGivenTags(string $string, array $tags) { foreach ($tags as $tag) { $string2 = preg_replace('#]*>#i', ' ', $string); @@ -230,10 +219,12 @@ class ChamiloApi * * @return string */ - public static function addOrSubTimeToDateTime($time, $datetime = 'now', $operation = true) + public static function addOrSubTimeToDateTime(string $time, string $datetime = 'now', bool $operation = true) { $date = new DateTime($datetime); - $hours = $minutes = $seconds = 0; + $hours = 0; + $minutes = 0; + $seconds = 0; sscanf($time, '%d:%d:%d', $hours, $minutes, $seconds); $timeSeconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes; if ($operation) { @@ -252,7 +243,7 @@ class ChamiloApi * * @return int */ - public static function getCourseIdByDirectory($directory = null) + public static function getCourseIdByDirectory(string $directory = null) { if (!empty($directory)) { $directory = Database::escape_string($directory); @@ -292,12 +283,9 @@ class ChamiloApi /** * Get a variable name for language file from a text. * - * @param string $text - * @param string $prefix - * * @return string */ - public static function getLanguageVar($text, $prefix = '') + public static function getLanguageVar(string $text, string $prefix = '') { $text = api_replace_dangerous_char($text); $text = str_replace(['-', ' ', '.'], '_', $text); @@ -317,10 +305,10 @@ class ChamiloApi { $visualTheme = api_get_visual_theme(); - $cssFile = api_get_path(SYS_CSS_PATH)."themes/{$visualTheme}/document.css"; + $cssFile = api_get_path(SYS_CSS_PATH).sprintf('themes/%s/document.css', $visualTheme); if (is_file($cssFile)) { - return api_get_path(WEB_CSS_PATH)."themes/{$visualTheme}/document.css"; + return api_get_path(WEB_CSS_PATH).sprintf('themes/%s/document.css', $visualTheme); } return api_get_path(WEB_CSS_PATH).'document.css'; @@ -335,10 +323,10 @@ class ChamiloApi { $visualTheme = api_get_visual_theme(); - $cssFile = api_get_path(SYS_CSS_PATH)."themes/{$visualTheme}/editor_content.css"; + $cssFile = api_get_path(SYS_CSS_PATH).sprintf('themes/%s/editor_content.css', $visualTheme); if (is_file($cssFile)) { - return api_get_path(WEB_CSS_PATH)."themes/{$visualTheme}/editor_content.css"; + return api_get_path(WEB_CSS_PATH).sprintf('themes/%s/editor_content.css', $visualTheme); } return api_get_path(WEB_CSS_PATH).'editor_content.css'; @@ -355,9 +343,9 @@ class ChamiloApi * @return array An array of string colors */ public static function getColorPalette( - $decimalOpacity = false, - $wrapInRGBA = false, - $fillUpTo = null + bool $decimalOpacity = false, + bool $wrapInRGBA = false, + int $fillUpTo = null ) { // Get the common colors from the palette used for pchart $paletteFile = api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color'; @@ -399,7 +387,7 @@ class ChamiloApi * * @return DateTime */ - public static function getServerMidnightTime($utcTime = null) + public static function getServerMidnightTime(?string $utcTime = null) { $localTime = api_get_local_time($utcTime); $localTimeZone = api_get_timezone(); diff --git a/src/CoreBundle/Composer/ScriptHandler.php b/src/CoreBundle/Composer/ScriptHandler.php index 452697801e..b3ec619c52 100644 --- a/src/CoreBundle/Composer/ScriptHandler.php +++ b/src/CoreBundle/Composer/ScriptHandler.php @@ -261,13 +261,9 @@ class ScriptHandler /** * Copied from chamilo rmdirr function. * - * @param string $dirname - * @param bool|false $delete_only_content_in_folder - * @param bool|false $strict - * * @return bool */ - private static function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = false) + private static function rmdirr(string $dirname, bool $delete_only_content_in_folder = false, bool $strict = false) { $res = true; @@ -293,14 +289,14 @@ class ScriptHandler // Recurse. if ($strict) { - $result = self::rmdirr("{$dirname}/{$entry}"); - if (false === $result) { + $result = self::rmdirr(sprintf('%s/%s', $dirname, $entry)); + if (!$result) { $res = false; break; } } else { - self::rmdirr("{$dirname}/{$entry}"); + self::rmdirr(sprintf('%s/%s', $dirname, $entry)); } } } @@ -310,7 +306,7 @@ class ScriptHandler $dir->close(); } - if (false === $delete_only_content_in_folder) { + if (!$delete_only_content_in_folder) { $res = rmdir($dirname); } diff --git a/src/CoreBundle/Controller/Admin/AdminController.php b/src/CoreBundle/Controller/Admin/AdminController.php index e7e7176fd9..a08d246dfa 100644 --- a/src/CoreBundle/Controller/Admin/AdminController.php +++ b/src/CoreBundle/Controller/Admin/AdminController.php @@ -39,11 +39,9 @@ class AdminController extends BaseController } /** - * @param string $url - * * @return FormValidator */ - private function getSearchForm($url) + private function getSearchForm(string $url) { $form = new FormValidator( 'search-form', diff --git a/src/CoreBundle/Controller/Admin/SettingsController.php b/src/CoreBundle/Controller/Admin/SettingsController.php index 95df9be48b..4cbb93dd67 100644 --- a/src/CoreBundle/Controller/Admin/SettingsController.php +++ b/src/CoreBundle/Controller/Admin/SettingsController.php @@ -111,10 +111,8 @@ class SettingsController extends BaseController * @IsGranted("ROLE_ADMIN") * * @Route("/settings/{namespace}", name="chamilo_platform_settings") - * - * @param string $namespace */ - public function updateSettingAction(Request $request, $namespace): Response + public function updateSettingAction(Request $request, string $namespace): Response { $manager = $this->getSettingsManager(); // @todo improve get the current url entity @@ -169,9 +167,9 @@ class SettingsController extends BaseController try { $manager->save($form->getData()); $message = $this->trans('Settings have been successfully updated'); - } catch (ValidatorException $exception) { + } catch (ValidatorException $validatorException) { //$message = $this->trans($exception->getMessage(), [], 'validators'); - $message = $this->trans($exception->getMessage()); + $message = $this->trans($validatorException->getMessage()); $messageType = 'error'; } diff --git a/src/CoreBundle/Controller/CourseController.php b/src/CoreBundle/Controller/CourseController.php index 891afbf9a3..6c96ec8afb 100644 --- a/src/CoreBundle/Controller/CourseController.php +++ b/src/CoreBundle/Controller/CourseController.php @@ -87,7 +87,7 @@ class CourseController extends AbstractController $courseValues = new ExtraFieldValue('course'); - $urlCourse = api_get_path(WEB_PATH)."course/{$courseId}/about"; + $urlCourse = api_get_path(WEB_PATH).sprintf('course/%s/about', $courseId); $courseTeachers = $course->getTeachers(); $teachersData = []; diff --git a/src/CoreBundle/Controller/CourseHomeController.php b/src/CoreBundle/Controller/CourseHomeController.php index 9770ad13d5..2781d9c056 100644 --- a/src/CoreBundle/Controller/CourseHomeController.php +++ b/src/CoreBundle/Controller/CourseHomeController.php @@ -56,7 +56,7 @@ class CourseHomeController extends ToolBaseController $userId = 0; $user = $this->getUser(); - if ($user) { + if (null !== $user) { $userId = $this->getUser()->getId(); } @@ -80,10 +80,8 @@ class CourseHomeController extends ToolBaseController $isSpecialCourse = CourseManager::isSpecialCourse($courseId); - if ($user && $isSpecialCourse && (isset($_GET['autoreg']) && 1 === (int) $_GET['autoreg'])) { - if (CourseManager::subscribeUser($userId, $courseCode, STUDENT)) { - $session->set('is_allowed_in_course', true); - } + if ($user && $isSpecialCourse && (isset($_GET['autoreg']) && 1 === (int) $_GET['autoreg']) && CourseManager::subscribeUser($userId, $courseCode, STUDENT)) { + $session->set('is_allowed_in_course', true); } $action = empty($_GET['action']) ? '' : Security::remove_XSS($_GET['action']); @@ -116,6 +114,7 @@ class CourseHomeController extends ToolBaseController $qb = $toolRepository->getResourcesByCourse($course, $this->getSession()); $qb->addSelect('tool'); $qb->innerJoin('resource.tool', 'tool'); + $result = $qb->getQuery()->getResult(); $tools = []; /** @var CTool $item */ @@ -187,7 +186,7 @@ class CourseHomeController extends ToolBaseController Exercise::cleanSessionVariables(); $shortcuts = []; - if ($user) { + if (null !== $user) { $shortcutQuery = $shortcutRepository->getResources($user, $course->getResourceNode(), $course); $shortcuts = $shortcutQuery->getQuery()->getResult(); } @@ -235,14 +234,13 @@ class CourseHomeController extends ToolBaseController /** * Edit configuration with given namespace. * - * @param string $namespace * @Route("/{cid}/settings/{namespace}", name="chamilo_core_course_settings") * * @Entity("course", expr="repository.find(cid)") * * @return Response */ - public function updateSettingsAction(Request $request, Course $course, $namespace, SettingsCourseManager $manager, SettingsFormFactory $formFactory) + public function updateSettingsAction(Request $request, Course $course, string $namespace, SettingsCourseManager $manager, SettingsFormFactory $formFactory) { $schemaAlias = $manager->convertNameSpaceToService($namespace); $settings = $manager->load($namespace); @@ -259,8 +257,8 @@ class CourseHomeController extends ToolBaseController $manager->setCourse($course); $manager->save($form->getData()); $message = $this->trans('Update'); - } catch (ValidatorException $exception) { - $message = $this->trans($exception->getMessage()); + } catch (ValidatorException $validatorException) { + $message = $this->trans($validatorException->getMessage()); $messageType = 'error'; } $this->addFlash($messageType, $message); @@ -304,7 +302,7 @@ class CourseHomeController extends ToolBaseController // Redirecting to the LP $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq(); $_SESSION[$session_key] = true; - header("Location: {$url}"); + header(sprintf('Location: %s', $url)); exit; } } @@ -340,7 +338,7 @@ class CourseHomeController extends ToolBaseController 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['iid']; $_SESSION[$session_key] = true; - header("Location: {$url}"); + header(sprintf('Location: %s', $url)); exit; } } @@ -360,12 +358,12 @@ class CourseHomeController extends ToolBaseController if ($allowAutoLaunchForCourseAdmins) { if (empty($autoLaunchWarning)) { $autoLaunchWarning = get_lang( - 'The forum\'s auto-launch setting is on. Students will be redirected to the forum tool when entering this course.' + "The forum's auto-launch setting is on. Students will be redirected to the forum tool when entering this course." ); } } else { $url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq(); - header("Location: {$url}"); + header(sprintf('Location: %s', $url)); exit; } } @@ -382,7 +380,7 @@ class CourseHomeController extends ToolBaseController } else { // Redirecting to the document $url = api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq(); - header("Location: {$url}"); + header(sprintf('Location: %s', $url)); exit; } } elseif (1 === $exerciseAutoLaunch) { @@ -417,7 +415,7 @@ class CourseHomeController extends ToolBaseController $exerciseId = $row['iid']; $url = api_get_path(WEB_CODE_PATH). 'exercise/overview.php?exerciseId='.$exerciseId.'&'.api_get_cidreq(); - header("Location: {$url}"); + header(sprintf('Location: %s', $url)); exit; } } @@ -435,7 +433,7 @@ class CourseHomeController extends ToolBaseController } else { // Redirecting to the document $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(); - header("Location: {$url}"); + header("Location: $url"); exit; } } diff --git a/src/CoreBundle/Controller/EditorController.php b/src/CoreBundle/Controller/EditorController.php index 5009814d5c..ae1e3033f2 100644 --- a/src/CoreBundle/Controller/EditorController.php +++ b/src/CoreBundle/Controller/EditorController.php @@ -72,10 +72,8 @@ class EditorController extends BaseController /** * @Route("/resources/{tool}/{type}/{parentId}", methods={"GET"}, name="resources_filemanager") - * - * @param int $parentId */ - public function customEditorFileManager(ResourceFactory $resourceFactory, Request $request, $tool, $type, $parentId = 0): Response + public function customEditorFileManager(ResourceFactory $resourceFactory, Request $request, $tool, $type, int $parentId = 0): Response { $id = $request->get('id'); diff --git a/src/CoreBundle/Controller/NewsController.php b/src/CoreBundle/Controller/NewsController.php index 34074f0daa..859d3b95d4 100644 --- a/src/CoreBundle/Controller/NewsController.php +++ b/src/CoreBundle/Controller/NewsController.php @@ -46,10 +46,8 @@ class NewsController extends BaseController /** * @Route("/{id}", name="news", methods={"GET", "POST"}, options={"expose"=true}) - * - * @param int $id */ - public function newsAction($id = 0): Response + public function newsAction(int $id = 0): Response { $visibility = SystemAnnouncementManager::getCurrentUserVisibility(); diff --git a/src/CoreBundle/Controller/OnlineController.php b/src/CoreBundle/Controller/OnlineController.php index 2b877e5a27..72ebca33d0 100644 --- a/src/CoreBundle/Controller/OnlineController.php +++ b/src/CoreBundle/Controller/OnlineController.php @@ -61,10 +61,8 @@ class OnlineController extends BaseController /** * @Route("/in_sessions", name="online_users_in_session", methods={"GET", "POST"}, options={"expose"=true}) - * - * @param int $id */ - public function onlineUsersInCoursesSessionAction($id = 0): Response + public function onlineUsersInCoursesSessionAction(int $id = 0): Response { $users = who_is_online_in_this_course( 0, diff --git a/src/CoreBundle/Controller/ResetPasswordController.php b/src/CoreBundle/Controller/ResetPasswordController.php index 9993f65bf0..f7ee33a442 100644 --- a/src/CoreBundle/Controller/ResetPasswordController.php +++ b/src/CoreBundle/Controller/ResetPasswordController.php @@ -95,10 +95,10 @@ class ResetPasswordController extends AbstractController try { $user = $this->resetPasswordHelper->validateTokenAndFetchUser($token); - } catch (ResetPasswordExceptionInterface $e) { + } catch (ResetPasswordExceptionInterface $resetPasswordExceptionInterface) { $this->addFlash('reset_password_error', sprintf( 'There was a problem validating your reset request - %s', - $e->getReason() + $resetPasswordExceptionInterface->getReason() )); return $this->redirectToRoute('app_forgot_password_request'); diff --git a/src/CoreBundle/Controller/ResourceController.php b/src/CoreBundle/Controller/ResourceController.php index ed19dcaf76..4047edf3b0 100644 --- a/src/CoreBundle/Controller/ResourceController.php +++ b/src/CoreBundle/Controller/ResourceController.php @@ -159,7 +159,7 @@ class ResourceController extends AbstractResourceController implements CourseCon $course = $this->getCourse(); $totalSize = 0; - if ($course) { + if (null !== $course) { $totalSize = $course->getDiskQuota(); } @@ -750,11 +750,9 @@ class ResourceController extends AbstractResourceController implements CourseCon } /** - * @param string $fileType - * * @return RedirectResponse|Response */ - private function createResource(Request $request, $fileType = 'file') + private function createResource(Request $request, string $fileType = 'file') { $resourceNodeParentId = $request->get('id'); $repository = $this->getRepositoryFromRequest($request); diff --git a/src/CoreBundle/Controller/ResourceUploadController.php b/src/CoreBundle/Controller/ResourceUploadController.php index b770b23760..e5af11e21a 100644 --- a/src/CoreBundle/Controller/ResourceUploadController.php +++ b/src/CoreBundle/Controller/ResourceUploadController.php @@ -6,9 +6,7 @@ declare(strict_types=1); namespace Chamilo\CoreBundle\Controller; -use Chamilo\CoreBundle\Entity\AbstractResource; use Chamilo\CoreBundle\Entity\Course; -use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Entity\ResourceNode; use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Repository\ResourceFactory; @@ -18,7 +16,6 @@ use Oneup\UploaderBundle\Uploader\File\FileInterface; use Oneup\UploaderBundle\Uploader\File\FilesystemFile; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; use Symfony\Component\HttpFoundation\File\Exception\UploadException; -use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\JsonResponse; class ResourceUploadController extends BlueimpController diff --git a/src/CoreBundle/Controller/SessionController.php b/src/CoreBundle/Controller/SessionController.php index 9c87ea7394..c99e2d3bc3 100644 --- a/src/CoreBundle/Controller/SessionController.php +++ b/src/CoreBundle/Controller/SessionController.php @@ -235,7 +235,7 @@ class SessionController extends AbstractController //'sequences' => $sessionRequirements, 'is_premium' => $sessionIsPremium, 'show_tutor' => 'true' === api_get_setting('show_session_coach'), - 'page_url' => api_get_path(WEB_PATH)."sessions/{$session->getId()}/about/", + 'page_url' => api_get_path(WEB_PATH).sprintf('sessions/%s/about/', $session->getId()), 'session_date' => $sessionDates, 'is_subscribed' => SessionManager::isUserSubscribedAsStudent( $session->getId(), diff --git a/src/CoreBundle/Controller/UserController.php b/src/CoreBundle/Controller/UserController.php index 2d976ed404..ac68d970a0 100644 --- a/src/CoreBundle/Controller/UserController.php +++ b/src/CoreBundle/Controller/UserController.php @@ -23,10 +23,8 @@ class UserController extends AbstractController * Public profile. * * @Route("/{username}", methods={"GET"}, name="chamilo_core_user_profile") - * - * @param string $username */ - public function profileAction($username, UserRepository $userRepository, IllustrationRepository $illustrationRepository) + public function profileAction(string $username, UserRepository $userRepository, IllustrationRepository $illustrationRepository) { $user = $userRepository->findByUsername($username); diff --git a/src/CoreBundle/DataProvider/Extension/CDocumentExtension.php b/src/CoreBundle/DataProvider/Extension/CDocumentExtension.php index cb5b5a3261..909202c3f8 100644 --- a/src/CoreBundle/DataProvider/Extension/CDocumentExtension.php +++ b/src/CoreBundle/DataProvider/Extension/CDocumentExtension.php @@ -49,7 +49,7 @@ final class CDocumentExtension implements QueryCollectionExtensionInterface //, $rootAlias = $queryBuilder->getRootAliases()[0]; $queryBuilder - ->innerJoin("{$rootAlias}.resourceNode", 'node') + ->innerJoin("$rootAlias.resourceNode", 'node') ->innerJoin('node.resourceLinks', 'links') ; diff --git a/src/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php b/src/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php index b5cabb5d18..f4e2771255 100644 --- a/src/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php +++ b/src/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php @@ -16,7 +16,7 @@ class DoctrineEntityListenerPass implements CompilerPassInterface $definition = $container->getDefinition('chamilo.doctrine.entity_listener_resolver'); $services = $container->findTaggedServiceIds('doctrine.entity_listener'); - foreach ($services as $service => $attributes) { + foreach (array_keys($services) as $service) { $definition->addMethodCall( 'addMapping', [$container->getDefinition($service)->getClass(), $service] diff --git a/src/CoreBundle/DependencyInjection/Compiler/ToolCompilerClass.php b/src/CoreBundle/DependencyInjection/Compiler/ToolCompilerClass.php index b7b84e6d6c..72ed57f443 100644 --- a/src/CoreBundle/DependencyInjection/Compiler/ToolCompilerClass.php +++ b/src/CoreBundle/DependencyInjection/Compiler/ToolCompilerClass.php @@ -26,7 +26,7 @@ class ToolCompilerClass implements CompilerPassInterface if ($container->has(ToolChain::class)) { $definition = $container->findDefinition(ToolChain::class); $taggedServices = $container->findTaggedServiceIds('chamilo_core.tool'); - foreach ($taggedServices as $id => $attributes) { + foreach (array_keys($taggedServices) as $id) { $definition->addMethodCall('addTool', [new Reference($id)]); } }