From 7a55a6e6b6c10f5033491603443c16f434d0deed Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 Dec 2023 17:22:11 +0000 Subject: [PATCH 1/7] ServerKiller: harden against spurious wakeups If awakened by spurious wakeup, the thread would immediately exit without doing anything, rendering it useless. Not sure how it took so long for this to be found... --- src/utils/ServerKiller.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/utils/ServerKiller.php b/src/utils/ServerKiller.php index 98129f48f..514a265ba 100644 --- a/src/utils/ServerKiller.php +++ b/src/utils/ServerKiller.php @@ -24,7 +24,8 @@ declare(strict_types=1); namespace pocketmine\utils; use pocketmine\thread\Thread; -use function time; +use function hrtime; +use function intdiv; class ServerKiller extends Thread{ private bool $stopped = false; @@ -34,13 +35,15 @@ class ServerKiller extends Thread{ ){} protected function onRun() : void{ - $start = time(); - $this->synchronized(function() : void{ - if(!$this->stopped){ - $this->wait($this->time * 1000000); + $start = hrtime(true); + $remaining = $this->time * 1_000_000; + $this->synchronized(function() use (&$remaining, $start) : void{ + while(!$this->stopped && $remaining > 0){ + $this->wait($remaining); + $remaining -= intdiv(hrtime(true) - $start, 1000); } }); - if(time() - $start >= $this->time){ + if($remaining <= 0){ echo "\nTook too long to stop, server was killed forcefully!\n"; @Process::kill(Process::pid()); } From 5718a1a20e03e375cc4798015db27ab5be1b84a5 Mon Sep 17 00:00:00 2001 From: Dylan T Date: Mon, 8 Jan 2024 11:38:29 +0000 Subject: [PATCH 2/7] Reduce frequency of annoying Dependabot updates phpstan is releasing sometimes 4-5 times a week at this point, generating lots of noise. --- .github/dependabot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 518a26c70..8acff71d6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,7 @@ updates: - package-ecosystem: composer directory: "/" schedule: - interval: daily + interval: weekly time: "10:00" open-pull-requests-limit: 10 ignore: @@ -21,4 +21,4 @@ updates: - package-ecosystem: github-actions directory: "/" schedule: - interval: daily + interval: weekly From 19556634e34c1499e4dd89287dc852ccafbf4bd0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:08:54 +0000 Subject: [PATCH 3/7] Bump build/php from `73e5950` to `6f619bf` (#6220) Bumps [build/php](https://github.com/pmmp/php-build-scripts) from `73e5950` to `6f619bf`. - [Release notes](https://github.com/pmmp/php-build-scripts/releases) - [Commits](https://github.com/pmmp/php-build-scripts/compare/73e5950eb90033a8de589044b92aa5e95de9c494...6f619bf7a0b00e72a7c90915eec6e5a28866aa55) --- updated-dependencies: - dependency-name: build/php dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build/php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/php b/build/php index 73e5950eb..6f619bf7a 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 73e5950eb90033a8de589044b92aa5e95de9c494 +Subproject commit 6f619bf7a0b00e72a7c90915eec6e5a28866aa55 From f83280ece615aa9635b4513d6a20df4d4fdd87a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:11:18 +0000 Subject: [PATCH 4/7] Bump tests/plugins/DevTools from `411fd5b` to `c6dca35` (#6216) Bumps [tests/plugins/DevTools](https://github.com/pmmp/DevTools) from `411fd5b` to `c6dca35`. - [Release notes](https://github.com/pmmp/DevTools/releases) - [Commits](https://github.com/pmmp/DevTools/compare/411fd5bdc002edd82cf1ea658d170bb814d59483...c6dca357c7e8a37ce3479a1bedfe849451e072e3) --- updated-dependencies: - dependency-name: tests/plugins/DevTools dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- tests/plugins/DevTools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/DevTools b/tests/plugins/DevTools index 411fd5bdc..c6dca357c 160000 --- a/tests/plugins/DevTools +++ b/tests/plugins/DevTools @@ -1 +1 @@ -Subproject commit 411fd5bdc002edd82cf1ea658d170bb814d59483 +Subproject commit c6dca357c7e8a37ce3479a1bedfe849451e072e3 From 5b5c73f660eee54d72f73310c16b5dcdacbeff9c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 8 Jan 2024 16:12:03 +0000 Subject: [PATCH 5/7] Matrixify jobs that run on all PHP versions this allows us to specify PHP versions in just one place instead of 4, and also makes the display of jobs in the UI nicer. --- .github/workflows/main-php-matrix.yml | 165 ++++++++++++++++++++++++++ .github/workflows/main.yml | 157 +----------------------- 2 files changed, 171 insertions(+), 151 deletions(-) create mode 100644 .github/workflows/main-php-matrix.yml diff --git a/.github/workflows/main-php-matrix.yml b/.github/workflows/main-php-matrix.yml new file mode 100644 index 000000000..3bc0bdebf --- /dev/null +++ b/.github/workflows/main-php-matrix.yml @@ -0,0 +1,165 @@ +name: CI (all supported PHP versions) + +on: + workflow_call: + inputs: + php: + description: 'PHP version in X.Y format' + required: true + type: string + + #these are parameterized to ease updating + pm-version-major: + description: 'PocketMine-MP major version' + default: 5 + type: number + image: + description: 'Runner image to use' + default: 'ubuntu-20.04' + type: string + +jobs: + phpstan: + name: PHPStan analysis + runs-on: ${{ inputs.image }} + + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: pmmp/setup-php-action@2.0.0 + with: + php-version: ${{ inputs.php }} + install-path: "./bin" + pm-version-major: ${{ inputs.pm-version-major }} + + - name: Restore Composer package cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/composer/files + ~/.cache/composer/vcs + key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}" + restore-keys: | + composer-v2-cache- + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-interaction + + - name: Run PHPStan + run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G + + phpunit: + name: PHPUnit tests + runs-on: ${{ inputs.image }} + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: pmmp/setup-php-action@2.0.0 + with: + php-version: ${{ inputs.php }} + install-path: "./bin" + pm-version-major: ${{ inputs.pm-version-major }} + + - name: Restore Composer package cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/composer/files + ~/.cache/composer/vcs + key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}" + restore-keys: | + composer-v2-cache- + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-interaction + + - name: Run PHPUnit tests + run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit + + integration: + name: Integration tests + runs-on: ${{ inputs.image }} + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup PHP + uses: pmmp/setup-php-action@2.0.0 + with: + php-version: ${{ inputs.php }} + install-path: "./bin" + pm-version-major: ${{ inputs.pm-version-major }} + + - name: Restore Composer package cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/composer/files + ~/.cache/composer/vcs + key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}" + restore-keys: | + composer-v2-cache- + + - name: Install Composer dependencies + run: composer install --no-dev --prefer-dist --no-interaction + + - name: Run integration tests + run: ./tests/travis.sh -t4 + + codegen: + name: Generated Code consistency checks + runs-on: ${{ inputs.image }} + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: pmmp/setup-php-action@2.0.0 + with: + php-version: ${{ inputs.php }} + install-path: "./bin" + pm-version-major: ${{ inputs.pm-version-major }} + + - name: Restore Composer package cache + uses: actions/cache@v3 + with: + path: | + ~/.cache/composer/files + ~/.cache/composer/vcs + key: "composer-v2-cache-${{ inputs.php }}-${{ hashFiles('./composer.lock') }}" + restore-keys: | + composer-v2-cache- + + - name: Install Composer dependencies + run: composer install --no-dev --prefer-dist --no-interaction + + - name: Regenerate registry annotations + run: php build/generate-registry-annotations.php src + + - name: Regenerate KnownTranslation APIs + run: php build/generate-known-translation-apis.php + + - name: Regenerate BedrockData available files constants + run: php build/generate-bedrockdata-path-consts.php + + - name: Regenerate YmlServerProperties constants + run: php build/generate-pocketmine-yml-property-consts.php + + - name: Verify code is unchanged + run: | + git diff + git diff --quiet diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32f8be80e..bcb8036d9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,162 +6,17 @@ on: workflow_dispatch: jobs: - phpstan: - name: PHPStan analysis - runs-on: ${{ matrix.image }} - + all-php-versions: + name: PHP ${{ matrix.php }} strategy: fail-fast: false matrix: - image: [ubuntu-20.04] php: ["8.1", "8.2", "8.3"] - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: pmmp/setup-php-action@2.0.0 - with: - php-version: ${{ matrix.php }} - install-path: "./bin" - pm-version-major: "5" - - - name: Restore Composer package cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/composer/files - ~/.cache/composer/vcs - key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}" - restore-keys: | - composer-v2-cache- - - - name: Install Composer dependencies - run: composer install --prefer-dist --no-interaction - - - name: Run PHPStan - run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G - - phpunit: - name: PHPUnit tests - runs-on: ${{ matrix.image }} - strategy: - fail-fast: false - matrix: - image: [ubuntu-20.04] - php: ["8.1", "8.2", "8.3"] - - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: pmmp/setup-php-action@2.0.0 - with: - php-version: ${{ matrix.php }} - install-path: "./bin" - pm-version-major: "5" - - - name: Restore Composer package cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/composer/files - ~/.cache/composer/vcs - key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}" - restore-keys: | - composer-v2-cache- - - - name: Install Composer dependencies - run: composer install --prefer-dist --no-interaction - - - name: Run PHPUnit tests - run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit - - integration: - name: Integration tests - runs-on: ${{ matrix.image }} - strategy: - fail-fast: false - matrix: - image: [ubuntu-20.04] - php: ["8.1", "8.2", "8.3"] - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup PHP - uses: pmmp/setup-php-action@2.0.0 - with: - php-version: ${{ matrix.php }} - install-path: "./bin" - pm-version-major: "5" - - - name: Restore Composer package cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/composer/files - ~/.cache/composer/vcs - key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}" - restore-keys: | - composer-v2-cache- - - - name: Install Composer dependencies - run: composer install --no-dev --prefer-dist --no-interaction - - - name: Run integration tests - run: ./tests/travis.sh -t4 - - codegen: - name: Generated Code consistency checks - runs-on: ${{ matrix.image }} - strategy: - fail-fast: false - matrix: - image: [ubuntu-20.04] - php: ["8.1", "8.2", "8.3"] - - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: pmmp/setup-php-action@2.0.0 - with: - php-version: ${{ matrix.php }} - install-path: "./bin" - pm-version-major: "5" - - - name: Restore Composer package cache - uses: actions/cache@v3 - with: - path: | - ~/.cache/composer/files - ~/.cache/composer/vcs - key: "composer-v2-cache-${{ matrix.php }}-${{ hashFiles('./composer.lock') }}" - restore-keys: | - composer-v2-cache- - - - name: Install Composer dependencies - run: composer install --no-dev --prefer-dist --no-interaction - - - name: Regenerate registry annotations - run: php build/generate-registry-annotations.php src - - - name: Regenerate KnownTranslation APIs - run: php build/generate-known-translation-apis.php - - - name: Regenerate BedrockData available files constants - run: php build/generate-bedrockdata-path-consts.php - - - name: Regenerate YmlServerProperties constants - run: php build/generate-pocketmine-yml-property-consts.php - - - name: Verify code is unchanged - run: | - git diff - git diff --quiet + uses: ./.github/workflows/main-php-matrix.yml + with: + php: ${{ matrix.php }} + secrets: inherit codestyle: name: Code Style checks From ee977c80015433d2f9b48ea9dbbef666f6456f0d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 8 Jan 2024 16:18:13 +0000 Subject: [PATCH 6/7] Updated composer dependencies --- composer.lock | 78 ++++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/composer.lock b/composer.lock index f8e0b31af..24d36cd5f 100644 --- a/composer.lock +++ b/composer.lock @@ -1211,25 +1211,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.18.0", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -1237,7 +1239,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1261,9 +1263,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" }, - "time": "2023-12-10T21:03:43+00:00" + "time": "2024-01-07T17:17:35+00:00" }, { "name": "phar-io/manifest", @@ -1541,23 +1543,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.10", + "version": "10.1.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "599109c8ca6bae97b23482d557d2874c25a65e59" + "reference": "78c3b7625965c2513ee96569a4dbb62601784145" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/599109c8ca6bae97b23482d557d2874c25a65e59", - "reference": "599109c8ca6bae97b23482d557d2874c25a65e59", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145", + "reference": "78c3b7625965c2513ee96569a4dbb62601784145", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=8.1", "phpunit/php-file-iterator": "^4.0", "phpunit/php-text-template": "^3.0", @@ -1607,7 +1609,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11" }, "funding": [ { @@ -1615,7 +1617,7 @@ "type": "github" } ], - "time": "2023-12-11T06:28:43+00:00" + "time": "2023-12-21T15:38:30+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2207,20 +2209,20 @@ }, { "name": "sebastian/complexity", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", - "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { - "nikic/php-parser": "^4.10", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=8.1" }, "require-dev": { @@ -2229,7 +2231,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.1-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -2253,7 +2255,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -2261,20 +2263,20 @@ "type": "github" } ], - "time": "2023-09-28T11:50:59+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "5.0.3", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", - "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f", "shasum": "" }, "require": { @@ -2287,7 +2289,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2320,7 +2322,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.0" }, "funding": [ { @@ -2328,7 +2330,7 @@ "type": "github" } ], - "time": "2023-05-01T07:48:21+00:00" + "time": "2023-12-22T10:55:06+00:00" }, { "name": "sebastian/environment", @@ -2536,20 +2538,20 @@ }, { "name": "sebastian/lines-of-code", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.10", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=8.1" }, "require-dev": { @@ -2582,7 +2584,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -2590,7 +2592,7 @@ "type": "github" } ], - "time": "2023-08-31T09:25:50+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator", From 4db38ee45201ed9fb9bf0eb1ecb5007e64b40ca9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 8 Jan 2024 16:20:42 +0000 Subject: [PATCH 7/7] Updated PHPStan --- build/server-phar.php | 12 +++++++++++- composer.json | 2 +- composer.lock | 12 ++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/build/server-phar.php b/build/server-phar.php index 0665c89d5..8b4d410ce 100644 --- a/build/server-phar.php +++ b/build/server-phar.php @@ -32,6 +32,7 @@ use function getcwd; use function getopt; use function implode; use function ini_get; +use function is_string; use function microtime; use function preg_quote; use function realpath; @@ -147,8 +148,17 @@ function main() : void{ }else{ $build = 0; } + if(isset($opts["out"])){ + if(!is_string($opts["out"])){ + echo "--out cannot be specified multiple times" . PHP_EOL; + exit(1); + } + $pharPath = $opts["out"]; + }else{ + $pharPath = getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar"; + } foreach(buildPhar( - $opts["out"] ?? getcwd() . DIRECTORY_SEPARATOR . "PocketMine-MP.phar", + $pharPath, dirname(__DIR__) . DIRECTORY_SEPARATOR, [ 'resources', diff --git a/composer.json b/composer.json index bcec3a72b..953f06931 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "symfony/filesystem": "~6.4.0" }, "require-dev": { - "phpstan/phpstan": "1.10.50", + "phpstan/phpstan": "1.10.55", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "~10.3.0 || ~10.2.0 || ~10.1.0" diff --git a/composer.lock b/composer.lock index 24d36cd5f..0a2539521 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "894648a63ed7cd84303937208d1684af", + "content-hash": "d7a3fceea557add1b8cb461554db1ee7", "packages": [ { "name": "adhocore/json-comment", @@ -1380,16 +1380,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.50", + "version": "1.10.55", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4" + "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4", - "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", "shasum": "" }, "require": { @@ -1438,7 +1438,7 @@ "type": "tidelift" } ], - "time": "2023-12-13T10:59:42+00:00" + "time": "2024-01-08T12:32:40+00:00" }, { "name": "phpstan/phpstan-phpunit",