Skip to content

EspoCRM – Open Source CRM Application

Deprecations, todo, CS

Yurii787712cf4497
diff --git a/application/Espo/Core/Repositories/Database.php b/application/Espo/Core/Repositories/Database.php
index 78aa6be5b3..a6400377b7 100644
--- a/application/Espo/Core/Repositories/Database.php
+++ b/application/Espo/Core/Repositories/Database.php
@@ -56,12 +56,12 @@ use stdClass;
*/
class Database extends RDBRepository
{
- private const ATTR_ID = 'id';
- private const ATTR_CREATED_BY_ID = Field::CREATED_BY . 'Id';
- private const ATTR_MODIFIED_BY_ID = Field::MODIFIED_BY . 'Id';
- private const ATTR_MODIFIED_BY_NAME = Field::MODIFIED_BY . 'Name';
- private const ATTR_CREATED_AT = Field::CREATED_AT;
- private const ATTR_MODIFIED_AT = Field::MODIFIED_AT;
+ private const string ATTR_ID = 'id';
+ private const string ATTR_CREATED_BY_ID = Field::CREATED_BY . 'Id';
+ private const string ATTR_MODIFIED_BY_ID = Field::MODIFIED_BY . 'Id';
+ private const string ATTR_MODIFIED_BY_NAME = Field::MODIFIED_BY . 'Name';
+ private const string ATTR_CREATED_AT = Field::CREATED_AT;
+ private const string ATTR_MODIFIED_AT = Field::MODIFIED_AT;
/**
* Disables hook processing.
@@ -117,12 +117,6 @@ class Database extends RDBRepository
return $this->metadata;
}
- /**
- * @deprecated Will be removed.
- */
- public function handleSelectParams(&$params) /** @phpstan-ignore-line */
- {}
-
/**
* @param TEntity $entity
* @param array<string, mixed> $options
@@ -183,6 +177,8 @@ class Database extends RDBRepository
* @param TEntity $entity
* @param array<string, mixed> $options
* @return void
+ *
+ * @todo Add final in v11.0.
*/
protected function beforeRemove(Entity $entity, array $options = [])
{
@@ -222,6 +218,8 @@ class Database extends RDBRepository
* @param TEntity $entity
* @param array<string, mixed> $options
* @return void
+ *
+ * @todo Add final in v11.0.
*/
protected function afterRemove(Entity $entity, array $options = [])
{
@@ -240,6 +238,8 @@ class Database extends RDBRepository
* @param array<string, mixed> $params
* @param array<string, mixed> $options
* @return void
+ *
+ * @todo Add final in v11.0.
*/
protected function afterMassRelate(Entity $entity, $relationName, array $params = [], array $options = [])
{
@@ -478,6 +478,7 @@ class Database extends RDBRepository
/**
* @pparam TEntity $entity
* @return mixed
+ * @noinspection PhpSameParameterValueInspection
*/
private function getAttributeParam(Entity $entity, string $attribute, string $param)
{
@@ -499,6 +500,7 @@ class Database extends RDBRepository
/**
* @param TEntity $entity
* @return mixed
+ * @noinspection PhpSameParameterValueInspection
*/
private function getRelationParam(Entity $entity, string $relation, string $param)
{
diff --git a/application/Espo/ORM/Repository/RDBRepository.php b/application/Espo/ORM/Repository/RDBRepository.php
index d69aab17aa..7187c74b1f 100644
--- a/application/Espo/ORM/Repository/RDBRepository.php
+++ b/application/Espo/ORM/Repository/RDBRepository.php
@@ -453,7 +453,7 @@ class RDBRepository implements Repository
* * `where(string $key, string $value)`
*
* @param WhereItem|array<scalar, mixed>|string $clause A key or where clause.
- * @param mixed[]|scalar|null $value A value. Should be omitted if the first argument is not string.
+ * @param array<int, mixed>|scalar|null $value A value. Should be omitted if the first argument is not string.
* @return RDBSelectBuilder<TEntity, EntityCollection<TEntity>>
*/
public function where($clause = [], $value = null): RDBSelectBuilder
@@ -470,7 +470,7 @@ class RDBRepository implements Repository
* * `having(string $key, string $value)`
*
* @param WhereItem|array<scalar, mixed>|string $clause A key or where clause.
- * @param mixed[]|scalar|null $value A value. Should be omitted if the first argument is not string.
+ * @param array<int, mixed>|scalar|null $value A value. Should be omitted if the first argument is not string.
* @return RDBSelectBuilder<TEntity, EntityCollection<TEntity>>
*/
public function having($clause = [], $value = null): RDBSelectBuilder
@@ -561,7 +561,8 @@ class RDBRepository implements Repository
}
/**
- * Use hooks instead.
+ * @deprecated Use hooks instead.
+ * @todo Change signature in v11.0. Add void.
*
* @param array<string, mixed> $options
* @return void
@@ -573,6 +574,7 @@ class RDBRepository implements Repository
/**
* @deprecated Use hooks instead.
+ * @todo Change signature in v11.0. Add void.
*
* @param array<string, mixed> $options
* @return void
@@ -584,6 +586,7 @@ class RDBRepository implements Repository
/**
* @deprecated Use hooks instead.
+ * @todo Change signature in v11.0. Add void.
*
* @param array<string, mixed> $options
* @return void
@@ -595,6 +598,7 @@ class RDBRepository implements Repository
/**
* @deprecated Use hooks instead.
+ * @todo Change signature in v11.0. Add void.
*
* @param array<string, mixed> $options
* @return void
@@ -617,6 +621,7 @@ class RDBRepository implements Repository
/**
* @deprecated As of v6.0. Use hooks instead.
+ * @todo Remove in v11.0.
* @phpstan-ignore-next-line
*/
protected function beforeRelate(Entity $entity, $relationName, $foreign, $data = null, array $options = [])
@@ -624,6 +629,7 @@ class RDBRepository implements Repository
/**
* @deprecated As of v6.0. Use hooks instead.
+ * @todo Change signature in v11.0. Add void.
* @phpstan-ignore-next-line
*/
protected function afterRelate(Entity $entity, $relationName, $foreign, $data = null, array $options = [])
@@ -631,6 +637,7 @@ class RDBRepository implements Repository
/**
* @deprecated As of v6.0. Use hooks instead.
+ * @todo Remove in v11.0.
* @phpstan-ignore-next-line
*/
protected function beforeUnrelate(Entity $entity, $relationName, $foreign, array $options = [])
@@ -638,6 +645,7 @@ class RDBRepository implements Repository
/**
* @deprecated As of v6.0. Use hooks instead.
+ * @todo Change signature in v11.0. Add void.
* @phpstan-ignore-next-line
*/
protected function afterUnrelate(Entity $entity, $relationName, $foreign, array $options = [])
@@ -645,6 +653,7 @@ class RDBRepository implements Repository
/**
* @deprecated As of v6.0. Use hooks instead.
+ * @todo Remove in v11.0.
* @phpstan-ignore-next-line
*/
protected function beforeMassRelate(Entity $entity, $relationName, array $params = [], array $options = [])
@@ -652,6 +661,7 @@ class RDBRepository implements Repository
/**
* @deprecated As of v6.0. Use hooks instead.
+ * @todo Change signature in v11.0. Add void.
* @phpstan-ignore-next-line
*/
protected function afterMassRelate(Entity $entity, $relationName, array $params = [], array $options = [])
@@ -718,7 +728,7 @@ class RDBRepository implements Repository
->findOne();
if (!$entity->isNew()) {
- $entity->setFetched($idAttribute, $previous ? $previous->getId() : null);
+ $entity->setFetched($idAttribute, $previous?->getId());
}
if ($previous) {