Applied rector suggestions

This commit is contained in:
Jan Böhmer 2024-06-22 00:31:43 +02:00
parent 4106bcef5f
commit 20f32c7f12
170 changed files with 808 additions and 761 deletions

View file

@ -55,7 +55,8 @@ abstract class AbstractLogEntry extends AbstractDBElement
#[ORM\Column(type: Types::STRING)]
protected string $username = '';
/** @var \DateTime The datetime the event associated with this log entry has occured
/**
* @var \DateTimeInterface The datetime the event associated with this log entry has occured
*/
#[ORM\Column(name: 'datetime', type: Types::DATETIME_MUTABLE)]
protected \DateTime $timestamp;

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -17,7 +20,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Entity\LogSystem;
use Psr\Log\LogLevel as PSRLogLevel;

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -17,7 +20,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Entity\LogSystem;
use App\Entity\Attachments\Attachment;
@ -120,7 +122,7 @@ enum LogTargetType: int
}
}
$elementClass = is_object($element) ? get_class($element) : $element;
$elementClass = is_object($element) ? $element::class : $element;
//If no matching type was found, throw an exception
throw new \InvalidArgumentException("The given class $elementClass is not a valid log target type.");
}

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -17,7 +20,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Entity\LogSystem;
use App\Entity\Contracts\LogWithEventUndoInterface;
@ -48,4 +50,4 @@ trait LogWithEventUndoTrait
$mode_int = $this->extra['um'] ?? 1;
return EventUndoMode::fromExtraInt($mode_int);
}
}
}

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -17,7 +20,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Entity\LogSystem;
enum PartStockChangeType: string
@ -53,4 +55,4 @@ enum PartStockChangeType: string
default => throw new \InvalidArgumentException("Invalid short type: $value"),
};
}
}
}

View file

@ -52,8 +52,6 @@ class PartStockChangedLogEntry extends AbstractLogEntry
$this->level = LogLevel::INFO;
$this->setTargetElement($lot);
$this->typeString = 'part_stock_changed';
$this->extra = array_merge($this->extra, [
't' => $type->toExtraShortType(),
'o' => $old_stock,