Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 committed Jan 4, 2025
1 parent fe0b1af commit 953451c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 37 deletions.
30 changes: 3 additions & 27 deletions .phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -1027,30 +1027,12 @@
'count' => 1,
'path' => __DIR__ . '/src/CommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc tag @var with type CommonDBTM is not subtype of native type null\\.$#',
'identifier' => 'varTag.nativeType',
'count' => 3,
'path' => __DIR__ . '/src/CommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^PHPDoc tag @var with type CommonDBTM is not subtype of native type string\\.$#',
'identifier' => 'varTag.nativeType',
'count' => 2,
'path' => __DIR__ . '/src/CommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^Right side of && is always true\\.$#',
'identifier' => 'booleanAnd.rightAlwaysTrue',
'count' => 1,
'path' => __DIR__ . '/src/CommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^Strict comparison using \\=\\=\\= between CommonDBTM and \'User\' will always evaluate to false\\.$#',
'identifier' => 'identical.alwaysFalse',
'count' => 1,
'path' => __DIR__ . '/src/CommonITILObject.php',
];
$ignoreErrors[] = [
'message' => '#^Strict comparison using \\=\\=\\= between false and int\\|string\\|null will always evaluate to false\\.$#',
'identifier' => 'identical.alwaysFalse',
Expand Down Expand Up @@ -3517,12 +3499,6 @@
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Search/Provider/SQLProvider.php',
];
$ignoreErrors[] = [
'message' => '#^Method Glpi\\\\Search\\\\Provider\\\\SQLProvider\\:\\:getWhereCriteria\\(\\) should return array\\|null but returns Glpi\\\\DBAL\\\\QueryExpression\\.$#',
'identifier' => 'return.type',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Search/Provider/SQLProvider.php',
];
$ignoreErrors[] = [
'message' => '#^Method Glpi\\\\Search\\\\Provider\\\\SQLProvider\\:\\:giveItem\\(\\) should return string but returns int\\.$#',
'identifier' => 'return.type',
Expand Down Expand Up @@ -5972,13 +5948,13 @@
'path' => __DIR__ . '/src/autoload/i18n.php',
];
$ignoreErrors[] = [
'message' => '#^Instanceof between static(PlanningExternalEvent) and ExtraVisibilityCriteria will always evaluate to true.$#',
'message' => '#^Instanceof between static\\(PlanningExternalEvent\\) and ExtraVisibilityCriteria will always evaluate to true\\.$#',
'identifier' => 'instanceof.alwaysTrue',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Features/PlanningEvent.php',
'path' => __DIR__ . '/src/PlanningExternalEvent.php',
];
$ignoreErrors[] = [
'message' => '#^Call to an undefined static method CommonDBTM::getVisibilityCriteria().$#',
'message' => '#^Call to an undefined static method CommonDBTM\\:\\:getVisibilityCriteria\\(\\)\\.$#',
'identifier' => 'staticMethod.notFound',
'count' => 2,
'path' => __DIR__ . '/src/CommonDBTM.php',
Expand Down
7 changes: 0 additions & 7 deletions src/CommonITILObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -10214,7 +10214,6 @@ public function addTeamMember(string $itemtype, int $items_id, array $params = [
}
$role = $params['role'] ?? CommonITILActor::ASSIGN;

/** @var CommonDBTM $link_class */
$link_class = null;
switch ($itemtype) {
case 'User':
Expand All @@ -10233,7 +10232,6 @@ public function addTeamMember(string $itemtype, int $items_id, array $params = [
}

$link_item = new $link_class();
/** @var CommonDBTM $itemtype */
$result = $link_item->add([
static::getForeignKeyField() => $this->getID(),
$itemtype::getForeignKeyField() => $items_id,
Expand All @@ -10246,7 +10244,6 @@ public function deleteTeamMember(string $itemtype, int $items_id, array $params
{
$role = $params['role'] ?? CommonITILActor::ASSIGN;

/** @var CommonDBTM $link_class */
$link_class = null;
switch ($itemtype) {
case 'User':
Expand All @@ -10265,7 +10262,6 @@ public function deleteTeamMember(string $itemtype, int $items_id, array $params
}

$link_item = new $link_class();
/** @var CommonDBTM $itemtype */
$result = $link_item->deleteByCriteria([
static::getForeignKeyField() => $this->getID(),
$itemtype::getForeignKeyField() => $items_id,
Expand All @@ -10283,9 +10279,7 @@ public function getTeam(): array

$team_itemtypes = static::getTeamItemtypes();

/** @var CommonDBTM $itemtype */
foreach ($team_itemtypes as $itemtype) {
/** @var CommonDBTM $link_class */
$link_class = null;
switch ($itemtype) {
case 'User':
Expand All @@ -10303,7 +10297,6 @@ public function getTeam(): array
continue;
}

$select = [];
if ($itemtype === 'User') {
$select = [$link_class::getTable() . '.' . $itemtype::getForeignKeyField(), 'type', 'name', 'realname', 'firstname'];
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/Glpi/Features/Teamwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ abstract public static function getTeamRoleName(int $role, int $nb = 1): string;

/**
* Get all types of team members that are supported by this item type
* @return array
* @return class-string<CommonDBTM>[]
*/
abstract public static function getTeamItemtypes(): array;

/**
* Add a team member to this item
* @param string $itemtype
* @param class-string<CommonDBTM> $itemtype
* @param int $items_id
* @param array $params
* @return bool
Expand All @@ -77,7 +77,7 @@ abstract public function addTeamMember(string $itemtype, int $items_id, array $p

/**
* Remove a team member to this item
* @param string $itemtype
* @param class-string<CommonDBTM> $itemtype
* @param int $items_id
* @param array $params
* @return bool
Expand Down

0 comments on commit 953451c

Please sign in to comment.