mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 11:09:29 +00:00
Fixed phpstan issues
This commit is contained in:
parent
07db1554c7
commit
1bfea3c48a
6 changed files with 22 additions and 2 deletions
|
|
@ -72,7 +72,8 @@ final class PartController extends AbstractController
|
|||
private readonly TranslatorInterface $translator,
|
||||
private readonly AttachmentSubmitHandler $attachmentSubmitHandler,
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly EventCommentHelper $commentHelper
|
||||
private readonly EventCommentHelper $commentHelper,
|
||||
private readonly PartInfoSettings $partInfoSettings,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ class EventLoggerListener
|
|||
public function hasFieldRestrictions(AbstractDBElement $element): bool
|
||||
{
|
||||
foreach (array_keys(static::FIELD_BLACKLIST) as $class) {
|
||||
/** @var string $class */
|
||||
if ($element instanceof $class) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -184,6 +185,7 @@ class EventLoggerListener
|
|||
public function shouldFieldBeSaved(AbstractDBElement $element, string $field_name): bool
|
||||
{
|
||||
foreach (static::FIELD_BLACKLIST as $class => $blacklist) {
|
||||
/** @var string $class */
|
||||
if ($element instanceof $class && in_array($field_name, $blacklist, true)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -215,6 +217,7 @@ class EventLoggerListener
|
|||
$mappings = $metadata->getAssociationMappings();
|
||||
//Check if class is whitelisted for CollectionElementDeleted entry
|
||||
foreach (static::TRIGGER_ASSOCIATION_LOG_WHITELIST as $class => $whitelist) {
|
||||
/** @var string $class */
|
||||
if ($entity instanceof $class) {
|
||||
//Check names
|
||||
foreach ($mappings as $field => $mapping) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ declare(strict_types=1);
|
|||
namespace App\Form\InfoProviderSystem;
|
||||
|
||||
use App\Services\InfoProviderSystem\ProviderRegistry;
|
||||
use App\Services\InfoProviderSystem\Providers\InfoProviderInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\ChoiceList\ChoiceList;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\OptionsResolver\Options;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
|
|||
*/
|
||||
class AttachmentSubmitHandler
|
||||
{
|
||||
/**
|
||||
* @var array<string, string> The mapping used to determine which folder will be used for an attachment type
|
||||
*/
|
||||
protected array $folder_mapping;
|
||||
|
||||
private ?int $max_upload_size_bytes = null;
|
||||
|
|
@ -160,6 +163,7 @@ class AttachmentSubmitHandler
|
|||
} else {
|
||||
//If not, check for instance of:
|
||||
foreach ($this->folder_mapping as $class => $folder) {
|
||||
/** @var string $class */
|
||||
if ($attachment instanceof $class) {
|
||||
$prefix = $folder;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -95,6 +95,11 @@ final class BarcodeContentGenerator
|
|||
return $prefix.$id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $map
|
||||
* @param object $target
|
||||
* @return string
|
||||
*/
|
||||
private function classToString(array $map, object $target): string
|
||||
{
|
||||
$class = $target::class;
|
||||
|
|
|
|||
|
|
@ -34,9 +34,14 @@ use function is_array;
|
|||
*/
|
||||
final class InheritanceSecurityPolicy implements SecurityPolicyInterface
|
||||
{
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private array $allowedMethods;
|
||||
|
||||
public function __construct(private array $allowedTags = [], private array $allowedFilters = [], array $allowedMethods = [], private array $allowedProperties = [], private array $allowedFunctions = [])
|
||||
public function __construct(private array $allowedTags = [], private array $allowedFilters = [], array $allowedMethods = [],
|
||||
/** @var array<string, string|string[]> */
|
||||
private array $allowedProperties = [], private array $allowedFunctions = [])
|
||||
{
|
||||
$this->setAllowedMethods($allowedMethods);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue