Skip to content

Commit

Permalink
[build] Add phpstan/phpstan removal on the build, as require by build…
Browse files Browse the repository at this point in the history
… package in composer.json already
  • Loading branch information
TomasVotruba committed Sep 27, 2023
1 parent b483230 commit 51ed7b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bin/add-phpstan-self-replace.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

// this is part of downgrade build

declare(strict_types=1);

use Nette\Utils\FileSystem;
use Nette\Utils\Json;

require __DIR__ . '/../vendor/autoload.php';

$composerJsonFileContents = FileSystem::read(__DIR__ . '/../composer.json');

$composerJson = Json::decode($composerJsonFileContents, Json::FORCE_ARRAY);
$composerJson['replace']['phpstan/phpstan'] = $composerJson['require']['phpstan/phpstan'];

$modifiedComposerJsonFileContents = Json::encode($composerJson, Json::PRETTY);
FileSystem::write(__DIR__ . '/../composer.json', $modifiedComposerJsonFileContents);

echo 'Done!' . PHP_EOL;
3 changes: 3 additions & 0 deletions build/build-rector-scoped.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ wget https://github.com/humbug/php-scoper/releases/download/0.17.7/php-scoper.ph
# Work around possible PHP memory limits
php -d memory_limit=-1 php-scoper.phar add-prefix bin config src packages rules vendor composer.json --output-dir "../$RESULT_DIRECTORY" --config scoper.php --force --ansi --working-dir "$BUILD_DIRECTORY";

php bin/add-phpstan-self-replace.php
composer remove phpstan/phpstan -W

note "Dumping Composer Autoload"
composer dump-autoload --working-dir "$RESULT_DIRECTORY" --ansi --classmap-authoritative --no-dev

Expand Down

0 comments on commit 51ed7b6

Please sign in to comment.