Skip to content

Commit cccc4a8

Browse files
committed
Use class-string type
1 parent d8b7353 commit cccc4a8

File tree

9 files changed

+24
-11
lines changed

9 files changed

+24
-11
lines changed

src/Loggable/LoggableListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ public function onFlush(EventArgs $eventArgs)
187187
* Get the LogEntry class
188188
*
189189
* @param string $class
190+
* @phpstan-param class-string $class
190191
*
191192
* @return string
193+
* @phpstan-return class-string
192194
*/
193195
protected function getLogEntryClass(LoggableAdapter $ea, $class)
194196
{

src/Mapping/MappedEventSubscriber.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ abstract class MappedEventSubscriber implements EventSubscriber
4545
* other listener configuration
4646
*
4747
* @var array
48+
* @phpstan-var array<string, array<class-string, array<string, mixed>>>
4849
*/
4950
protected static $configurations = [];
5051

@@ -98,8 +99,9 @@ public function __construct()
9899
* if cache driver is present it scans it also
99100
*
100101
* @param string $class
102+
* @phpstan-param class-string $class
101103
*
102-
* @return array
104+
* @return array<string, mixed>
103105
*/
104106
public function getConfiguration(ObjectManager $objectManager, $class)
105107
{

src/Translatable/Document/Repository/TranslationRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public function findTranslations($document)
162162
* @param string $field
163163
* @param string $value
164164
* @param string $class
165+
* @phpstan-param class-string $class
165166
*
166167
* @return object|null instance of $class or null if not found
167168
*/

src/Translatable/Mapping/Event/Adapter/ORM.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ public function setTranslationValue($object, $field, $value)
229229
*
230230
* @param mixed $key foreign key value
231231
* @param string $className translation class name
232+
* @phpstan-param class-string $className translation class name
232233
*
233234
* @return int|string transformed foreign key
234235
*/

src/Translatable/TranslatableListener.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ public function loadClassMetadata(EventArgs $eventArgs)
214214
* for the object $class
215215
*
216216
* @param string $class
217+
* @phpstan-param class-string $class
217218
*
218219
* @return string
220+
* @phpstan-return class-string
219221
*/
220222
public function getTranslationClass(TranslatableAdapter $ea, $class)
221223
{

src/Tree/Strategy/ORM/Nested.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ public function updateNode(EntityManagerInterface $em, $node, $parent, $position
529529
* @param string $class
530530
* @param int $rootId
531531
*
532+
* @phpstan-param class-string $class
533+
*
532534
* @return int
533535
*/
534536
public function max(EntityManagerInterface $em, $class, $rootId = 0)
@@ -555,11 +557,10 @@ public function max(EntityManagerInterface $em, $class, $rootId = 0)
555557
* @param string $class
556558
* @param int $first
557559
* @param int $delta
558-
* @param string $class
559-
* @param int $first
560-
* @param int $delta
561560
* @param int|string $root
562561
*
562+
* @phpstan-param class-string $class
563+
*
563564
* @return void
564565
*/
565566
public function shiftRL(EntityManagerInterface $em, $class, $first, $delta, $root = null)
@@ -634,6 +635,8 @@ public function shiftRL(EntityManagerInterface $em, $class, $first, $delta, $roo
634635
* @param int|string $destRoot
635636
* @param int $levelDelta
636637
*
638+
* @phpstan-param class-string $class
639+
*
637640
* @return void
638641
*/
639642
public function shiftRangeRL(EntityManagerInterface $em, $class, $first, $last, $delta, $root = null, $destRoot = null, $levelDelta = null)

tests/Gedmo/Tool/BaseTestCaseOM.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected function getDefaultMockSqliteEntityManager(array $fixtures, MappingDri
122122
$config = $this->getMockORMConfig($mappingDriver);
123123
$em = EntityManager::create($conn, $config, $this->getEventManager());
124124

125-
$schema = array_map(static function ($class) use ($em) {
125+
$schema = array_map(static function (string $class) use ($em) {
126126
return $em->getClassMetadata($class);
127127
}, $fixtures);
128128

tests/Gedmo/Tree/ClosureTreeRepositoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ public function testChangeChildrenIndex(): void
262262

263263
// Utility Methods
264264

265+
/**
266+
* @phpstan-param class-string $class
267+
*/
265268
protected function buildTreeTests(string $class): void
266269
{
267270
$repo = $this->em->getRepository($class);

tests/Gedmo/Tree/MaterializedPathORMRepositoryTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,9 @@ public function testChangeChildrenIndex(): void
366366
}
367367

368368
/**
369-
* @phpstan-param class-string<TCategory>|null $class
370-
*
371-
* @return MPCategory|TCategory
372-
*
373-
* @template TCategory of object
369+
* @phpstan-param class-string|null $class
374370
*/
375-
public function createCategory(?string $class = null)
371+
public function createCategory(?string $class = null): object
376372
{
377373
if (!$class) {
378374
$class = self::CATEGORY;
@@ -389,6 +385,9 @@ protected function getUsedEntityFixtures(): array
389385
];
390386
}
391387

388+
/**
389+
* @phpstan-param class-string|null $class
390+
*/
392391
private function populate(string $class = null): void
393392
{
394393
$root = $this->createCategory($class);

0 commit comments

Comments
 (0)