mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-02 22:44:33 +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
|
@ -43,7 +43,7 @@ class StructuralEntityChoiceHelper
|
|||
|
||||
/**
|
||||
* Generates the choice attributes for the given AbstractStructuralDBElement.
|
||||
* @return array|string[]
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function generateChoiceAttr(AbstractNamedDBElement $choice, Options|array $options): array
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||
namespace App\Form\Type\Helper;
|
||||
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use App\Services\Trees\NodesListBuilder;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
@ -33,6 +34,9 @@ use Symfony\Component\Form\FormInterface;
|
|||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* @template T of AbstractStructuralDBElement
|
||||
*/
|
||||
class StructuralEntityChoiceLoader extends AbstractChoiceLoader
|
||||
{
|
||||
private ?string $additional_element = null;
|
||||
|
@ -90,10 +94,14 @@ class StructuralEntityChoiceLoader extends AbstractChoiceLoader
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/** @var class-string<T> $class */
|
||||
$class = $this->options['class'];
|
||||
/** @var StructuralDBElementRepository $repo */
|
||||
|
||||
/** @var StructuralDBElementRepository<T> $repo */
|
||||
$repo = $this->entityManager->getRepository($class);
|
||||
|
||||
|
||||
$entities = $repo->getNewEntityFromPath($value, '->');
|
||||
|
||||
$results = [];
|
||||
|
|
|
@ -99,7 +99,6 @@ final class TriStateCheckboxType extends AbstractType implements DataTransformer
|
|||
*
|
||||
* @return mixed The value in the transformed representation
|
||||
*
|
||||
* @throws TransformationFailedException when the transformation fails
|
||||
*/
|
||||
public function transform(mixed $value)
|
||||
{
|
||||
|
@ -142,8 +141,6 @@ final class TriStateCheckboxType extends AbstractType implements DataTransformer
|
|||
* @param mixed $value The value in the transformed representation
|
||||
*
|
||||
* @return mixed The value in the original representation
|
||||
*
|
||||
* @throws TransformationFailedException when the transformation fails
|
||||
*/
|
||||
public function reverseTransform(mixed $value)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue