Fixed coding style.

This commit is contained in:
Jan Böhmer 2020-04-10 13:05:08 +02:00
parent a5e1f02d27
commit ae75e6844f
41 changed files with 147 additions and 163 deletions

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).
*
@ -20,7 +23,6 @@
namespace App\Entity\LogSystem;
use App\Entity\Base\AbstractDBElement;
use App\Entity\UserSystem\User;
use App\Events\SecurityEvents;
@ -57,24 +59,26 @@ class SecurityEventLogEntry extends AbstractLogEntry
public function setTargetElement(?AbstractDBElement $element): AbstractLogEntry
{
if (!$element instanceof User) {
if (! $element instanceof User) {
throw new \InvalidArgumentException('Target element must be a User object!');
}
return parent::setTargetElement($element);
}
/**
* Sets the type of this log entry.
* @param string $type
*
* @return $this
*/
public function setEventType(string $type): self
{
$key = array_search($type, static::SECURITY_TYPE_MAPPING);
if ($key === false) {
$key = array_search($type, static::SECURITY_TYPE_MAPPING, true);
if (false === $key) {
throw new \InvalidArgumentException('Given event type is not existing!');
}
$this->extra['e'] = $key;
return $this;
}
@ -84,7 +88,8 @@ class SecurityEventLogEntry extends AbstractLogEntry
}
/**
* Return what event this log entry represents (e.g. password_reset)
* Return what event this log entry represents (e.g. password_reset).
*
* @return string
*/
public function getEventType(): string
@ -121,6 +126,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
$ip = IpUtils::anonymize($ip);
}
$this->extra['i'] = $ip;
return $this;
}
}
}

View file

@ -42,7 +42,6 @@ declare(strict_types=1);
namespace App\Entity\LogSystem;
use App\Exceptions\LogEntryObsoleteException;
use Doctrine\ORM\Mapping as ORM;
/**
@ -62,6 +61,7 @@ class UserNotAllowedLogEntry extends AbstractLogEntry
/**
* Returns the path the user tried to accessed and what was denied.
*
* @return string
*/
public function getPath(): string

View file

@ -306,13 +306,13 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
/**
* Sets the amount of parts in the part lot.
* If null is passed, amount will be set to unknown.
* @param float|null $new_amount
*
* @return $this
*/
public function setAmount(?float $new_amount): self
{
//Treat null like unknown amount
if ($new_amount === null) {
if (null === $new_amount) {
$this->instock_unknown = true;
$new_amount = 0.0;
}

View file

@ -44,9 +44,9 @@ namespace App\Entity\Parts\PartTraits;
use App\Entity\PriceInformations\Orderdetail;
use App\Security\Annotations\ColumnSecurity;
use Doctrine\ORM\Mapping as ORM;
use function count;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* This trait collects all aspects of a part related to orders and priceinformations.

View file

@ -164,11 +164,10 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*
* You will get the price for $multiplier parts. If you want the price which is stored
* in the database, you have to pass the "price_related_quantity" count as $multiplier.
*
* @param float|string $multiplier The returned price (float or string) will be multiplied
* with this multiplier.
*
* @return null|string the price as a bcmath string
* @return string|null the price as a bcmath string
*/
public function getPricePerUnit($multiplier = 1.0): ?string
{

View file

@ -61,13 +61,16 @@ class U2FKey implements TwoFactorKeyInterface
/**
* We have to restrict the length here, as InnoDB only supports key index with max. 767 Bytes.
* Max length of keyhandles should be 128. (According to U2F_MAX_KH_SIZE in FIDO example C code).
*
* @ORM\Column(type="string", length=128)
*
* @var string
**/
public $keyHandle;
/**
* @ORM\Column(type="string")
*
* @var string
**/
public $publicKey;

View file

@ -508,7 +508,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
{
$tmp = $this->getFirstName();
//Dont add a space, if the name has only one part (it would look strange)
if (!empty($this->getFirstName()) && !empty($this->getLastName())) {
if (! empty($this->getFirstName()) && ! empty($this->getLastName())) {
$tmp .= ' ';
}
$tmp .= $this->getLastName();