Fixed phpstan issues

This commit is contained in:
Jan Böhmer 2023-07-17 00:43:35 +02:00
parent afcbbe0f43
commit 3a8c5a788f
11 changed files with 25 additions and 124 deletions

View file

@ -231,7 +231,7 @@ final class DTOtoEntityConverter
* @phpstan-param class-string<T> $class
* @param string $name The name of the entity to create
* @return AbstractStructuralDBElement
* @phpstan-return T|null
* @phpstan-return T
*/
private function getOrCreateEntityNonNull(string $class, string $name): AbstractStructuralDBElement
{
@ -263,7 +263,7 @@ final class DTOtoEntityConverter
$tmp = $this->em->getRepository(AttachmentType::class)->findOrCreateForInfoProvider(self::TYPE_DATASHEETS_NAME);
//If the entity was newly created, set the file filter
if ($tmp->getId() === null) {
if ($tmp->getID() === null) {
$tmp->setFiletypeFilter('application/pdf');
$tmp->setAlternativeNames(self::TYPE_DATASHEETS_NAME);
}
@ -281,7 +281,7 @@ final class DTOtoEntityConverter
$tmp = $this->em->getRepository(AttachmentType::class)->findOrCreateForInfoProvider(self::TYPE_IMAGE_NAME);
//If the entity was newly created, set the file filter
if ($tmp->getId() === null) {
if ($tmp->getID() === null) {
$tmp->setFiletypeFilter('image/*');
$tmp->setAlternativeNames(self::TYPE_DATASHEETS_NAME);
}

View file

@ -86,7 +86,7 @@ final class PartInfoRetriever
* The result is cached for 4 days.
* @param string $provider_key
* @param string $part_id
* @return
* @return PartDetailDTO
*/
public function getDetails(string $provider_key, string $part_id): PartDetailDTO
{

View file

@ -49,7 +49,7 @@ final class ProviderRegistry
/**
* @param iterable<InfoProviderInterface> $providers
*/
public function __construct(private readonly iterable $providers)
public function __construct(iterable $providers)
{
foreach ($providers as $provider) {
$key = $provider->getProviderKey();

View file

@ -243,9 +243,9 @@ class Element14Provider implements InfoProviderInterface
/**
* @param array|null $attributes
* @return ParameterDTO[]|null
* @return ParameterDTO[]
*/
private function attributesToParameters(?array $attributes): ?array
private function attributesToParameters(?array $attributes): array
{
$result = [];
@ -258,7 +258,7 @@ class Element14Provider implements InfoProviderInterface
}
//tariffCode is a special case, we prepend a # to prevent conversion to float
if (in_array($attribute['attributeLabel'], ['tariffCode', 'hazardCode'])) {
if (in_array($attribute['attributeLabel'], ['tariffCode', 'hazardCode'], true)) {
$attribute['attributeValue'] = '#' . $attribute['attributeValue'];
}

View file

@ -41,7 +41,7 @@ class TMEProvider implements InfoProviderInterface
public function __construct(private readonly TMEClient $tmeClient, private readonly string $country,
private readonly string $language, private readonly string $currency,
/** @var bool If true, the prices are gross prices. If false, the prices are net prices. */
private readonly string $get_gross_prices)
private readonly bool $get_gross_prices)
{
}