Add stricter return type annotations in SocialIssue entity and remove redundant condition

This fix phpstan issue.
This commit is contained in:
2025-11-04 17:28:09 +01:00
parent 0f03413383
commit 514ec051c7

View File

@@ -122,6 +122,7 @@ class SocialIssue
* get all the ancestors of the social issue.
*
* @param bool $includeThis if the array in the result must include the present SocialIssue
* @return list<SocialIssue>
*/
public function getAncestors(bool $includeThis = true): array
{
@@ -176,7 +177,7 @@ class SocialIssue
}
/**
* @return Collection|SocialAction[] All the descendant social actions of the entity
* @return Collection<int, SocialAction> All the descendant social actions of the entity
*/
public function getDescendantsSocialActions(): Collection
{
@@ -239,7 +240,7 @@ class SocialIssue
}
/**
* @return Collection<SocialAction> All the social actions of the entity, it's
* @return Collection<int, SocialAction> All the social actions of the entity, it's
* the descendants and it's parents
*/
public function getRecursiveSocialActions(): Collection
@@ -249,17 +250,13 @@ class SocialIssue
// Get social actions from parent issues
foreach ($this->getAncestors(false) as $ancestor) {
foreach ($ancestor->getDescendantsSocialActions() as $descendant) {
if (!$recursiveSocialActions->contains($descendant)) {
$recursiveSocialActions->add($descendant);
}
$recursiveSocialActions->add($descendant);
}
}
foreach ($this->getDescendantsWithThis() as $socialIssue) {
foreach ($socialIssue->getDescendantsSocialActions() as $descendant) {
if (!$recursiveSocialActions->contains($descendant)) {
$recursiveSocialActions->add($descendant);
}
$recursiveSocialActions->add($descendant);
}
}