Fixed code style.

This commit is contained in:
Jan Böhmer 2020-08-21 21:36:22 +02:00
parent 2853e471c4
commit d0b1024d80
212 changed files with 495 additions and 1005 deletions

View file

@ -51,8 +51,6 @@ class EventCommentHelper
/**
* Returns the currently set message, or null if no message is set yet.
*
* @return string|null
*/
public function getMessage(): ?string
{
@ -69,8 +67,6 @@ class EventCommentHelper
/**
* Check if a message is currently set.
*
* @return bool
*/
public function isMessageSet(): bool
{

View file

@ -68,7 +68,7 @@ class EventLogger
* Adds the given log entry to the Log, if the entry fullfills the global configured criterias.
* The change will not be flushed yet.
*
* @return bool Returns true, if the event was added to log.
* @return bool returns true, if the event was added to log
*/
public function log(AbstractLogEntry $logEntry): bool
{
@ -99,7 +99,7 @@ class EventLogger
/**
* Adds the given log entry to the Log, if the entry fullfills the global configured criterias and flush afterwards.
*
* @return bool Returns true, if the event was added to log.
* @return bool returns true, if the event was added to log
*/
public function logAndFlush(AbstractLogEntry $logEntry): bool
{
@ -126,12 +126,12 @@ class EventLogger
}
//Check if the event type is black listed
if (! empty($blacklist) && $this->isObjectClassInArray($logEntry, $blacklist)) {
if (!empty($blacklist) && $this->isObjectClassInArray($logEntry, $blacklist)) {
return false;
}
//Check for whitelisting
if (! empty($whitelist) && ! $this->isObjectClassInArray($logEntry, $whitelist)) {
if (!empty($whitelist) && !$this->isObjectClassInArray($logEntry, $whitelist)) {
return false;
}
@ -143,9 +143,7 @@ class EventLogger
* Check if the object type is given in the classes array. This also works for inherited types.
*
* @param object $object The object which should be checked
* @param string[] $classes The list of class names that should be used for checking.
*
* @return bool
* @param string[] $classes the list of class names that should be used for checking
*/
protected function isObjectClassInArray(object $object, array $classes): bool
{

View file

@ -43,7 +43,7 @@ class EventUndoHelper
public function setMode(string $mode): void
{
if (! in_array($mode, self::ALLOWED_MODES, true)) {
if (!in_array($mode, self::ALLOWED_MODES, true)) {
throw new \InvalidArgumentException('Invalid mode passed!');
}
$this->mode = $mode;
@ -65,8 +65,6 @@ class EventUndoHelper
/**
* Returns event that is currently undone.
*
* @return AbstractLogEntry|null
*/
public function getUndoneEvent(): ?AbstractLogEntry
{
@ -83,8 +81,6 @@ class EventUndoHelper
/**
* Check if a event is undone.
*
* @return bool
*/
public function isUndo(): bool
{

View file

@ -38,8 +38,6 @@ class HistoryHelper
* Returns an array containing all elements that are associated with the argument.
* The returned array contains the given element.
*
* @return array
*
* @psalm-return array<\App\Entity\Parameters\AbstractParameter|array-key, mixed>
*/
public function getAssociatedElements(AbstractDBElement $element): array

View file

@ -77,8 +77,6 @@ class LogEntryExtraFormatter
/**
* Return an user viewable representation of the extra data in a log entry, styled for console output.
*
* @return string
*/
public function formatConsole(AbstractLogEntry $logEntry): string
{
@ -92,7 +90,7 @@ class LogEntryExtraFormatter
$str .= '<error>'.$this->translator->trans($key).'</error>: ';
}
$str .= $value;
if (! empty($str)) {
if (!empty($str)) {
$tmp[] = $str;
}
}
@ -102,8 +100,6 @@ class LogEntryExtraFormatter
/**
* Return a HTML formatted string containing a user viewable form of the Extra data.
*
* @return string
*/
public function format(AbstractLogEntry $context): string
{
@ -117,7 +113,7 @@ class LogEntryExtraFormatter
$str .= '<b>'.$this->translator->trans($key).'</b>: ';
}
$str .= $value;
if (! empty($str)) {
if (!empty($str)) {
$tmp[] = $str;
}
}
@ -187,7 +183,7 @@ class LogEntryExtraFormatter
'%s <i class="fas fa-long-arrow-alt-right"></i> %s (%s)',
$context->getOldInstock(),
$context->getNewInstock(),
(! $context->isWithdrawal() ? '+' : '-').$context->getDifference(true)
(!$context->isWithdrawal() ? '+' : '-').$context->getDifference(true)
);
$array['log.instock_changed.comment'] = htmlspecialchars($context->getComment());
}

View file

@ -52,9 +52,7 @@ class TimeTravel
* Undeletes the element with the given ID.
*
* @param string $class The class name of the element that should be undeleted
* @param int $id The ID of the element that should be undeleted.
*
* @return AbstractDBElement
* @param int $id the ID of the element that should be undeleted
*/
public function undeleteEntity(string $class, int $id): AbstractDBElement
{
@ -80,7 +78,7 @@ class TimeTravel
*/
public function revertEntityToTimestamp(AbstractDBElement $element, \DateTime $timestamp, array $reverted_elements = []): void
{
if (! $element instanceof TimeStampableInterface) {
if (!$element instanceof TimeStampableInterface) {
throw new \InvalidArgumentException('$element must have a Timestamp!');
}
@ -154,7 +152,7 @@ class TimeTravel
foreach ($target_elements as $target_element) {
if (null !== $target_element && $element->getLastModified() >= $timestamp) {
//Remove the element from collection, if it did not existed at $timestamp
if (! $this->repo->getElementExistedAtTimestamp($target_element, $timestamp)) {
if (!$this->repo->getElementExistedAtTimestamp($target_element, $timestamp)) {
if ($target_elements instanceof Collection) {
$target_elements->removeElement($target_element);
}
@ -174,10 +172,10 @@ class TimeTravel
public function applyEntry(AbstractDBElement $element, TimeTravelInterface $logEntry): void
{
//Skip if this does not provide any info...
if (! $logEntry->hasOldDataInformations()) {
if (!$logEntry->hasOldDataInformations()) {
return;
}
if (! $element instanceof TimeStampableInterface) {
if (!$element instanceof TimeStampableInterface) {
return;
}
$metadata = $this->em->getClassMetadata(get_class($element));
@ -185,8 +183,7 @@ class TimeTravel
foreach ($old_data as $field => $data) {
if ($metadata->hasField($field)) {
if ($metadata->getFieldMapping($field)['type'] === 'big_decimal') {
if ('big_decimal' === $metadata->getFieldMapping($field)['type']) {
//We need to convert the string to a BigDecimal first
if (!$data instanceof BigDecimal) {
$data = BigDecimal::of($data);
@ -227,7 +224,6 @@ class TimeTravel
$property = $reflection->getProperty($field);
$property->setAccessible(true);
$property->setValue($element, $new_value);
}
}