diff --git a/application/Espo/Core/Acl/Table/DefaultTable.php b/application/Espo/Core/Acl/Table/DefaultTable.php index 1534555c27..b7fed64867 100644 --- a/application/Espo/Core/Acl/Table/DefaultTable.php +++ b/application/Espo/Core/Acl/Table/DefaultTable.php @@ -228,7 +228,7 @@ class DefaultTable implements Table $fieldTableList[] = $role->getFieldTableData(); foreach ($this->valuePermissionList as $permissionKey) { - $permission = $this->normilizePermissionName($permissionKey); + $permission = $this->normalizePermissionName($permissionKey); $valuePermissionLists->{$permissionKey}[] = $role->getPermissionLevel($permission); } @@ -263,7 +263,7 @@ class DefaultTable implements Table if (!$this->user->isAdmin()) { foreach ($this->valuePermissionList as $permissionKey) { - $permission = $this->normilizePermissionName($permissionKey); + $permission = $this->normalizePermissionName($permissionKey); $defaultLevel = $this->metadata ->get(['app', $this->type, 'permissionsStrictDefaults', $permissionKey]) ?? @@ -284,7 +284,7 @@ class DefaultTable implements Table if ($this->user->isAdmin()) { foreach ($this->valuePermissionList as $permissionKey) { - $permission = $this->normilizePermissionName($permissionKey); + $permission = $this->normalizePermissionName($permissionKey); $highestLevel = $this->metadata ->get(['app', $this->type, 'valuePermissionHighestLevels', $permissionKey]); @@ -300,7 +300,7 @@ class DefaultTable implements Table } } - private function normilizePermissionName(string $permissionKey): string + private function normalizePermissionName(string $permissionKey): string { $permission = $permissionKey; diff --git a/application/Espo/Core/HookManager.php b/application/Espo/Core/HookManager.php index 958f44bdbc..3b3a910f7b 100644 --- a/application/Espo/Core/HookManager.php +++ b/application/Espo/Core/HookManager.php @@ -223,7 +223,7 @@ class HookManager foreach ($fileList as $scopeName => $hookFiles) { $hookScopeDirPath = Util::concatPath($hookDir, $scopeName); - $normalizedScopeName = Util::normilizeScopeName($scopeName); + $normalizedScopeName = Util::normalizeScopeName($scopeName); foreach ($hookFiles as $hookFile) { $hookFilePath = Util::concatPath($hookScopeDirPath, $hookFile); diff --git a/application/Espo/Core/Utils/File/ClassMap.php b/application/Espo/Core/Utils/File/ClassMap.php index 34c6164005..d2f13a7ab8 100644 --- a/application/Espo/Core/Utils/File/ClassMap.php +++ b/application/Espo/Core/Utils/File/ClassMap.php @@ -191,7 +191,7 @@ class ClassMap continue; } - $name = Util::normilizeScopeName(ucfirst($fileName)); + $name = Util::normalizeScopeName(ucfirst($fileName)); $name = $category . $name; diff --git a/application/Espo/Core/Utils/Util.php b/application/Espo/Core/Utils/Util.php index a221c75337..ed56772d64 100644 --- a/application/Espo/Core/Utils/Util.php +++ b/application/Espo/Core/Utils/Util.php @@ -356,11 +356,12 @@ class Util * @param string $name * @return string */ - public static function normilizeClassName($name) + public static function normalizeClassName($name) { if (in_array($name, self::$reservedWordList)) { $name .= 'Obj'; } + return $name; } @@ -370,7 +371,7 @@ class Util * @param string $name * @return string */ - public static function normilizeScopeName($name) + public static function normalizeScopeName($name) { foreach (self::$reservedWordList as $reservedWord) { if ($reservedWord.'Obj' == $name) { @@ -1005,4 +1006,26 @@ class Util return implode('', $shuffle($array)); } + + /** + * @deprecated Use `normalizeScopeName`. + * + * @param string $name + * @return string + */ + public static function normilizeScopeName($name) + { + return self::normalizeScopeName($name); + } + + /** + * @deprecated Use `normalizeClassName`. + * + * @param string $name + * @return string + */ + public static function normilizeClassName($name) + { + return self::normalizeClassName($name); + } } diff --git a/application/Espo/ORM/Query/SelectingBuilderTrait.php b/application/Espo/ORM/Query/SelectingBuilderTrait.php index fa194b1578..819ea9d92f 100644 --- a/application/Espo/ORM/Query/SelectingBuilderTrait.php +++ b/application/Espo/ORM/Query/SelectingBuilderTrait.php @@ -49,7 +49,7 @@ trait SelectingBuilderTrait * * `where(array $clause)` * * `where(string $key, string $value)` * - * @param WhereItem|array|string $clause A key or where clause. + * @param WhereItem|array|string $clause A key or where clause. * @param mixed[]|scalar|null $value A value. Omitted if the first argument is not string. */ public function where($clause, $value = null): self @@ -60,7 +60,7 @@ trait SelectingBuilderTrait } /** - * @param WhereItem|array|string $clause A key or where clause. + * @param WhereItem|array|string $clause A key or where clause. * @param mixed[]|scalar|null $value A value. Omitted if the first argument is not string. */ private function applyWhereClause(string $type, $clause, $value): void @@ -99,8 +99,6 @@ trait SelectingBuilderTrait } $this->params[$type] = $new + $original; - - return; } /** @@ -186,7 +184,7 @@ trait SelectingBuilderTrait * @param Join|string $target * A relation name or table. A relation name should be in camelCase, a table in CamelCase. * @param string|null $alias An alias. - * @param WhereItem|array|null $conditions Join conditions. + * @param WhereItem|array|null $conditions Join conditions. */ private function joinInternal(string $type, $target, ?string $alias = null, $conditions = null): self { @@ -308,8 +306,6 @@ trait SelectingBuilderTrait /** @var array{0:string,1?:string} $newItem */ $resultList[] = $newItem; - - continue; } return $resultList; diff --git a/application/Espo/Services/Record.php b/application/Espo/Services/Record.php index beb80fbb08..f5d4b3584b 100644 --- a/application/Espo/Services/Record.php +++ b/application/Espo/Services/Record.php @@ -93,7 +93,7 @@ class Record extends RecordService implements $name = $matches[1]; } - $this->entityType = Util::normilizeScopeName($name); + $this->entityType = Util::normalizeScopeName($name); } // to be removed diff --git a/application/Espo/Tools/EntityManager/EntityManager.php b/application/Espo/Tools/EntityManager/EntityManager.php index 851f74916a..c1f531ae20 100644 --- a/application/Espo/Tools/EntityManager/EntityManager.php +++ b/application/Espo/Tools/EntityManager/EntityManager.php @@ -150,7 +150,7 @@ class EntityManager throw new Conflict("Entity name '{$name}' is not allowed."); } - $normalizedName = Util::normilizeClassName($name); + $normalizedName = Util::normalizeClassName($name); $templateNamespace = "\Espo\Core\Templates"; @@ -160,7 +160,7 @@ class EntityManager if (!empty($templateDefs['module'])) { $templateModuleName = $templateDefs['module']; - $normalizedTemplateModuleName = Util::normilizeClassName($templateModuleName); + $normalizedTemplateModuleName = Util::normalizeClassName($templateModuleName); $templateNamespace = "\Espo\Modules\\{$normalizedTemplateModuleName}\Core\Templates"; @@ -600,7 +600,7 @@ class EntityManager throw new Forbidden; } - $normalizedName = Util::normilizeClassName($name); + $normalizedName = Util::normalizeClassName($name); $type = $this->metadata->get(['scopes', $name, 'type']); @@ -1582,7 +1582,7 @@ class EntityManager if (!empty($templateDefs['module'])) { $templateModuleName = $templateDefs['module']; - $normalizedTemplateModuleName = Util::normilizeClassName($templateModuleName); + $normalizedTemplateModuleName = Util::normalizeClassName($templateModuleName); $className = 'Espo\\Modules\\' . $normalizedTemplateModuleName . diff --git a/application/Espo/Tools/EntityManager/NameUtil.php b/application/Espo/Tools/EntityManager/NameUtil.php index 74ebafa6ba..8bf09bab82 100644 --- a/application/Espo/Tools/EntityManager/NameUtil.php +++ b/application/Espo/Tools/EntityManager/NameUtil.php @@ -140,7 +140,7 @@ class NameUtil return true; } - if ($name !== Util::normilizeScopeName($name)) { + if ($name !== Util::normalizeScopeName($name)) { return true; } @@ -178,7 +178,7 @@ class NameUtil private function controllerExists(string $name): bool { - $controllerClassName = 'Espo\\Custom\\Controllers\\' . Util::normilizeClassName($name); + $controllerClassName = 'Espo\\Custom\\Controllers\\' . Util::normalizeClassName($name); if (class_exists($controllerClassName)) { return true; @@ -186,14 +186,14 @@ class NameUtil foreach ($this->metadata->getModuleList() as $moduleName) { $controllerClassName = - 'Espo\\Modules\\' . $moduleName . '\\Controllers\\' . Util::normilizeClassName($name); + 'Espo\\Modules\\' . $moduleName . '\\Controllers\\' . Util::normalizeClassName($name); if (class_exists($controllerClassName)) { return true; } } - $controllerClassName = 'Espo\\Controllers\\' . Util::normilizeClassName($name); + $controllerClassName = 'Espo\\Controllers\\' . Util::normalizeClassName($name); if (class_exists($controllerClassName)) { return true; diff --git a/client/src/views/admin/layouts/grid.js b/client/src/views/admin/layouts/grid.js index 0ef8112344..af296e4286 100644 --- a/client/src/views/admin/layouts/grid.js +++ b/client/src/views/admin/layouts/grid.js @@ -94,7 +94,7 @@ function (Dep, styleCss) { this.panels.splice(index, 1); } - this.normilizeDisabledItemList(); + this.normalizeDisabledItemList(); this.setIsChanged(); }, @@ -116,7 +116,7 @@ function (Dep, styleCss) { $(e.target).closest('ul.rows > li').remove(); - this.normilizeDisabledItemList(); + this.normalizeDisabledItemList(); this.setIsChanged(); }, @@ -237,7 +237,7 @@ function (Dep, styleCss) { } }, Dep.prototype.events), - normilizeDisabledItemList: function () { + normalizeDisabledItemList: function () { $('#layout ul.cells.disabled > li').each((i, el) => { }); }, diff --git a/dev/PHPStan/Extensions/EntityManagerReturnType.php b/dev/PHPStan/Extensions/EntityManagerReturnType.php index cbb64fe69e..7de682f863 100644 --- a/dev/PHPStan/Extensions/EntityManagerReturnType.php +++ b/dev/PHPStan/Extensions/EntityManagerReturnType.php @@ -151,7 +151,7 @@ class EntityManagerReturnType implements DynamicMethodReturnTypeExtension private function findEntityClassName(string $entityType): ?string { foreach ($this->entityNamespaceList as $namespace) { - $className = $namespace . '\\' . Util::normilizeClassName($entityType); + $className = $namespace . '\\' . Util::normalizeClassName($entityType); if (class_exists($className)) { return $className;