Skip to content

Commit 1bfea3c

Browse files
committed
Fixed phpstan issues
1 parent 07db155 commit 1bfea3c

File tree

6 files changed

+22
-2
lines changed

6 files changed

+22
-2
lines changed

src/Controller/PartController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ public function __construct(
7272
private readonly TranslatorInterface $translator,
7373
private readonly AttachmentSubmitHandler $attachmentSubmitHandler,
7474
private readonly EntityManagerInterface $em,
75-
private readonly EventCommentHelper $commentHelper
75+
private readonly EventCommentHelper $commentHelper,
76+
private readonly PartInfoSettings $partInfoSettings,
7677
) {
7778
}
7879

src/EventListener/LogSystem/EventLoggerListener.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public function postFlush(PostFlushEventArgs $args): void
170170
public function hasFieldRestrictions(AbstractDBElement $element): bool
171171
{
172172
foreach (array_keys(static::FIELD_BLACKLIST) as $class) {
173+
/** @var string $class */
173174
if ($element instanceof $class) {
174175
return true;
175176
}
@@ -184,6 +185,7 @@ public function hasFieldRestrictions(AbstractDBElement $element): bool
184185
public function shouldFieldBeSaved(AbstractDBElement $element, string $field_name): bool
185186
{
186187
foreach (static::FIELD_BLACKLIST as $class => $blacklist) {
188+
/** @var string $class */
187189
if ($element instanceof $class && in_array($field_name, $blacklist, true)) {
188190
return false;
189191
}
@@ -215,6 +217,7 @@ protected function logElementDeleted(AbstractDBElement $entity, EntityManagerInt
215217
$mappings = $metadata->getAssociationMappings();
216218
//Check if class is whitelisted for CollectionElementDeleted entry
217219
foreach (static::TRIGGER_ASSOCIATION_LOG_WHITELIST as $class => $whitelist) {
220+
/** @var string $class */
218221
if ($entity instanceof $class) {
219222
//Check names
220223
foreach ($mappings as $field => $mapping) {

src/Form/InfoProviderSystem/ProviderSelectType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
namespace App\Form\InfoProviderSystem;
2525

2626
use App\Services\InfoProviderSystem\ProviderRegistry;
27+
use App\Services\InfoProviderSystem\Providers\InfoProviderInterface;
2728
use Symfony\Component\Form\AbstractType;
29+
use Symfony\Component\Form\ChoiceList\ChoiceList;
2830
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
2931
use Symfony\Component\OptionsResolver\Options;
3032
use Symfony\Component\OptionsResolver\OptionsResolver;

src/Services/Attachments/AttachmentSubmitHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
*/
5858
class AttachmentSubmitHandler
5959
{
60+
/**
61+
* @var array<string, string> The mapping used to determine which folder will be used for an attachment type
62+
*/
6063
protected array $folder_mapping;
6164

6265
private ?int $max_upload_size_bytes = null;
@@ -160,6 +163,7 @@ public function generateAttachmentPath(Attachment $attachment, bool $secure_uplo
160163
} else {
161164
//If not, check for instance of:
162165
foreach ($this->folder_mapping as $class => $folder) {
166+
/** @var string $class */
163167
if ($attachment instanceof $class) {
164168
$prefix = $folder;
165169
break;

src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ public function get1DBarcodeContent(AbstractDBElement $target): string
9595
return $prefix.$id;
9696
}
9797

98+
/**
99+
* @param array<string, string> $map
100+
* @param object $target
101+
* @return string
102+
*/
98103
private function classToString(array $map, object $target): string
99104
{
100105
$class = $target::class;

src/Twig/Sandbox/InheritanceSecurityPolicy.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@
3434
*/
3535
final class InheritanceSecurityPolicy implements SecurityPolicyInterface
3636
{
37+
/**
38+
* @var array<string, string[]>
39+
*/
3740
private array $allowedMethods;
3841

39-
public function __construct(private array $allowedTags = [], private array $allowedFilters = [], array $allowedMethods = [], private array $allowedProperties = [], private array $allowedFunctions = [])
42+
public function __construct(private array $allowedTags = [], private array $allowedFilters = [], array $allowedMethods = [],
43+
/** @var array<string, string|string[]> */
44+
private array $allowedProperties = [], private array $allowedFunctions = [])
4045
{
4146
$this->setAllowedMethods($allowedMethods);
4247
}

0 commit comments

Comments
 (0)