mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-18 09:54:35 +02:00
Fixed phpstan analysis issues and bad code that showed up with phpstan 2.0
This commit is contained in:
parent
a273acbecd
commit
946032a101
42 changed files with 98 additions and 85 deletions
|
@ -146,11 +146,11 @@ final class LabelExampleElementsGenerator
|
|||
throw new InvalidArgumentException('$class must be an child of AbstractStructuralDBElement');
|
||||
}
|
||||
|
||||
/** @var AbstractStructuralDBElement $parent */
|
||||
/** @var T $parent */
|
||||
$parent = new $class();
|
||||
$parent->setName('Example');
|
||||
|
||||
/** @var AbstractStructuralDBElement $child */
|
||||
/** @var T $child */
|
||||
$child = new $class();
|
||||
$child->setName((new ReflectionClass($class))->getShortName());
|
||||
$child->setParent($parent);
|
||||
|
|
|
@ -62,10 +62,6 @@ final class LabelGenerator
|
|||
*/
|
||||
public function generateLabel(LabelOptions $options, object|array $elements): string
|
||||
{
|
||||
if (!is_array($elements) && !is_object($elements)) {
|
||||
throw new InvalidArgumentException('$element must be an object or an array of objects!');
|
||||
}
|
||||
|
||||
if (!is_array($elements)) {
|
||||
$elements = [$elements];
|
||||
}
|
||||
|
|
|
@ -74,8 +74,7 @@ final class LabelProfileDropdownHelper
|
|||
|
||||
$secure_class_name = $this->tagGenerator->getElementTypeCacheTag(LabelProfile::class);
|
||||
$key = 'profile_dropdown_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.'_'.$type->value;
|
||||
|
||||
/** @var LabelProfileRepository $repo */
|
||||
|
||||
$repo = $this->entityManager->getRepository(LabelProfile::class);
|
||||
|
||||
return $this->cache->get($key, function (ItemInterface $item) use ($repo, $type, $secure_class_name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue