mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 13:59:35 +00:00
Fix PHPStan errors in PopulateKicadCommand and BatchEdaController
Add @var type annotations for Doctrine repository findAll() calls so PHPStan can resolve getEdaInfo() on Footprint/Category entities. Fix array return type for numeric-string keys and add explicit callback to array_filter to satisfy strict rules.
This commit is contained in:
parent
e05a751b84
commit
310872b7a5
2 changed files with 6 additions and 2 deletions
|
|
@ -86,6 +86,7 @@ class PopulateKicadCommand extends Command
|
||||||
$io->section('Current Footprint KiCad Values');
|
$io->section('Current Footprint KiCad Values');
|
||||||
|
|
||||||
$footprintRepo = $this->entityManager->getRepository(Footprint::class);
|
$footprintRepo = $this->entityManager->getRepository(Footprint::class);
|
||||||
|
/** @var Footprint[] $footprints */
|
||||||
$footprints = $footprintRepo->findAll();
|
$footprints = $footprintRepo->findAll();
|
||||||
|
|
||||||
$rows = [];
|
$rows = [];
|
||||||
|
|
@ -103,6 +104,7 @@ class PopulateKicadCommand extends Command
|
||||||
$io->section('Current Category KiCad Values');
|
$io->section('Current Category KiCad Values');
|
||||||
|
|
||||||
$categoryRepo = $this->entityManager->getRepository(Category::class);
|
$categoryRepo = $this->entityManager->getRepository(Category::class);
|
||||||
|
/** @var Category[] $categories */
|
||||||
$categories = $categoryRepo->findAll();
|
$categories = $categoryRepo->findAll();
|
||||||
|
|
||||||
$rows = [];
|
$rows = [];
|
||||||
|
|
@ -125,6 +127,7 @@ class PopulateKicadCommand extends Command
|
||||||
$mappings = $this->getFootprintMappings();
|
$mappings = $this->getFootprintMappings();
|
||||||
|
|
||||||
$footprintRepo = $this->entityManager->getRepository(Footprint::class);
|
$footprintRepo = $this->entityManager->getRepository(Footprint::class);
|
||||||
|
/** @var Footprint[] $footprints */
|
||||||
$footprints = $footprintRepo->findAll();
|
$footprints = $footprintRepo->findAll();
|
||||||
|
|
||||||
$updated = 0;
|
$updated = 0;
|
||||||
|
|
@ -174,6 +177,7 @@ class PopulateKicadCommand extends Command
|
||||||
$mappings = $this->getCategoryMappings();
|
$mappings = $this->getCategoryMappings();
|
||||||
|
|
||||||
$categoryRepo = $this->entityManager->getRepository(Category::class);
|
$categoryRepo = $this->entityManager->getRepository(Category::class);
|
||||||
|
/** @var Category[] $categories */
|
||||||
$categories = $categoryRepo->findAll();
|
$categories = $categoryRepo->findAll();
|
||||||
|
|
||||||
$updated = 0;
|
$updated = 0;
|
||||||
|
|
@ -240,7 +244,7 @@ class PopulateKicadCommand extends Command
|
||||||
* Returns footprint name to KiCad footprint path mappings.
|
* Returns footprint name to KiCad footprint path mappings.
|
||||||
* These are based on KiCad 9.x standard library paths.
|
* These are based on KiCad 9.x standard library paths.
|
||||||
*
|
*
|
||||||
* @return array<string, string>
|
* @return array<int|string, string>
|
||||||
*/
|
*/
|
||||||
private function getFootprintMappings(): array
|
private function getFootprintMappings(): array
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class BatchEdaController extends AbstractController
|
||||||
$redirectUrl = $request->query->getString('_redirect', '');
|
$redirectUrl = $request->query->getString('_redirect', '');
|
||||||
|
|
||||||
//Parse part IDs and load parts
|
//Parse part IDs and load parts
|
||||||
$idArray = array_filter(array_map('intval', explode(',', $ids)));
|
$idArray = array_filter(array_map('intval', explode(',', $ids)), static fn (int $id): bool => $id > 0);
|
||||||
$parts = $this->entityManager->getRepository(Part::class)->findBy(['id' => $idArray]);
|
$parts = $this->entityManager->getRepository(Part::class)->findBy(['id' => $idArray]);
|
||||||
|
|
||||||
if ($parts === []) {
|
if ($parts === []) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue