Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Controller/BoardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function import(): DataResponse {
if (!empty($file) && array_key_exists('error', $file) && $file['error'] !== UPLOAD_ERR_OK) {
$error = $phpFileUploadErrors[$file['error']];
}
if (!empty($file) && $file['error'] === UPLOAD_ERR_OK && !in_array($file['type'], ['application/json', 'text/plain'])) {
if (!empty($file) && $file['error'] === UPLOAD_ERR_OK && !in_array($file['type'], ['application/json', 'text/plain'], true)) {
$error = $this->l10n->t('Invalid file type. Only JSON files are allowed.');
}
if ($error !== null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/LabelMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function findAssignedLabelsForBoard(int $boardId, ?int $limit = null, int
}

public function insert(Entity $entity): Entity {
if (!in_array('lastModified', $entity->getUpdatedFields())) {
if (!isset($entity->getUpdatedFields()['lastModified'])) {
$entity->setLastModified(time());
}
return parent::insert($entity);
Expand Down
2 changes: 1 addition & 1 deletion lib/Listeners/CommentEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function handle(Event $event): void {
$applicableEvents = [
CommentsEvent::EVENT_UPDATE
];
if (in_array($eventType, $applicableEvents)) {
if (in_array($eventType, $applicableEvents, true)) {
$this->notificationHandler($event);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/BoardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ public function clone(
foreach ($stacks as $stack) {
$newStack = new Stack();
$newStack->setTitle($stack->getTitle());
if ($stack->getOrder() == null) {
if ($stack->getOrder() === null) {
$newStack->setOrder(999);
} else {
$newStack->setOrder($stack->getOrder());
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/CardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function update(int $id, string $title, int $stackId, string $type, strin
$resetDuedateNotification = false;
if (
$card->getDuedate() === null
|| ($card->getDuedate()) != ($changes->getBefore()->getDuedate())
|| ($card->getDuedate()) !== ($changes->getBefore()->getDuedate())
) {
$card->setNotified(false);
$resetDuedateNotification = true;
Expand Down Expand Up @@ -357,7 +357,7 @@ public function cloneCard(int $id, ?int $targetStackId = null):Card {
$newCard = $this->create($originCard->getTitle(), $targetStackId, $originCard->getType(), $originCard->getOrder(), $originCard->getOwner());
$boardId = $this->stackMapper->findBoardId($targetStackId);
foreach ($this->labelMapper->findAssignedLabelsForCard($id) as $label) {
if ($boardId != $this->stackMapper->findBoardId($originCard->getStackId())) {
if ($boardId !== $this->stackMapper->findBoardId($originCard->getStackId())) {
try {
$label = $this->labelService->cloneLabelIfNotExists($label->getId(), $boardId);
} catch (NoPermissionException $e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/DefaultBoardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function createDefaultBoard(string $title, string $userId, string $color)
);

foreach ($defaultLabels as $defaultLabel) {
if ($defaultLabel && in_array($defaultLabel->getTitle(), $cardData['labels'])) {
if ($defaultLabel && in_array($defaultLabel->getTitle(), $cardData['labels'], true)) {
$this->cardService->assignLabel($card->getId(), $defaultLabel->getId());
}
}
Expand Down
17 changes: 10 additions & 7 deletions lib/Service/Importer/BoardImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
class BoardImportService {
private string $system = '';
private ?ABoardImportService $systemInstance = null;
/** @var list<array{name: string, class: class-string, internalName: string}> */
private array $allowedSystems = [];
/**
* Data object created from config JSON
Expand Down Expand Up @@ -137,16 +138,12 @@ public function import(): void {
public function validateSystem(): void {
$allowedSystems = $this->getAllowedImportSystems();
$allowedSystems = array_column($allowedSystems, 'internalName');
if (!in_array($this->getSystem(), $allowedSystems)) {
if (!in_array($this->getSystem(), $allowedSystems, true)) {
throw new NotFoundException('Invalid system: ' . $this->getSystem());
}
}

/**
* @param ?string $system
* @return self
*/
public function setSystem($system): self {
public function setSystem(?string $system): self {
if ($system) {
$this->system = $system;
}
Expand All @@ -157,11 +154,17 @@ public function getSystem(): string {
return $this->system;
}

public function addAllowedImportSystem($system): self {
/**
* @param array{name: string, class: class-string, internalName: string} $system
*/
public function addAllowedImportSystem(array $system): self {
$this->allowedSystems[] = $system;
return $this;
}

/**
* @return list<array{name: string, class: class-string, internalName: string}>
*/
public function getAllowedImportSystems(): array {
if (!$this->allowedSystems) {
$this->addAllowedImportSystem([
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/Importer/Systems/TrelloJsonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function (\stdClass $a) use ($trelloCard) {

private function sortComments(array $comments): array {
$comparison = function (\stdClass $a, \stdClass $b): int {
if ($a->date == $b->date) {
if ($a->date === $b->date) {
return 0;
}
return ($a->date < $b->date) ? -1 : 1;
Expand Down Expand Up @@ -352,7 +352,7 @@ private function replaceUsernames(string $text): string {
}

private function checklistItem(\stdClass $item): string {
if (($item->state == 'incomplete')) {
if (($item->state === 'incomplete')) {
$string_start = '- [ ]';
} else {
$string_start = '- [x]';
Expand Down
5 changes: 2 additions & 3 deletions lib/Validators/BaseValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,12 @@ protected function getSize($value): int {
}

/**
* @param $rule
* @param $field
* @param $parameter
* @return string
*/
protected function getErrorMessage($rule, $field, $parameter = null): string {
if (in_array($rule, ['max', 'min'])) {
protected function getErrorMessage(string $rule, $field, $parameter = null): string {
if (in_array($rule, ['max', 'min'], true)) {
return $rule === 'max'
? $field . ' cannot be longer than ' . $parameter . ' characters '
: $field . ' must be at least ' . $parameter . ' characters long ';
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/base-query-count.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
83517
84323
2 changes: 1 addition & 1 deletion tests/integration/import/ImportExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static function writeArrayStructure(string $prefix = '', array $array = [
$arrayIsList = array_keys($array) === range(0, count($array) - 1);
foreach ($array as $key => $value) {
$tmpPrefix = $prefix;
if (in_array($key, $skipKeyList)) {
if (in_array($key, $skipKeyList, true)) {
continue;
}
if (is_array($value)) {
Expand Down
Loading