File tree Expand file tree Collapse file tree 3 files changed +59
-1
lines changed
TypedData/Plugin/DataType Expand file tree Collapse file tree 3 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,17 @@ namespace Drupal\Core\Field;
4
4
5
5
use Drupal\Core\TypedData\Plugin\DataType\ItemList;
6
6
7
+ /**
8
+ * @template T of \Drupal\Core\Field\FieldItemInterface
9
+ * @extends ItemList<T>
10
+ * @implements FieldItemListInterface<T>
11
+ */
7
12
class FieldItemList extends ItemList implements FieldItemListInterface {
8
13
9
14
/**
10
15
* @return \Drupal\Core\Field\FieldItemInterface
11
16
*/
12
- protected function createItem($offset = 0, $value = NULL): \Drupal\Core\Field\FieldItemInterface {
17
+ protected function createItem(int $offset = 0, ?mixed $value = NULL): \Drupal\Core\Field\FieldItemInterface {
13
18
}
14
19
15
20
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Drupal\Core\TypedData\Plugin\DataType;
4
+
5
+ use Drupal\Core\TypedData\ComplexDataInterface;
6
+ use Drupal\Core\TypedData\ListInterface;
7
+ use Drupal\Core\TypedData\TypedData;
8
+ use Drupal\Core\TypedData\TypedDataInterface;
9
+
10
+ /**
11
+ * @template T of TypedDataInterface
12
+ * @implements \IteratorAggregate<int, T>
13
+ * @implements ListInterface<T>
14
+ */
15
+ class ItemList extends TypedData implements \IteratorAggregate, ListInterface {
16
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace mglaman \PHPStanDrupal \Tests ;
6
+
7
+ use PHPStan \Analyser \Error ;
8
+ use PHPStan \PhpDoc \StubFilesProvider ;
9
+ use PHPStan \PhpDoc \StubValidator ;
10
+ use PHPStan \Testing \PHPStanTestCase ;
11
+
12
+ final class StubTest extends PHPStanTestCase
13
+ {
14
+ use AdditionalConfigFilesTrait;
15
+
16
+ public function testValid (): void {
17
+ $ stubFilesProvider = self ::getContainer ()
18
+ ->getByType (StubFilesProvider::class);
19
+ // @phpstan-ignore-next-line
20
+ $ projectStubFiles = $ stubFilesProvider ->getProjectStubFiles ();
21
+
22
+ $ stubValidators = self ::getContainer ()
23
+ ->getByType (StubValidator::class);
24
+ // @phpstan-ignore-next-line
25
+ $ stubErrors = $ stubValidators ->validate ($ projectStubFiles , true );
26
+ $ errorsAsArrays = array_map (
27
+ static fn (Error $ error ) => $ error ->jsonSerialize (),
28
+ $ stubErrors
29
+ );
30
+ self ::assertEquals (
31
+ [],
32
+ $ errorsAsArrays ,
33
+ var_export ($ errorsAsArrays , true )
34
+ );
35
+ }
36
+
37
+ }
You can’t perform that action at this time.
0 commit comments