mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
639829f5c5
commit
8e6bc25d2e
19 changed files with 39 additions and 40 deletions
|
@ -81,7 +81,7 @@
|
|||
"phpstan/phpstan-doctrine": "^1.2.11",
|
||||
"phpstan/phpstan-symfony": "^1.1.7",
|
||||
"psalm/plugin-symfony": "^3.0.3",
|
||||
"roave/security-advisories": "dev-master",
|
||||
"roave/security-advisories": "dev-latest",
|
||||
"symfony/browser-kit": "^5.2",
|
||||
"symfony/css-selector": "^5.2",
|
||||
"symfony/debug-bundle": "^5.2",
|
||||
|
|
|
@ -252,12 +252,12 @@ class UserController extends AdminPages\BaseAdminController
|
|||
/**
|
||||
* Get either a Gravatar URL or complete image tag for a specified email address.
|
||||
*
|
||||
* @param string $email The email address
|
||||
* @param int $s Size in pixels, defaults to 80px [ 1 - 2048 ]
|
||||
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
|
||||
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
|
||||
* @param bool $img True to return a complete IMG tag False for just the URL
|
||||
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
|
||||
* @param string|null $email The email address
|
||||
* @param int $s Size in pixels, defaults to 80px [ 1 - 2048 ]
|
||||
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
|
||||
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
|
||||
* @param bool $img True to return a complete IMG tag False for just the URL
|
||||
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
|
||||
*
|
||||
* @return string containing either just a URL or a complete image tag
|
||||
* @source https://gravatar.com/site/implement/images/php/
|
||||
|
|
|
@ -52,8 +52,8 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface
|
|||
/**
|
||||
* Construct new purger instance.
|
||||
*
|
||||
* @param EntityManagerInterface $em EntityManagerInterface instance used for persistence.
|
||||
* @param string[] $excluded array of table/view names to be excluded from purge
|
||||
* @param EntityManagerInterface|null $em EntityManagerInterface instance used for persistence.
|
||||
* @param string[] $excluded array of table/view names to be excluded from purge
|
||||
*/
|
||||
public function __construct(?EntityManagerInterface $em = null, array $excluded = [])
|
||||
{
|
||||
|
|
|
@ -297,7 +297,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Sets the new parent object.
|
||||
*
|
||||
* @param self $new_parent The new parent object
|
||||
* @param AbstractStructuralDBElement|null $new_parent The new parent object
|
||||
*
|
||||
* @return AbstractStructuralDBElement
|
||||
*/
|
||||
|
@ -316,7 +316,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Set the comment.
|
||||
*
|
||||
* @param string $new_comment the new comment
|
||||
* @param string|null $new_comment the new comment
|
||||
*
|
||||
* @return AbstractStructuralDBElement
|
||||
*/
|
||||
|
|
|
@ -342,7 +342,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
/**
|
||||
* Sets the target element associated with this element.
|
||||
*
|
||||
* @param AbstractDBElement $element the element that should be associated with this element
|
||||
* @param AbstractDBElement|null $element the element that should be associated with this element
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
|
@ -302,7 +302,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
/**
|
||||
* Sets the typical value of this property.
|
||||
*
|
||||
* @param float $value_typical
|
||||
* @param float|null $value_typical
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
|
@ -119,7 +119,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $unit
|
||||
* @param string|null $unit
|
||||
*
|
||||
* @return MeasurementUnit
|
||||
*/
|
||||
|
|
|
@ -197,7 +197,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
/**
|
||||
* Sets the expiration date for the part lot. Set to null, if the part lot does not expires.
|
||||
*
|
||||
* @param DateTime $expiration_date
|
||||
* @param DateTime|null $expiration_date
|
||||
*
|
||||
* @return PartLot
|
||||
*/
|
||||
|
|
|
@ -166,7 +166,7 @@ trait BasicPropertyTrait
|
|||
/**
|
||||
* Sets the description of this part.
|
||||
*
|
||||
* @param string $new_description the new description
|
||||
* @param string|null $new_description the new description
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -195,7 +195,7 @@ trait BasicPropertyTrait
|
|||
* Set the category of this Part.
|
||||
* The category property is required for every part, so you can not pass null like the other properties (footprints).
|
||||
*
|
||||
* @param Category $category The new category of this part
|
||||
* @param Category|null $category The new category of this part
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
|
@ -134,7 +134,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $iso_code
|
||||
* @param string|null $iso_code
|
||||
*
|
||||
* @return Currency
|
||||
*/
|
||||
|
|
|
@ -537,7 +537,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the first name of the user.
|
||||
*
|
||||
* @param string $first_name The new first name
|
||||
* @param string|null $first_name The new first name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -559,7 +559,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the last name of the user.
|
||||
*
|
||||
* @param string $last_name The new last name
|
||||
* @param string|null $last_name The new last name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -583,7 +583,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the department of the user.
|
||||
*
|
||||
* @param string $department The new department
|
||||
* @param string|null $department The new department
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
|
@ -607,7 +607,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the email of the user.
|
||||
*
|
||||
* @param string $email The new email adress
|
||||
* @param string|null $email The new email adress
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
|
@ -106,7 +106,6 @@ class CollectionTypeExtension extends AbstractTypeExtension
|
|||
* Set the option of the form.
|
||||
* This a bit hacky cause we access private properties....
|
||||
*
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function setOption(FormBuilder $builder, string $option, $value): void
|
||||
{
|
||||
|
|
|
@ -276,11 +276,11 @@ final class TreeViewNode implements JsonSerializable
|
|||
$ret['state'] = $this->state;
|
||||
}
|
||||
|
||||
if ($this->href == null) {
|
||||
if ($this->href === null) {
|
||||
$ret['selectable'] = false;
|
||||
}
|
||||
|
||||
if ($this->icon != null) {
|
||||
if ($this->icon !== null) {
|
||||
$ret['icon'] = $this->icon;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,17 +30,18 @@ abstract class AbstractPartsContainingRepository extends StructuralDBElementRepo
|
|||
/**
|
||||
* Returns all parts associated with this element.
|
||||
*
|
||||
* @param AbstractPartsContainingDBElement $element the element for which the parts should be determined
|
||||
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
|
||||
* @param object $element the element for which the parts should be determined
|
||||
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
|
||||
*
|
||||
* @return Part[]
|
||||
* @return Part
|
||||
*/
|
||||
abstract public function getParts(object $element, array $order_by = ['name' => 'ASC']): array;
|
||||
|
||||
/**
|
||||
* Gets the count of the parts associated with this element.
|
||||
*
|
||||
* @param AbstractPartsContainingDBElement $element the element for which the parts should be determined
|
||||
* @param object $element the element for which the parts should be determined
|
||||
* @return int
|
||||
*/
|
||||
abstract public function getPartsCount(object $element): int;
|
||||
|
||||
|
|
|
@ -195,9 +195,6 @@ class LogEntryRepository extends DBElementRepository
|
|||
* @return AbstractDBElement|null returns the associated DBElement or null if the log either has no target or the element
|
||||
* was deleted from DB
|
||||
*
|
||||
* @throws ORMException
|
||||
* @throws OptimisticLockException
|
||||
* @throws TransactionRequiredException
|
||||
*/
|
||||
public function getTargetElement(AbstractLogEntry $logEntry): ?AbstractDBElement
|
||||
{
|
||||
|
|
|
@ -29,7 +29,9 @@ use InvalidArgumentException;
|
|||
class StorelocationRepository extends AbstractPartsContainingRepository
|
||||
{
|
||||
/**
|
||||
* @param Storelocation $element
|
||||
* @param object $element
|
||||
* @param array $order_by
|
||||
* @return array
|
||||
*/
|
||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
|
||||
{
|
||||
|
|
|
@ -81,10 +81,10 @@ class RangeParser
|
|||
}
|
||||
}
|
||||
|
||||
protected function generateMinMaxRange(string $min, string $max): array
|
||||
protected function generateMinMaxRange(string $min_, string $max_): array
|
||||
{
|
||||
$min = (int) $min;
|
||||
$max = (int) $max;
|
||||
$min = (int) $min_;
|
||||
$max = (int) $max_;
|
||||
|
||||
//Ensure that $max > $min
|
||||
if ($min > $max) {
|
||||
|
|
|
@ -146,10 +146,10 @@ class PricedetailHelper
|
|||
/**
|
||||
* Calculates the average price of a part, when ordering the amount $amount.
|
||||
*
|
||||
* @param Part $part the part for which the average price should be calculated
|
||||
* @param float $amount The order amount for which the average price should be calculated.
|
||||
* @param Part $part the part for which the average price should be calculated
|
||||
* @param float|null $amount The order amount for which the average price should be calculated.
|
||||
* If set to null, the mininmum order amount for the part is used.
|
||||
* @param Currency|null $currency The currency in which the average price should be calculated
|
||||
* @param Currency|null $currency The currency in which the average price should be calculated
|
||||
*
|
||||
* @return BigDecimal|null The Average price as bcmath string. Returns null, if it was not possible to calculate the
|
||||
* price for the given
|
||||
|
|
|
@ -132,7 +132,7 @@ class AppExtension extends AbstractExtension
|
|||
{
|
||||
$tree = $this->treeBuilder->getTreeView(get_class($element), null, $type, $element);
|
||||
|
||||
return json_encode($tree);
|
||||
return json_encode($tree, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue