|
2 | 2 |
|
3 | 3 | namespace QueryFactoryStubFile; |
4 | 4 |
|
5 | | -use Psr\Container\ContainerInterface; |
6 | | -use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; |
7 | | -use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory; |
8 | 5 | use TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory; |
| 6 | +use function PHPStan\Testing\assertType; |
9 | 7 |
|
| 8 | +// phpcs:ignore Squiz.Classes.ClassFileName.NoMatch |
10 | 9 | class Model extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity |
11 | 10 | { |
12 | 11 |
|
13 | | -} |
| 12 | + public function foo(): void |
| 13 | + { |
| 14 | + $createResult = $this->getQueryFactory()->create(self::class); |
14 | 15 |
|
15 | | -use function PHPStan\Testing\assertType; |
| 16 | + assertType('TYPO3\CMS\Extbase\Persistence\QueryInterface<QueryFactoryStubFile\Model>', $createResult); |
| 17 | + assertType('class-string<' . self::class . '>', $createResult->getType()); |
| 18 | + } |
16 | 19 |
|
17 | | -static function (): void { |
18 | | - /** @var ConfigurationManager $configurationManager */ |
19 | | - $configurationManager = null; |
20 | | - /** @var DataMapFactory $dataMapFactory */ |
21 | | - $dataMapFactory = null; |
22 | | - /** @var ContainerInterface $containerInterface */ |
23 | | - $containerInterface = null; |
| 20 | + private function getQueryFactory(): QueryFactory |
| 21 | + { |
| 22 | + /** @var QueryFactory $queryFactory */ |
| 23 | + $queryFactory = null; |
| 24 | + return $queryFactory; |
| 25 | + } |
24 | 26 |
|
25 | | - $queryFactory = new QueryFactory($configurationManager, $dataMapFactory, $containerInterface); |
26 | | - $createResult = $queryFactory->create(Model::class); |
27 | | - |
28 | | - assertType('TYPO3\CMS\Extbase\Persistence\QueryInterface<QueryFactoryStubFile\Model>', $createResult); |
29 | | - assertType('class-string<' . Model::class . '>', $createResult->getType()); |
30 | | -}; |
| 27 | +} |
0 commit comments