|
11 | 11 | use PHPStan\PhpDocParser\Parser\PhpDocParser;
|
12 | 12 | use PHPStan\PhpDocParser\Parser\TokenIterator;
|
13 | 13 | use PHPStan\PhpDocParser\Parser\TypeParser;
|
| 14 | +use PHPStan\PhpDocParser\ParserConfig; |
14 | 15 | use PHPUnit\Framework\Attributes\DataProvider;
|
15 | 16 | use ShipMonk\InputMapper\Compiler\Exception\CannotCreateMapperCompilerException;
|
16 | 17 | use ShipMonk\InputMapper\Compiler\Mapper\Array\ArrayShapeItemMapping;
|
@@ -71,10 +72,11 @@ class DefaultMapperCompilerFactoryTest extends InputMapperTestCase
|
71 | 72 | #[DataProvider('provideCreateOkData')]
|
72 | 73 | public function testCreateOk(string $type, array $options, MapperCompiler $expectedMapperCompiler): void
|
73 | 74 | {
|
74 |
| - $phpDocLexer = new Lexer(); |
75 |
| - $phpDocExprParser = new ConstExprParser(unescapeStrings: true); |
76 |
| - $phpDocTypeParser = new TypeParser($phpDocExprParser); |
77 |
| - $phpDocParser = new PhpDocParser($phpDocTypeParser, $phpDocExprParser); |
| 75 | + $config = new ParserConfig([]); |
| 76 | + $phpDocLexer = new Lexer($config); |
| 77 | + $phpDocConstExprParser = new ConstExprParser($config); |
| 78 | + $phpDocTypeParser = new TypeParser($config, $phpDocConstExprParser); |
| 79 | + $phpDocParser = new PhpDocParser($config, $phpDocTypeParser, $phpDocConstExprParser); |
78 | 80 | $phpDocType = $phpDocTypeParser->parse(new TokenIterator($phpDocLexer->tokenize($type)));
|
79 | 81 |
|
80 | 82 | $mapperCompilerFactory = new DefaultMapperCompilerFactory($phpDocLexer, $phpDocParser);
|
@@ -435,10 +437,11 @@ className: InputWithRenamedSourceKey::class,
|
435 | 437 | #[DataProvider('provideCreateErrorData')]
|
436 | 438 | public function testCreateError(string $type, array $options, ?string $expectedMessage = null): void
|
437 | 439 | {
|
438 |
| - $phpDocLexer = new Lexer(); |
439 |
| - $phpDocExprParser = new ConstExprParser(unescapeStrings: true); |
440 |
| - $phpDocTypeParser = new TypeParser($phpDocExprParser); |
441 |
| - $phpDocParser = new PhpDocParser($phpDocTypeParser, $phpDocExprParser); |
| 440 | + $config = new ParserConfig([]); |
| 441 | + $phpDocLexer = new Lexer($config); |
| 442 | + $phpDocConstExprParser = new ConstExprParser($config); |
| 443 | + $phpDocTypeParser = new TypeParser($config, $phpDocConstExprParser); |
| 444 | + $phpDocParser = new PhpDocParser($config, $phpDocTypeParser, $phpDocConstExprParser); |
442 | 445 | $phpDocType = $phpDocTypeParser->parse(new TokenIterator($phpDocLexer->tokenize($type)));
|
443 | 446 |
|
444 | 447 | $mapperCompilerFactory = new DefaultMapperCompilerFactory($phpDocLexer, $phpDocParser);
|
@@ -510,10 +513,11 @@ public static function provideCreateErrorData(): iterable
|
510 | 513 |
|
511 | 514 | public function testCreateWithCustomFactory(): void
|
512 | 515 | {
|
513 |
| - $phpDocLexer = new Lexer(); |
514 |
| - $phpDocExprParser = new ConstExprParser(unescapeStrings: true); |
515 |
| - $phpDocTypeParser = new TypeParser($phpDocExprParser); |
516 |
| - $phpDocParser = new PhpDocParser($phpDocTypeParser, $phpDocExprParser); |
| 516 | + $config = new ParserConfig([]); |
| 517 | + $phpDocLexer = new Lexer($config); |
| 518 | + $phpDocConstExprParser = new ConstExprParser($config); |
| 519 | + $phpDocTypeParser = new TypeParser($config, $phpDocConstExprParser); |
| 520 | + $phpDocParser = new PhpDocParser($config, $phpDocTypeParser, $phpDocConstExprParser); |
517 | 521 |
|
518 | 522 | $carMapperCompiler = new MapObject(CarInput::class, [
|
519 | 523 | 'id' => new MapInt(),
|
|
0 commit comments