File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace mglaman \PHPStanDrupal \Tests \Type ;
6
+
7
+ use mglaman \PHPStanDrupal \Tests \AdditionalConfigFilesTrait ;
8
+ use PHPStan \Testing \TypeInferenceTestCase ;
9
+
10
+ final class EntityPropertyTypeTest extends TypeInferenceTestCase
11
+ {
12
+ use AdditionalConfigFilesTrait;
13
+
14
+ public function dataFileAsserts (): iterable
15
+ {
16
+ yield from $ this ->gatherAssertTypes (__DIR__ . '/data/entity-properties.php ' );
17
+ }
18
+
19
+ /**
20
+ * @dataProvider dataFileAsserts
21
+ * @param string $assertType
22
+ * @param string $file
23
+ * @param mixed ...$args
24
+ */
25
+ public function testFileAsserts (
26
+ string $ assertType ,
27
+ string $ file ,
28
+ ...$ args
29
+ ): void
30
+ {
31
+ $ this ->assertFileAsserts ($ assertType , $ file , ...$ args );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace DrupalEntity ;
4
+
5
+ use Drupal \node \Entity \Node ;
6
+ use Drupal \phpstan_fixtures \Entity \ReflectionEntityTest ;
7
+ use function PHPStan \Testing \assertType ;
8
+
9
+ $ node = Node::create (['type ' => 'page ' ]);
10
+ assertType ('Drupal\Core\Field\FieldItemListInterface ' , $ node ->uid );
11
+
12
+ $ entity = ReflectionEntityTest::create ();
13
+ assertType ('Drupal\Core\Field\EntityReferenceFieldItemListInterface ' , $ entity ->user_id );
You can’t perform that action at this time.
0 commit comments