Skip to content

Commit 9bd9611

Browse files
author
Dmytro Dymarchuk
committed
Add template for phpstan
1 parent 8137e3a commit 9bd9611

File tree

6 files changed

+23
-24
lines changed

6 files changed

+23
-24
lines changed

src/Propel/Runtime/Collection/ArrayCollection.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
*
1919
* @author Francois Zaninotto
2020
*
21-
* @phpstan-template TType of \Propel\Runtime\ActiveRecord\ActiveRecordInterface
22-
* @phpstan-extends \Propel\Runtime\Collection\Collection<TType, array>
21+
* @phpstan-extends \Propel\Runtime\Collection\Collection<array>
2322
*/
2423
class ArrayCollection extends Collection
2524
{
2625
/**
27-
* @phpstan-var TType
26+
* @phpstan-var \Propel\Runtime\ActiveRecord\ActiveRecordInterface
2827
*
2928
* @var \Propel\Runtime\ActiveRecord\ActiveRecordInterface
3029
*/

src/Propel/Runtime/Collection/Collection.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@
4242
*
4343
* @author Francois Zaninotto
4444
*
45-
* @phpstan-template TType of \Propel\Runtime\ActiveRecord\ActiveRecordInterface
4645
* @phpstan-template T
4746
* @phpstan-implements \ArrayAccess<string|int, T>
4847
* @phpstan-implements \IteratorAggregate<T>
4948
*/
5049
class Collection implements ArrayAccess, IteratorAggregate, Countable, Serializable
5150
{
5251
/**
53-
* @phpstan-var class-string<TType>
52+
* @phpstan-var class-string<\Propel\Runtime\ActiveRecord\ActiveRecordInterface>
5453
*
5554
* @var string|null
5655
*/
@@ -59,14 +58,14 @@ class Collection implements ArrayAccess, IteratorAggregate, Countable, Serializa
5958
/**
6059
* The fully qualified classname of the model
6160
*
62-
* @phpstan-var class-string<TType>
61+
* @phpstan-var class-string<\Propel\Runtime\ActiveRecord\ActiveRecordInterface>
6362
*
6463
* @var string|null
6564
*/
6665
protected $fullyQualifiedModel;
6766

6867
/**
69-
* @phpstan-var \Propel\Runtime\Formatter\AbstractFormatter<TType, \Propel\Runtime\Collection\Collection, T>
68+
* @phpstan-var \Propel\Runtime\Formatter\AbstractFormatter<\Propel\Runtime\ActiveRecord\ActiveRecordInterface, \Propel\Runtime\Collection\Collection, T>
7069
*
7170
* @var \Propel\Runtime\Formatter\AbstractFormatter
7271
*/
@@ -453,7 +452,7 @@ public function search($element)
453452
* Returns an array of objects present in the collection that
454453
* are not presents in the given collection.
455454
*
456-
* @phpstan-param \Propel\Runtime\Collection\Collection<TType, T> $collection
455+
* @phpstan-param \Propel\Runtime\Collection\Collection<T> $collection
457456
*
458457
* @phpstan-return self
459458
*
@@ -511,7 +510,7 @@ public function unserialize($data): void
511510
/**
512511
* Set the model of the elements in the collection
513512
*
514-
* @phpstan-param class-string<TType> $model
513+
* @phpstan-param class-string<\Propel\Runtime\ActiveRecord\ActiveRecordInterface> $model
515514
*
516515
* @param string $model Name of the Propel object classes stored in the collection
517516
*
@@ -531,7 +530,7 @@ public function setModel(string $model): void
531530
/**
532531
* Get the model of the elements in the collection
533532
*
534-
* @phpstan-return class-string<TType>
533+
* @phpstan-return class-string<\Propel\Runtime\ActiveRecord\ActiveRecordInterface>
535534
*
536535
* @return string Name of the Propel object class stored in the collection
537536
*/
@@ -543,7 +542,7 @@ public function getModel(): string
543542
/**
544543
* Get the model of the elements in the collection
545544
*
546-
* @phpstan-return class-string<TType>
545+
* @phpstan-return class-string<\Propel\Runtime\ActiveRecord\ActiveRecordInterface>
547546
*
548547
* @return string Fully qualified Name of the Propel object class stored in the collection
549548
*/
@@ -571,7 +570,7 @@ public function getTableMapClass(): string
571570
}
572571

573572
/**
574-
* @phpstan-param \Propel\Runtime\Formatter\AbstractFormatter<TType, self, T> $formatter
573+
* @phpstan-param \Propel\Runtime\Formatter\AbstractFormatter<\Propel\Runtime\ActiveRecord\ActiveRecordInterface, self, T> $formatter
575574
*
576575
* @param \Propel\Runtime\Formatter\AbstractFormatter $formatter
577576
*
@@ -583,7 +582,7 @@ public function setFormatter(AbstractFormatter $formatter): void
583582
}
584583

585584
/**
586-
* @phpstan-return \Propel\Runtime\Formatter\AbstractFormatter<TType, \Propel\Runtime\Collection\Collection, T>
585+
* @phpstan-return \Propel\Runtime\Formatter\AbstractFormatter<\Propel\Runtime\ActiveRecord\ActiveRecordInterface, \Propel\Runtime\Collection\Collection, T>
587586
*
588587
* @return \Propel\Runtime\Formatter\AbstractFormatter
589588
*/

src/Propel/Runtime/Collection/ObjectCollection.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
*
2424
* @author Francois Zaninotto
2525
*
26-
* @phpstan-template TType of \Propel\Runtime\ActiveRecord\ActiveRecordInterface
2726
* @phpstan-template T
28-
* @phpstan-extends \Propel\Runtime\Collection\Collection<TType, T>
27+
* @phpstan-extends \Propel\Runtime\Collection\Collection<T>
2928
*/
3029
class ObjectCollection extends Collection
3130
{
@@ -40,7 +39,7 @@ class ObjectCollection extends Collection
4039
protected $indexSplHash = [];
4140

4241
/**
43-
* @param array<TType> $data
42+
* @param array<\Propel\Runtime\ActiveRecord\ActiveRecordInterface> $data
4443
*/
4544
public function __construct(array $data = [])
4645
{
@@ -461,7 +460,7 @@ public function offsetUnset($offset): void
461460
}
462461

463462
/**
464-
* @phpstan-param TType $element
463+
* @phpstan-param \Propel\Runtime\ActiveRecord\ActiveRecordInterface $element
465464
*
466465
* @param mixed $element
467466
*
@@ -475,7 +474,7 @@ public function removeObject($element): void
475474
}
476475

477476
/**
478-
* @phpstan-param TType $value
477+
* @phpstan-param \Propel\Runtime\ActiveRecord\ActiveRecordInterface $value
479478
*
480479
* @param mixed $value
481480
*
@@ -499,7 +498,7 @@ public function append($value): void
499498
}
500499

501500
/**
502-
* @phpstan-param TType $value
501+
* @phpstan-param \Propel\Runtime\ActiveRecord\ActiveRecordInterface $value
503502
*
504503
* @param mixed $offset
505504
* @param mixed $value

src/Propel/Runtime/Collection/ObjectCombinationCollection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* Class for iterating over a list of Propel objects
1515
*
1616
* @author Francois Zaninotto
17+
*
18+
* @phpstan-template T array<\Propel\Runtime\ActiveRecord\ActiveRecordInterface>
19+
* @phpstan-extends \Propel\Runtime\Collection\ObjectCollection<T>
1720
*/
1821
class ObjectCombinationCollection extends ObjectCollection
1922
{

src/Propel/Runtime/Collection/OnDemandCollection.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
*
2121
* @author Francois Zaninotto
2222
*
23-
* @phpstan-template TType of \Propel\Runtime\ActiveRecord\ActiveRecordInterface
2423
* @phpstan-template T of \Propel\Runtime\ActiveRecord\ActiveRecordInterface
25-
* @phpstan-extends \Propel\Runtime\Collection\Collection<TType, T>
24+
* @phpstan-extends \Propel\Runtime\Collection\Collection<T>
2625
*/
2726
class OnDemandCollection extends Collection
2827
{
@@ -34,7 +33,7 @@ class OnDemandCollection extends Collection
3433
private $lastIterator;
3534

3635
/**
37-
* @phpstan-param \Propel\Runtime\Formatter\OnDemandFormatter<TType, \Propel\Runtime\Collection\OnDemandCollection, T> $formatter
36+
* @phpstan-param \Propel\Runtime\Formatter\OnDemandFormatter<\Propel\Runtime\ActiveRecord\ActiveRecordInterface, \Propel\Runtime\Collection\OnDemandCollection, T> $formatter
3837
*
3938
* @param \Propel\Runtime\Formatter\ObjectFormatter $formatter
4039
* @param \Propel\Runtime\DataFetcher\DataFetcherInterface $dataFetcher

src/Propel/Runtime/Formatter/OnDemandFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function init(?BaseModelCriteria $criteria = null, ?DataFetcherInterface
5252
}
5353

5454
/**
55-
* @phpstan-return TColl<T, TReturn>
55+
* @phpstan-return TColl<TReturn>
5656
*
5757
* @param \Propel\Runtime\DataFetcher\DataFetcherInterface|null $dataFetcher
5858
*
@@ -92,7 +92,7 @@ public function getCollectionClassName(): string
9292
}
9393

9494
/**
95-
* @phpstan-return \Propel\Runtime\Collection\OnDemandCollection<T, TReturn>
95+
* @phpstan-return \Propel\Runtime\Collection\OnDemandCollection<TReturn>
9696
*
9797
* @return \Propel\Runtime\Collection\OnDemandCollection
9898
*/

0 commit comments

Comments
 (0)