Skip to content

Commit 2bd2690

Browse files
phansysfranmomu
authored andcommitted
Fix PHPStan findings about iterable parameters
1 parent e910b4d commit 2bd2690

File tree

68 files changed

+301
-148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+301
-148
lines changed

phpstan-baseline.neon

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,6 @@ parameters:
255255
count: 3
256256
path: src/Sluggable/Handler/TreeSlugHandler.php
257257

258-
-
259-
message: "#^Part \\$option \\(array\\{string, mixed\\}\\) of encapsed string cannot be cast to string\\.$#"
260-
count: 1
261-
path: src/Sluggable/Mapping/Driver/Annotation.php
262-
263258
-
264259
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$isMappedSuperclass\\.$#"
265260
count: 1
@@ -505,6 +500,11 @@ parameters:
505500
count: 1
506501
path: src/Tree/TreeListener.php
507502

503+
-
504+
message: "#^Method Gedmo\\\\Uploadable\\\\Event\\\\UploadableBaseEventArgs\\:\\:__construct\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
505+
count: 2
506+
path: src/Uploadable/Event/UploadableBaseEventArgs.php
507+
508508
-
509509
message: "#^Method Gedmo\\\\Uploadable\\\\Event\\\\UploadableBaseEventArgs\\:\\:getExtensionConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#"
510510
count: 2

phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ parameters:
1919
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is never written, only read\.$#'
2020
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is never read, only written\.$#'
2121
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is unused\.$#'
22-
# @todo: Remove the following ignored error when the parameters are correctly declared.
23-
- '#^Method Gedmo\\[^:]+::[^\(]+\(\) has parameter \$\w+ with no value type specified in iterable type array\.$#'
2422

2523
rules:
2624
- PHPStan\Rules\Constants\MissingClassConstantTypehintRule

src/Loggable/Document/Repository/LogEntryRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public function revert($document, $version = 1)
106106
/**
107107
* Fills a documents versioned fields with data
108108
*
109-
* @param object $document
109+
* @param object $document
110+
* @param array<string, mixed> $data
110111
*
111112
* @return void
112113
*

src/Loggable/Mapping/Driver/Annotation.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ protected function isMappingValid(ClassMetadata $meta, $field)
108108
}
109109

110110
/**
111+
* @param array<string, mixed> $config
112+
*
111113
* @return bool
112114
*/
113115
protected function isClassAnnotationInValid(ClassMetadata $meta, array &$config)
@@ -117,6 +119,8 @@ protected function isClassAnnotationInValid(ClassMetadata $meta, array &$config)
117119

118120
/**
119121
* Searches properties of embedded object for versioned fields
122+
*
123+
* @param array<string, mixed> $config
120124
*/
121125
private function inspectEmbeddedForVersioned(string $field, array &$config, \Doctrine\ORM\Mapping\ClassMetadata $meta): void
122126
{

src/Loggable/Mapping/Driver/Xml.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public function readExtendedMetadata($meta, array &$config)
8686

8787
/**
8888
* Searches mappings on element for versioned fields
89+
*
90+
* @param array<string, mixed> $config
8991
*/
9092
private function inspectElementForVersioned(\SimpleXMLElement $element, array &$config, ClassMetadata $meta): void
9193
{

src/Loggable/Mapping/Driver/Yaml.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ protected function _loadMappingFile($file)
139139
return \Symfony\Component\Yaml\Yaml::parse(file_get_contents($file));
140140
}
141141

142+
/**
143+
* @param array<string, array<string, array<string, mixed>>> $mapping
144+
* @param array<string, mixed> $config
145+
*/
142146
private function inspectEmbeddedForVersioned(string $field, array $mapping, array &$config): void
143147
{
144148
if (isset($mapping['fields'])) {

src/Mapping/Annotation/Blameable.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ final class Blameable implements GedmoAnnotation
3434
public $value;
3535

3636
/**
37+
* @param array<string, mixed> $data
3738
* @param string|string[]|null $field
3839
* @param mixed $value
3940
*/

src/Mapping/Annotation/IpTraceable.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ final class IpTraceable implements GedmoAnnotation
3434
public $value;
3535

3636
/**
37+
* @param array<string, mixed> $data
3738
* @param string|string[]|null $field
3839
* @param mixed $value
3940
*/

src/Mapping/Annotation/Loggable.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ final class Loggable implements GedmoAnnotation
3737
public $logEntryClass;
3838

3939
/**
40+
* @param array<string, mixed> $data
41+
*
4042
* @phpstan-param class-string<T>|null $logEntryClass
4143
*/
4244
public function __construct(array $data = [], ?string $logEntryClass = null)

src/Mapping/Annotation/Reference.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ abstract class Reference implements GedmoAnnotation
5151
public $inversedBy;
5252

5353
/**
54+
* @param array<string, mixed> $data
55+
*
5456
* @phpstan-param class-string|null $class
5557
*/
5658
public function __construct(

0 commit comments

Comments
 (0)