Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2022-08-14 19:39:07 +02:00
parent 639829f5c5
commit 8e6bc25d2e
19 changed files with 39 additions and 40 deletions

View file

@ -81,7 +81,7 @@
"phpstan/phpstan-doctrine": "^1.2.11", "phpstan/phpstan-doctrine": "^1.2.11",
"phpstan/phpstan-symfony": "^1.1.7", "phpstan/phpstan-symfony": "^1.1.7",
"psalm/plugin-symfony": "^3.0.3", "psalm/plugin-symfony": "^3.0.3",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-latest",
"symfony/browser-kit": "^5.2", "symfony/browser-kit": "^5.2",
"symfony/css-selector": "^5.2", "symfony/css-selector": "^5.2",
"symfony/debug-bundle": "^5.2", "symfony/debug-bundle": "^5.2",

View file

@ -252,12 +252,12 @@ class UserController extends AdminPages\BaseAdminController
/** /**
* Get either a Gravatar URL or complete image tag for a specified email address. * Get either a Gravatar URL or complete image tag for a specified email address.
* *
* @param string $email The email address * @param string|null $email The email address
* @param int $s Size in pixels, defaults to 80px [ 1 - 2048 ] * @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 $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ] * @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 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 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 * @return string containing either just a URL or a complete image tag
* @source https://gravatar.com/site/implement/images/php/ * @source https://gravatar.com/site/implement/images/php/

View file

@ -52,8 +52,8 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface
/** /**
* Construct new purger instance. * Construct new purger instance.
* *
* @param EntityManagerInterface $em EntityManagerInterface instance used for persistence. * @param EntityManagerInterface|null $em EntityManagerInterface instance used for persistence.
* @param string[] $excluded array of table/view names to be excluded from purge * @param string[] $excluded array of table/view names to be excluded from purge
*/ */
public function __construct(?EntityManagerInterface $em = null, array $excluded = []) public function __construct(?EntityManagerInterface $em = null, array $excluded = [])
{ {

View file

@ -297,7 +297,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
/** /**
* Sets the new parent object. * Sets the new parent object.
* *
* @param self $new_parent The new parent object * @param AbstractStructuralDBElement|null $new_parent The new parent object
* *
* @return AbstractStructuralDBElement * @return AbstractStructuralDBElement
*/ */
@ -316,7 +316,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
/** /**
* Set the comment. * Set the comment.
* *
* @param string $new_comment the new comment * @param string|null $new_comment the new comment
* *
* @return AbstractStructuralDBElement * @return AbstractStructuralDBElement
*/ */

View file

@ -342,7 +342,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
/** /**
* Sets the target element associated with this element. * 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 * @return $this
*/ */

View file

@ -302,7 +302,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/** /**
* Sets the typical value of this property. * Sets the typical value of this property.
* *
* @param float $value_typical * @param float|null $value_typical
* *
* @return $this * @return $this
*/ */

View file

@ -119,7 +119,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
} }
/** /**
* @param string $unit * @param string|null $unit
* *
* @return MeasurementUnit * @return MeasurementUnit
*/ */

View file

@ -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. * 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 * @return PartLot
*/ */

View file

@ -166,7 +166,7 @@ trait BasicPropertyTrait
/** /**
* Sets the description of this part. * Sets the description of this part.
* *
* @param string $new_description the new description * @param string|null $new_description the new description
* *
* @return $this * @return $this
*/ */
@ -195,7 +195,7 @@ trait BasicPropertyTrait
* Set the category of this Part. * 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). * 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 * @return $this
*/ */

View file

@ -134,7 +134,7 @@ class Currency extends AbstractStructuralDBElement
} }
/** /**
* @param string $iso_code * @param string|null $iso_code
* *
* @return Currency * @return Currency
*/ */

View file

@ -537,7 +537,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/** /**
* Change the first name of the user. * 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 * @return $this
*/ */
@ -559,7 +559,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/** /**
* Change the last name of the user. * 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 * @return $this
*/ */
@ -583,7 +583,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/** /**
* Change the department of the user. * Change the department of the user.
* *
* @param string $department The new department * @param string|null $department The new department
* *
* @return User * @return User
*/ */
@ -607,7 +607,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/** /**
* Change the email of the user. * Change the email of the user.
* *
* @param string $email The new email adress * @param string|null $email The new email adress
* *
* @return $this * @return $this
*/ */

View file

@ -106,7 +106,6 @@ class CollectionTypeExtension extends AbstractTypeExtension
* Set the option of the form. * Set the option of the form.
* This a bit hacky cause we access private properties.... * This a bit hacky cause we access private properties....
* *
* @throws ReflectionException
*/ */
public function setOption(FormBuilder $builder, string $option, $value): void public function setOption(FormBuilder $builder, string $option, $value): void
{ {

View file

@ -276,11 +276,11 @@ final class TreeViewNode implements JsonSerializable
$ret['state'] = $this->state; $ret['state'] = $this->state;
} }
if ($this->href == null) { if ($this->href === null) {
$ret['selectable'] = false; $ret['selectable'] = false;
} }
if ($this->icon != null) { if ($this->icon !== null) {
$ret['icon'] = $this->icon; $ret['icon'] = $this->icon;
} }

View file

@ -30,17 +30,18 @@ abstract class AbstractPartsContainingRepository extends StructuralDBElementRepo
/** /**
* Returns all parts associated with this element. * Returns all 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
* @param array $order_by The order of the parts. Format ['name' => 'ASC'] * @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; abstract public function getParts(object $element, array $order_by = ['name' => 'ASC']): array;
/** /**
* Gets the count of the parts associated with this element. * 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; abstract public function getPartsCount(object $element): int;

View file

@ -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 * @return AbstractDBElement|null returns the associated DBElement or null if the log either has no target or the element
* was deleted from DB * was deleted from DB
* *
* @throws ORMException
* @throws OptimisticLockException
* @throws TransactionRequiredException
*/ */
public function getTargetElement(AbstractLogEntry $logEntry): ?AbstractDBElement public function getTargetElement(AbstractLogEntry $logEntry): ?AbstractDBElement
{ {

View file

@ -29,7 +29,9 @@ use InvalidArgumentException;
class StorelocationRepository extends AbstractPartsContainingRepository 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 public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
{ {

View file

@ -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; $min = (int) $min_;
$max = (int) $max; $max = (int) $max_;
//Ensure that $max > $min //Ensure that $max > $min
if ($min > $max) { if ($min > $max) {

View file

@ -146,10 +146,10 @@ class PricedetailHelper
/** /**
* Calculates the average price of a part, when ordering the amount $amount. * 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 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 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. * 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 * @return BigDecimal|null The Average price as bcmath string. Returns null, if it was not possible to calculate the
* price for the given * price for the given

View file

@ -132,7 +132,7 @@ class AppExtension extends AbstractExtension
{ {
$tree = $this->treeBuilder->getTreeView(get_class($element), null, $type, $element); $tree = $this->treeBuilder->getTreeView(get_class($element), null, $type, $element);
return json_encode($tree); return json_encode($tree, JSON_THROW_ON_ERROR);
} }
/** /**