Skip to content

Commit

Permalink
Simplify PHAR compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Apr 16, 2020
1 parent cb79f86 commit f31ee7c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions compiler/build/box.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"directories": [
"conf",
"src",
"stubs",
"vendor"
"stubs"
],
"force-autodiscovery": true,
"output": "tmp/phpstan.phar",
"php-scoper": "compiler/build/scoper.inc.php"
}
4 changes: 0 additions & 4 deletions compiler/src/Console/CompileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$this->fixComposerJson($this->buildDir);
$this->renamePhpStormStubs();
$this->processFactory->create(['composer', 'update', '--no-dev', '--classmap-authoritative'], $this->buildDir);

$this->processFactory->create(['php', 'box.phar', 'compile', '--no-parallel'], $this->dataDir);

Expand All @@ -60,9 +59,6 @@ private function fixComposerJson(string $buildDir): void
{
$json = json_decode($this->filesystem->read($buildDir . '/composer.json'), true);

// remove dev dependencies (they create conflicts)
unset($json['require-dev'], $json['autoload-dev']);

unset($json['replace']);
$json['name'] = 'phpstan/phpstan';

Expand Down
5 changes: 3 additions & 2 deletions compiler/tests/Console/CompileCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function testCommand(): void
"require": {
"php": "~7.1"
},
"require-dev": 1,
"autoload-dev": 2,
"autoload": {
"psr-4": {
"PHPStan\\\\": "src/"
Expand All @@ -35,8 +37,7 @@ public function testCommand(): void

$processFactory = $this->createMock(ProcessFactory::class);
$processFactory->expects(self::at(0))->method('setOutput');
$processFactory->expects(self::at(1))->method('create')->with(['composer', 'update', '--no-dev', '--classmap-authoritative'], 'bar')->willReturn($process);
$processFactory->expects(self::at(2))->method('create')->with(['php', 'box.phar', 'compile', '--no-parallel'], 'foo')->willReturn($process);
$processFactory->expects(self::at(1))->method('create')->with(['php', 'box.phar', 'compile', '--no-parallel'], 'foo')->willReturn($process);

$application = new Application();
$application->add(new CompileCommand($filesystem, $processFactory, 'foo', 'bar'));
Expand Down

0 comments on commit f31ee7c

Please sign in to comment.