Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP-Parser 5 support #1909

Merged
merged 24 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6bb008c
Add PHP-Parser 5 support
sidz Jan 8, 2024
b89d64c
fix PHP-Parser 5 breaking changes and deprecations
sidz Jan 9, 2024
b59cbf6
Change Throw mutator due to internal changes in PHP-Parser
sidz Jan 9, 2024
13f7282
Change PregQuite mutator due to internal changes in PHP-Parser and AST
sidz Jan 9, 2024
95054f6
Change Finally_ mutator due to internal changes in PhpParser\Node\Stm…
sidz Jan 9, 2024
b4211af
Fix failed MutantCodeFactoryTest due to renamed nodes
sidz Jan 9, 2024
04cbfab
Fix failed MatchArmRemoval due to changes in PHP-Parser
sidz Jan 10, 2024
3e11ece
apply cs fixer
sidz Jan 10, 2024
83b65d6
fix invalid AbstractValueToNullReturnValue test case. Identifier->nam…
sidz Jan 10, 2024
3d6b007
revert Configuration changes
sidz Jan 10, 2024
297306a
Fix integration tests due to AST changes
sidz Jan 10, 2024
4cc1b2f
Add BackwardCompatible pretty printer
sidz Jan 14, 2024
32a462a
Fix tests
sidz Jan 14, 2024
57ef6dc
Merge branch 'master' into add-php-parser-5-support
maks-rafalko Mar 23, 2024
7870d4f
Fix issues after merging master into current branch
maks-rafalko Mar 23, 2024
978fec3
Fix tests, add missed DataProvider and fixed indentation in heredocs
maks-rafalko Mar 23, 2024
ce51c6d
Removed previously added BackwardCompatibleStandard.php
maks-rafalko Mar 23, 2024
0f05af4
Fix more tests
maks-rafalko Mar 23, 2024
155ccd0
Remove `nikic/php-parser`:4 compatibility tests
maks-rafalko Mar 23, 2024
7a96143
Fix other tests
maks-rafalko Mar 23, 2024
5cf4af4
Merge branch 'master' into add-php-parser-5-support
maks-rafalko Mar 23, 2024
ae34407
Fix issues after merging master
maks-rafalko Mar 23, 2024
00cd608
Revert "Conflict with `nikic/php-parser` in e2e tests unless #1909 is…
maks-rafalko Mar 23, 2024
5383a88
Remove usage if old classes, fir phpstan/psalm errors
maks-rafalko Mar 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"infection/extension-installer": "^0.1.0",
"infection/include-interceptor": "^0.2.5",
"justinrainbow/json-schema": "^5.2.10",
"nikic/php-parser": "^4.15.1",
"nikic/php-parser": "^4.18 || ^5.0",
"ondram/ci-detector": "^4.1.0",
"sanmai/later": "^0.1.1",
"sanmai/pipeline": "^5.1 || ^6",
Expand Down Expand Up @@ -86,7 +86,7 @@
"phpstan/phpstan-webmozart-assert": "^1.0.2",
"phpunit/phpunit": "^9.6",
"rector/rector": "^0.16.0",
"sidz/phpstan-rules": "^0.4.0",
"sidz/phpstan-rules": "^0.4.3",
"symfony/phpunit-bridge": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0",
"thecodingmachine/phpstan-safe-rule": "^1.2.0"
Expand Down
102 changes: 52 additions & 50 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 1 addition & 18 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
use Infection\Mutant\MutantExecutionResultFactory;
use Infection\Mutant\MutantFactory;
use Infection\Mutation\FileMutationGenerator;
use Infection\Mutation\MutationAttributeKeys;
use Infection\Mutation\MutationGenerator;
use Infection\Mutator\MutatorFactory;
use Infection\Mutator\MutatorParser;
Expand Down Expand Up @@ -139,7 +138,6 @@
use InvalidArgumentException;
use OndraM\CiDetector\CiDetector;
use function php_ini_loaded_file;
use PhpParser\Lexer;
use PhpParser\Parser;
use PhpParser\ParserFactory;
use PhpParser\PrettyPrinter\Standard;
Expand Down Expand Up @@ -297,17 +295,7 @@ public static function create(): self
MemoizedTestFileDataProvider::class => static fn (self $container): TestFileDataProvider => new MemoizedTestFileDataProvider(
new JUnitTestFileDataProvider($container->getJUnitReportLocator())
),
Lexer::class => static function (): Lexer {
$attributes = MutationAttributeKeys::ALL;
$attributes[] = 'comments';

return new Lexer\Emulative(['usedAttributes' => $attributes]);
},
Parser::class => static function (self $container): Parser {
$lexer = $container->getLexer();

return (new ParserFactory())->create(ParserFactory::PREFER_PHP7, $lexer);
},
Parser::class => static fn (): Parser => (new ParserFactory())->createForHostVersion(),
FileParser::class => static fn (self $container): FileParser => new FileParser($container->getParser()),
PrettyPrinterAbstract::class => static fn (): Standard => new Standard(),
MetricsCalculator::class => static fn (self $container): MetricsCalculator => new MetricsCalculator($container->getConfiguration()->getMsiPrecision()),
Expand Down Expand Up @@ -840,11 +828,6 @@ public function getMemoizedTestFileDataProvider(): MemoizedTestFileDataProvider
return $this->get(MemoizedTestFileDataProvider::class);
}

public function getLexer(): Lexer
{
return $this->get(Lexer::class);
}

public function getParser(): Parser
{
return $this->get(Parser::class);
Expand Down