diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 000000000..214f232d9 --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,97 @@ +name: Update Docker Hub images + +on: + release: + types: + - published + +jobs: + build: + name: Update Docker Hub images + runs-on: ubuntu-20.04 + + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Clone pmmp/PocketMine-Docker repository + uses: actions/checkout@v2 + with: + repository: pmmp/PocketMine-Docker + fetch-depth: 1 + + - name: Get tag names + id: tag-name + run: | + VERSION=$(echo "${{ github.ref }}" | sed 's{^refs/tags/{{') + echo ::set-output name=TAG_NAME::$VERSION + echo ::set-output name=MAJOR::$(echo $VERSION | cut -d. -f1) + echo ::set-output name=MINOR::$(echo $VERSION | cut -d. -f1-2) + + - name: Download new release information + run: curl -f -L ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ steps.tag-name.outputs.TAG_NAME }}/build_info.json -o new_build_info.json + + - name: Detect channel + id: channel + run: echo ::set-output name=CHANNEL::$(jq -r '.channel' new_build_info.json) + + - name: Get name of Docker repository name + id: docker-repo-name + run: echo ::set-output name=NAME::$(echo "${GITHUB_REPOSITORY,,}") + + - name: Build image for tag + uses: docker/build-push-action@v2.10.0 + with: + push: true + context: ./pocketmine-mp + tags: | + ${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.TAG_NAME }} +# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.TAG_NAME }} + build-args: | + PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }} + PMMP_REPO=${{ github.repository }} + + - name: Build image for major tag + if: steps.channel.outputs.CHANNEL == 'stable' + uses: docker/build-push-action@v2.10.0 + with: + push: true + context: ./pocketmine-mp + tags: | + ${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MAJOR }} +# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MAJOR }} + build-args: | + PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }} + PMMP_REPO=${{ github.repository }} + + - name: Build image for minor tag + if: steps.channel.outputs.CHANNEL == 'stable' + uses: docker/build-push-action@v2.10.0 + with: + push: true + context: ./pocketmine-mp + tags: | + ${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MINOR }} +# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:${{ steps.tag-name.outputs.MINOR }} + build-args: | + PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }} + PMMP_REPO=${{ github.repository }} + + - name: Build image for latest tag + if: steps.channel.outputs.CHANNEL == 'stable' + uses: docker/build-push-action@v2.10.0 + with: + push: true + context: ./pocketmine-mp + tags: | + ${{ steps.docker-repo-name.outputs.NAME }}:latest +# ghcr.io/${{ steps.docker-repo-name.outputs.NAME }}:latest + build-args: | + PMMP_TAG=${{ steps.tag-name.outputs.TAG_NAME }} + PMMP_REPO=${{ github.repository }} diff --git a/build/generate-registry-annotations.php b/build/generate-registry-annotations.php index ebc39631b..e177871e9 100644 --- a/build/generate-registry-annotations.php +++ b/build/generate-registry-annotations.php @@ -82,6 +82,7 @@ function generateMethodAnnotations(string $namespaceName, array $members) : stri require dirname(__DIR__) . '/vendor/autoload.php'; +/** @var string $file */ foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($argv[1], \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME)) as $file){ if(substr($file, -4) !== ".php"){ continue; diff --git a/build/php b/build/php index d110b60be..1fae6b8d4 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit d110b60bef0cc98529909fda2f6aaa77963aad6a +Subproject commit 1fae6b8d4ab89757316e7e70e77cadfd4fd26b3e diff --git a/changelogs/4.2.md b/changelogs/4.2.md index ac1124dda..c0c5c0298 100644 --- a/changelogs/4.2.md +++ b/changelogs/4.2.md @@ -28,3 +28,32 @@ Released 2nd March 2022. - Fixed output directory for `/dumpmemory`. - `PlayerInventory->isHotbarSlot()` now correctly returns `false` when given `9`. - Fixed ghost items left in the inventory when dropping tools while mining. + +# 4.2.3 +Released 9th March 2022. + +## Technical +- Now analysed using PHPStan 1.4.8. +- Now using `pocketmine/bedrock-protocol` [`8.0.1`](https://github.com/pmmp/BedrockProtocol/releases/tag/8.0.1%2Bbedrock-1.18.10). + +## Fixes +### Core +- Fixed a memory leak and other bugs related to plugins disabling themselves during `onEnable()`. + +### Gameplay +- Sweet berry bushes now absorb fall damage. +- Fixed mycelium spreading onto coarse dirt. +- Fixed blocks placed during `Block->onIncinerate()` getting overwritten. +- Fixed shulker boxes being unopenable when underwater. +- Fixed invisible fire on top of transparent non-flammable blocks. + +### API +- Various APIs accepting `Vector3`, `Position` or `Location` no longer accept objects containing `INF` or `NaN` in any component. Previously, this was allowed, but would cause lots of obscure crashes later on. +- `Entity->setRotation()` no longer accepts `INF` or `NaN`. +- Fixed missing bounds check for `ItemFrame->setItemDropChance()`. + +# 4.2.4 +Released 18th March 2022. + +## Fixes +- Fixed a crash when handling out-of-bounds meta values on the network. diff --git a/composer.json b/composer.json index 7263daa37..841025d54 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.3.3", + "phpstan/phpstan": "1.4.10", "phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.0.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 9fd4c5cac..d2541b0d3 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": "33a1d10231e0bce92d724bb738b14359", + "content-hash": "f3800582ad388d0ec2a95dffc3742d8e", "packages": [ { "name": "adhocore/json-comment", @@ -275,16 +275,16 @@ }, { "name": "pocketmine/bedrock-protocol", - "version": "8.0.0+bedrock-1.18.10", + "version": "8.0.1+bedrock-1.18.10", "source": { "type": "git", "url": "https://github.com/pmmp/BedrockProtocol.git", - "reference": "017e57c8f8a74118bcbba7332e7ebac9e6c81693" + "reference": "a740f6095b35278c0e0dac6db84a5e4d2456b113" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/017e57c8f8a74118bcbba7332e7ebac9e6c81693", - "reference": "017e57c8f8a74118bcbba7332e7ebac9e6c81693", + "url": "https://api.github.com/repos/pmmp/BedrockProtocol/zipball/a740f6095b35278c0e0dac6db84a5e4d2456b113", + "reference": "a740f6095b35278c0e0dac6db84a5e4d2456b113", "shasum": "" }, "require": { @@ -316,9 +316,9 @@ "description": "An implementation of the Minecraft: Bedrock Edition protocol in PHP", "support": { "issues": "https://github.com/pmmp/BedrockProtocol/issues", - "source": "https://github.com/pmmp/BedrockProtocol/tree/8.0.0+bedrock-1.18.10" + "source": "https://github.com/pmmp/BedrockProtocol/tree/8.0.1+bedrock-1.18.10" }, - "time": "2022-02-08T19:17:56+00:00" + "time": "2022-02-21T03:31:48+00:00" }, { "name": "pocketmine/binaryutils", @@ -993,12 +993,12 @@ } }, "autoload": { - "psr-4": { - "Ramsey\\Uuid\\": "src/" - }, "files": [ "src/functions.php" - ] + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1028,7 +1028,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -1060,12 +1060,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1090,7 +1090,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -1110,16 +1110,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "" }, "require": { @@ -1136,12 +1136,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1173,7 +1173,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -1189,11 +1189,11 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:33+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", @@ -1219,12 +1219,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1252,7 +1252,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" }, "funding": [ { @@ -1383,29 +1383,30 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -1432,7 +1433,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -1448,29 +1449,33 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { @@ -1495,7 +1500,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -1503,7 +1508,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", @@ -1901,16 +1906,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.3.3", + "version": "1.4.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "151a51f6149855785fbd883e79768c0abc96b75f" + "reference": "898c479c39caa727bedf4311dd294a8f4e250e72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/151a51f6149855785fbd883e79768c0abc96b75f", - "reference": "151a51f6149855785fbd883e79768c0abc96b75f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/898c479c39caa727bedf4311dd294a8f4e250e72", + "reference": "898c479c39caa727bedf4311dd294a8f4e250e72", "shasum": "" }, "require": { @@ -1924,11 +1929,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -1941,7 +1941,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.3.3" + "source": "https://github.com/phpstan/phpstan/tree/1.4.10" }, "funding": [ { @@ -1961,7 +1961,7 @@ "type": "tidelift" } ], - "time": "2022-01-07T09:49:03+00:00" + "time": "2022-03-14T10:25:45+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -2071,16 +2071,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.13", + "version": "9.2.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8" + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/deac8540cb7bd40b2b8cfa679b76202834fd04e8", - "reference": "deac8540cb7bd40b2b8cfa679b76202834fd04e8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", "shasum": "" }, "require": { @@ -2136,7 +2136,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.13" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" }, "funding": [ { @@ -2144,7 +2144,7 @@ "type": "github" } ], - "time": "2022-02-23T17:02:38+00:00" + "time": "2022-03-07T09:28:20+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2389,16 +2389,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.16", + "version": "9.5.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc" + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc", - "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807", + "reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807", "shasum": "" }, "require": { @@ -2428,7 +2428,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.0", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -2476,7 +2476,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19" }, "funding": [ { @@ -2488,7 +2488,7 @@ "type": "github" } ], - "time": "2022-02-23T17:10:58+00:00" + "time": "2022-03-15T09:57:31+00:00" }, { "name": "sebastian/cli-parser", @@ -3347,28 +3347,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -3391,7 +3391,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" }, "funding": [ { @@ -3399,7 +3399,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2022-03-15T09:54:48+00:00" }, { "name": "sebastian/version", diff --git a/doxygen/doxygen.conf b/doxygen/doxygen.conf index 989958883..930396261 100644 --- a/doxygen/doxygen.conf +++ b/doxygen/doxygen.conf @@ -1,4 +1,4 @@ -# Doxyfile 1.8.15 +# Doxyfile 1.9.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -93,14 +93,6 @@ ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English -# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all generated output in the proper direction. -# Possible values are: None, LTR, RTL and Context. -# The default value is: None. - -OUTPUT_TEXT_DIRECTION = None - # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. @@ -197,6 +189,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -217,6 +219,14 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -240,25 +250,19 @@ TAB_SIZE = 4 # the documentation. An alias has the form: # name=value # For example adding -# "sideeffect=@par Side Effects:\n" +# "sideeffect=@par Side Effects:^^" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. -# When you need a literal { or } or , in the value part of an alias you have to -# escape them by means of a backslash (\), this can lead to conflicts with the -# commands \{ and \} for these it is advised to use the version @{ and @} or use -# a double escape (\\{ and \\}) +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -299,19 +303,22 @@ OPTIMIZE_OUTPUT_SLICE = NO # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, -# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the -# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is -# Fortran), use: inc=Fortran f=C. +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = @@ -329,7 +336,7 @@ MARKDOWN_SUPPORT = YES # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. +# Minimum value: 0, maximum value: 99, default value: 5. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 @@ -445,6 +452,19 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -465,6 +485,12 @@ EXTRACT_ALL = NO EXTRACT_PRIVATE = NO +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. @@ -502,6 +528,13 @@ EXTRACT_LOCAL_METHODS = YES EXTRACT_ANON_NSPACES = YES +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -519,8 +552,8 @@ HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO @@ -539,11 +572,18 @@ HIDE_IN_BODY_DOCS = YES INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. # The default value is: system dependent. CASE_SENSE_NAMES = NO @@ -562,6 +602,12 @@ HIDE_SCOPE_NAMES = NO HIDE_COMPOUND_REFERENCE= NO +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -719,7 +765,8 @@ FILE_VERSION_FILTER = # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE @@ -765,24 +812,35 @@ WARNINGS = NO WARN_IF_UNDOCUMENTED = NO # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. If -# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC # The default value is: NO. WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. WARN_AS_ERROR = NO @@ -799,7 +857,10 @@ WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = @@ -820,8 +881,8 @@ INPUT = ../src \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: https://www.gnu.org/software/libiconv/) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 @@ -834,11 +895,15 @@ INPUT_ENCODING = UTF-8 # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.php @@ -883,7 +948,7 @@ EXCLUDE_PATTERNS = */bin/* \ # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test +# ANamespace::AClass, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* @@ -1059,16 +1124,24 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. +# The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_ADD_INC_PATHS = YES + # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories @@ -1078,10 +1151,13 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = # If clang assisted parsing is enabled you can provide the clang parser with the -# path to the compilation database (see: -# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files -# were built. This is equivalent to specifying the "-p" option to a clang tool, -# such as clang-check. These options will then be passed to the parser. +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. @@ -1098,13 +1174,6 @@ CLANG_DATABASE_PATH = ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored @@ -1204,7 +1273,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see +# this color. Hue is specified as an angle on a color-wheel, see # https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. @@ -1214,7 +1283,7 @@ HTML_EXTRA_FILES = HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A +# in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1243,9 +1312,9 @@ HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that -# are dynamically created via Javascript. If disabled, the navigation index will +# are dynamically created via JavaScript. If disabled, the navigation index will # consists of multiple levels of tabs that are statically embedded in every HTML -# page. Disable this option to support browsers that do not have Javascript, +# page. Disable this option to support browsers that do not have JavaScript, # like the Qt help browser. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1275,10 +1344,11 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/xcode/), introduced with OSX -# 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy # genXcode/_index.html for more information. @@ -1295,6 +1365,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1320,8 +1397,12 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1351,7 +1432,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1396,7 +1477,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1404,8 +1486,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1413,30 +1495,30 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1479,16 +1561,28 @@ DISABLE_INDEX = NO # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = YES +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # @@ -1513,6 +1607,24 @@ TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1533,8 +1645,14 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# https://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1544,11 +1662,29 @@ FORMULA_TRANSPARENT = YES USE_MATHJAX = YES +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + # When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). # Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1561,22 +1697,29 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1604,7 +1747,7 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There +# implemented using a web server instead of a web client using JavaScript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing @@ -1623,7 +1766,8 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1636,8 +1780,9 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1708,10 +1853,11 @@ LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex # The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to -# generate index for LaTeX. +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. # Note: This tag is used in the generated output file (.tex). # See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. -# The default value is: \makeindex. +# The default value is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_MAKEINDEX_CMD = \makeindex @@ -1745,29 +1891,31 @@ PAPER_TYPE = a4 EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. +# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for +# the generated LaTeX document. The header should contain everything until the +# first chapter. If it is left blank doxygen will generate a standard header. It +# is highly recommended to start with a default header using +# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty +# and then modify the file new_header.tex. See also section "Doxygen usage" for +# information on how to generate the default header that doxygen normally uses. # -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empty -# string, for the replacement values of the other commands the user is referred -# to HTML_HEADER. +# Note: Only use a user-defined header if you know what you are doing! +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. The following +# commands have a special meaning inside the header (and footer): For a +# description of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. See +# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for +# the generated LaTeX document. The footer should contain everything after the +# last chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what -# special commands can be used inside the footer. -# -# Note: Only use a user-defined footer if you know what you are doing! +# special commands can be used inside the footer. See also section "Doxygen +# usage" for information on how to generate the default footer that doxygen +# normally uses. Note: Only use a user-defined footer if you know what you are +# doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = @@ -1800,9 +1948,11 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1810,8 +1960,7 @@ USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. +# if errors occur, instead of asking the user for help. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1824,16 +1973,6 @@ LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See # https://en.wikipedia.org/wiki/BibTeX and \cite for more info. @@ -1914,16 +2053,6 @@ RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = -# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code -# with syntax highlighting in the RTF output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_SOURCE_CODE = NO - #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- @@ -2020,15 +2149,6 @@ GENERATE_DOCBOOK = NO DOCBOOK_OUTPUT = docbook -# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the -# program listings (including syntax highlighting and cross-referencing -# information) to the DOCBOOK output. Note that enabling this will significantly -# increase the size of the DOCBOOK output. -# The default value is: NO. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_PROGRAMLISTING = NO - #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- @@ -2203,34 +2323,10 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = NO - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2287,11 +2383,14 @@ DOT_FONTSIZE = 10 DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a +# graph for each documented class showing the direct and indirect inheritance +# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, +# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set +# to TEXT the direct and indirect inheritance relations will be shown as texts / +# links. +# Possible values are: NO, YES, TEXT and GRAPH. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES @@ -2328,10 +2427,32 @@ UML_LOOK = YES # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -2398,6 +2519,13 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: @@ -2451,10 +2579,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2516,14 +2644,18 @@ DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc temporary +# files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES diff --git a/src/block/Fire.php b/src/block/Fire.php index d6919d408..b31151c37 100644 --- a/src/block/Fire.php +++ b/src/block/Fire.php @@ -100,7 +100,7 @@ class Fire extends Flowable{ } public function onNearbyBlockChange() : void{ - if(!$this->getSide(Facing::DOWN)->isSolid() && !$this->hasAdjacentFlammableBlocks()){ + if($this->getSide(Facing::DOWN)->isTransparent() && !$this->hasAdjacentFlammableBlocks()){ $this->position->getWorld()->setBlock($this->position, VanillaBlocks::AIR()); }else{ $this->position->getWorld()->scheduleDelayedBlockUpdate($this->position, mt_rand(30, 40)); @@ -130,7 +130,7 @@ class Fire extends Flowable{ } }elseif(!$this->hasAdjacentFlammableBlocks()){ $canSpread = false; - if(!$down->isSolid() || $this->age > 3){ + if($down->isTransparent() || $this->age > 3){ $result = VanillaBlocks::AIR(); } } @@ -181,14 +181,16 @@ class Fire extends Flowable{ if(!$ev->isCancelled()){ $block->onIncinerate(); - $spreadedFire = false; - if(mt_rand(0, $this->age + 9) < 5){ //TODO: check rain - $fire = clone $this; - $fire->age = min(self::MAX_AGE, $fire->age + (mt_rand(0, 4) >> 2)); - $spreadedFire = $this->spreadBlock($block, $fire); - } - if(!$spreadedFire){ - $this->position->getWorld()->setBlock($block->position, VanillaBlocks::AIR()); + if($this->position->getWorld()->getBlock($block->getPosition())->isSameState($block)){ + $spreadedFire = false; + if(mt_rand(0, $this->age + 9) < 5){ //TODO: check rain + $fire = clone $this; + $fire->age = min(self::MAX_AGE, $fire->age + (mt_rand(0, 4) >> 2)); + $spreadedFire = $this->spreadBlock($block, $fire); + } + if(!$spreadedFire){ + $this->position->getWorld()->setBlock($block->position, VanillaBlocks::AIR()); + } } } } diff --git a/src/block/ItemFrame.php b/src/block/ItemFrame.php index 270938d75..33b547eab 100644 --- a/src/block/ItemFrame.php +++ b/src/block/ItemFrame.php @@ -31,6 +31,8 @@ use pocketmine\math\Facing; use pocketmine\math\Vector3; use pocketmine\player\Player; use pocketmine\world\BlockTransaction; +use function is_infinite; +use function is_nan; use function lcg_value; class ItemFrame extends Flowable{ @@ -111,6 +113,9 @@ class ItemFrame extends Flowable{ /** @return $this */ public function setItemDropChance(float $itemDropChance) : self{ + if($itemDropChance < 0.0 || $itemDropChance > 1.0 || is_nan($itemDropChance) || is_infinite($itemDropChance)){ + throw new \InvalidArgumentException("Drop chance must be in range 0-1"); + } $this->itemDropChance = $itemDropChance; return $this; } diff --git a/src/block/Mycelium.php b/src/block/Mycelium.php index 4d456ea98..bd6611505 100644 --- a/src/block/Mycelium.php +++ b/src/block/Mycelium.php @@ -50,7 +50,7 @@ class Mycelium extends Opaque{ $y = mt_rand($this->position->y - 2, $this->position->y + 2); $z = mt_rand($this->position->z - 1, $this->position->z + 1); $block = $this->position->getWorld()->getBlockAt($x, $y, $z); - if($block->getId() === BlockLegacyIds::DIRT){ + if($block instanceof Dirt && !$block->isCoarse()){ if($block->getSide(Facing::UP) instanceof Transparent){ $ev = new BlockSpreadEvent($block, $this, VanillaBlocks::MYCELIUM()); $ev->call(); diff --git a/src/block/ShulkerBox.php b/src/block/ShulkerBox.php index 18cd38ff8..672cc1a11 100644 --- a/src/block/ShulkerBox.php +++ b/src/block/ShulkerBox.php @@ -91,7 +91,7 @@ class ShulkerBox extends Opaque{ $shulker = $this->position->getWorld()->getTile($this->position); if($shulker instanceof TileShulkerBox){ if( - $this->getSide($this->facing)->getId() !== BlockLegacyIds::AIR || + $this->getSide($this->facing)->isSolid() || !$shulker->canOpenWith($item->getCustomName()) ){ return true; diff --git a/src/block/SweetBerryBush.php b/src/block/SweetBerryBush.php index 4983bfea4..2de41cd11 100644 --- a/src/block/SweetBerryBush.php +++ b/src/block/SweetBerryBush.php @@ -151,9 +151,11 @@ class SweetBerryBush extends Flowable{ } public function onEntityInside(Entity $entity) : bool{ - //TODO: in MCPE, this only triggers if moving while inside the bush block - we don't have the system to deal - //with that reliably right now if($this->age >= self::STAGE_BUSH_NO_BERRIES && $entity instanceof Living){ + $entity->resetFallDistance(); + + //TODO: in MCPE, this only triggers if moving while inside the bush block - we don't have the system to deal + //with that reliably right now $entity->attack(new EntityDamageByBlockEvent($this, $entity, EntityDamageByBlockEvent::CAUSE_CONTACT, 1)); } return true; diff --git a/src/command/CommandSender.php b/src/command/CommandSender.php index 50734758c..c16fdf042 100644 --- a/src/command/CommandSender.php +++ b/src/command/CommandSender.php @@ -41,11 +41,13 @@ interface CommandSender extends Permissible{ /** * Returns the line height of the command-sender's screen. Used for determining sizes for command output pagination * such as in the /help command. + * @phpstan-return positive-int */ public function getScreenLineHeight() : int; /** * Sets the line height used for command output pagination for this command sender. `null` will reset it to default. + * @phpstan-param positive-int|null $height */ public function setScreenLineHeight(?int $height) : void; } diff --git a/src/console/ConsoleCommandSender.php b/src/console/ConsoleCommandSender.php index 3879ab016..0858b8ec8 100644 --- a/src/console/ConsoleCommandSender.php +++ b/src/console/ConsoleCommandSender.php @@ -39,7 +39,10 @@ class ConsoleCommandSender implements CommandSender{ /** @var Server */ private $server; - /** @var int|null */ + /** + * @var int|null + * @phpstan-var positive-int|null + */ protected $lineHeight = null; /** @var Language */ private $language; diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 417253b98..5ab1d6a45 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -56,6 +56,7 @@ use pocketmine\player\Player; use pocketmine\Server; use pocketmine\timings\Timings; use pocketmine\timings\TimingsHandler; +use pocketmine\utils\Utils; use pocketmine\world\format\Chunk; use pocketmine\world\Position; use pocketmine\world\sound\Sound; @@ -69,8 +70,6 @@ use function deg2rad; use function floor; use function fmod; use function get_class; -use function is_infinite; -use function is_nan; use function lcg_value; use function sin; use function spl_object_id; @@ -217,7 +216,15 @@ abstract class Entity{ /** @var int|null */ protected $targetId = null; + private bool $constructorCalled = false; + public function __construct(Location $location, ?CompoundTag $nbt = null){ + if($this->constructorCalled){ + throw new \LogicException("Attempted to call constructor for an Entity multiple times"); + } + $this->constructorCalled = true; + Utils::checkLocationNotInfOrNaN($location); + $this->timings = Timings::getEntityTimings($this); $this->size = $this->getInitialSizeInfo(); @@ -226,11 +233,6 @@ abstract class Entity{ $this->server = $location->getWorld()->getServer(); $this->location = $location->asLocation(); - assert( - !is_nan($this->location->x) && !is_infinite($this->location->x) && - !is_nan($this->location->y) && !is_infinite($this->location->y) && - !is_nan($this->location->z) && !is_infinite($this->location->z) - ); $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0); $this->recalculateBoundingBox(); @@ -769,10 +771,6 @@ abstract class Entity{ $this->server->broadcastPackets($this->hasSpawned, [MoveActorAbsolutePacket::create( $this->id, $this->getOffsetPosition($this->location), - - //this looks very odd but is correct as of 1.5.0.7 - //for arrows this is actually x/y/z rotation - //for mobs x and z are used for pitch and yaw, and y is used for headyaw $this->location->pitch, $this->location->yaw, $this->location->yaw, @@ -1332,6 +1330,8 @@ abstract class Entity{ } public function setRotation(float $yaw, float $pitch) : void{ + Utils::checkFloatNotInfOrNaN("yaw", $yaw); + Utils::checkFloatNotInfOrNaN("pitch", $pitch); $this->location->yaw = $yaw; $this->location->pitch = $pitch; $this->scheduleUpdate(); @@ -1357,6 +1357,7 @@ abstract class Entity{ } public function setMotion(Vector3 $motion) : bool{ + Utils::checkVector3NotInfOrNaN($motion); if(!$this->justCreated){ $ev = new EntityMotionEvent($this, $motion); $ev->call(); @@ -1378,6 +1379,9 @@ abstract class Entity{ * Adds the given values to the entity's motion vector. */ public function addMotion(float $x, float $y, float $z) : void{ + Utils::checkFloatNotInfOrNaN("x", $x); + Utils::checkFloatNotInfOrNaN("y", $y); + Utils::checkFloatNotInfOrNaN("z", $z); $this->motion = $this->motion->add($x, $y, $z); } @@ -1389,10 +1393,18 @@ abstract class Entity{ * @param Vector3|Position|Location $pos */ public function teleport(Vector3 $pos, ?float $yaw = null, ?float $pitch = null) : bool{ + Utils::checkVector3NotInfOrNaN($pos); if($pos instanceof Location){ $yaw = $yaw ?? $pos->yaw; $pitch = $pitch ?? $pos->pitch; } + if($yaw !== null){ + Utils::checkFloatNotInfOrNaN("yaw", $yaw); + } + if($pitch !== null){ + Utils::checkFloatNotInfOrNaN("pitch", $pitch); + } + $from = $this->location->asPosition(); $to = Position::fromObject($pos, $pos instanceof Position ? $pos->getWorld() : $this->getWorld()); $ev = new EntityTeleportEvent($this, $from, $to); diff --git a/src/entity/EntityDataHelper.php b/src/entity/EntityDataHelper.php index f01a10bb7..607ea1c38 100644 --- a/src/entity/EntityDataHelper.php +++ b/src/entity/EntityDataHelper.php @@ -32,6 +32,8 @@ use pocketmine\nbt\tag\FloatTag; use pocketmine\nbt\tag\ListTag; use pocketmine\world\World; use function count; +use function is_infinite; +use function is_nan; final class EntityDataHelper{ @@ -39,6 +41,18 @@ final class EntityDataHelper{ //NOOP } + /** + * @throws SavedDataLoadingException + */ + private static function validateFloat(string $tagName, string $component, float $value) : void{ + if(is_infinite($value)){ + throw new SavedDataLoadingException("$component component of '$tagName' contains invalid infinite value"); + } + if(is_nan($value)){ + throw new SavedDataLoadingException("$component component of '$tagName' contains invalid NaN value"); + } + } + /** * @throws SavedDataLoadingException */ @@ -54,6 +68,8 @@ final class EntityDataHelper{ if(count($values) !== 2){ throw new SavedDataLoadingException("Expected exactly 2 entries for 'Rotation'"); } + self::validateFloat("Rotation", "yaw", $values[0]->getValue()); + self::validateFloat("Rotation", "pitch", $values[1]->getValue()); return Location::fromObject($pos, $world, $values[0]->getValue(), $values[1]->getValue()); } @@ -74,6 +90,15 @@ final class EntityDataHelper{ if(count($values) !== 3){ throw new SavedDataLoadingException("Expected exactly 3 entries in '$tagName' tag"); } - return new Vector3($values[0]->getValue(), $values[1]->getValue(), $values[2]->getValue()); + + $x = $values[0]->getValue(); + $y = $values[1]->getValue(); + $z = $values[2]->getValue(); + + self::validateFloat($tagName, "x", $x); + self::validateFloat($tagName, "y", $y); + self::validateFloat($tagName, "z", $z); + + return new Vector3($x, $y, $z); } } diff --git a/src/entity/EntityFactory.php b/src/entity/EntityFactory.php index 0010f0ace..4bd743042 100644 --- a/src/entity/EntityFactory.php +++ b/src/entity/EntityFactory.php @@ -27,10 +27,11 @@ use DaveRandom\CallbackValidator\CallbackType; use DaveRandom\CallbackValidator\ParameterType; use DaveRandom\CallbackValidator\ReturnType; use pocketmine\block\BlockFactory; -use pocketmine\data\bedrock\EntityLegacyIds; +use pocketmine\data\bedrock\EntityLegacyIds as LegacyIds; use pocketmine\data\bedrock\PotionTypeIdMap; use pocketmine\data\bedrock\PotionTypeIds; use pocketmine\data\SavedDataLoadingException; +use pocketmine\entity\EntityDataHelper as Helper; use pocketmine\entity\object\ExperienceOrb; use pocketmine\entity\object\FallingBlock; use pocketmine\entity\object\ItemEntity; @@ -81,20 +82,20 @@ final class EntityFactory{ //TODO: index them by version to allow proper multi-save compatibility $this->register(Arrow::class, function(World $world, CompoundTag $nbt) : Arrow{ - return new Arrow(EntityDataHelper::parseLocation($nbt, $world), null, $nbt->getByte(Arrow::TAG_CRIT, 0) === 1, $nbt); - }, ['Arrow', 'minecraft:arrow'], EntityLegacyIds::ARROW); + return new Arrow(Helper::parseLocation($nbt, $world), null, $nbt->getByte(Arrow::TAG_CRIT, 0) === 1, $nbt); + }, ['Arrow', 'minecraft:arrow'], LegacyIds::ARROW); $this->register(Egg::class, function(World $world, CompoundTag $nbt) : Egg{ - return new Egg(EntityDataHelper::parseLocation($nbt, $world), null, $nbt); - }, ['Egg', 'minecraft:egg'], EntityLegacyIds::EGG); + return new Egg(Helper::parseLocation($nbt, $world), null, $nbt); + }, ['Egg', 'minecraft:egg'], LegacyIds::EGG); $this->register(EnderPearl::class, function(World $world, CompoundTag $nbt) : EnderPearl{ - return new EnderPearl(EntityDataHelper::parseLocation($nbt, $world), null, $nbt); - }, ['ThrownEnderpearl', 'minecraft:ender_pearl'], EntityLegacyIds::ENDER_PEARL); + return new EnderPearl(Helper::parseLocation($nbt, $world), null, $nbt); + }, ['ThrownEnderpearl', 'minecraft:ender_pearl'], LegacyIds::ENDER_PEARL); $this->register(ExperienceBottle::class, function(World $world, CompoundTag $nbt) : ExperienceBottle{ - return new ExperienceBottle(EntityDataHelper::parseLocation($nbt, $world), null, $nbt); - }, ['ThrownExpBottle', 'minecraft:xp_bottle'], EntityLegacyIds::XP_BOTTLE); + return new ExperienceBottle(Helper::parseLocation($nbt, $world), null, $nbt); + }, ['ThrownExpBottle', 'minecraft:xp_bottle'], LegacyIds::XP_BOTTLE); $this->register(ExperienceOrb::class, function(World $world, CompoundTag $nbt) : ExperienceOrb{ $value = 1; @@ -104,12 +105,12 @@ final class EntityFactory{ $value = $valuePeTag->getValue(); } - return new ExperienceOrb(EntityDataHelper::parseLocation($nbt, $world), $value, $nbt); - }, ['XPOrb', 'minecraft:xp_orb'], EntityLegacyIds::XP_ORB); + return new ExperienceOrb(Helper::parseLocation($nbt, $world), $value, $nbt); + }, ['XPOrb', 'minecraft:xp_orb'], LegacyIds::XP_ORB); $this->register(FallingBlock::class, function(World $world, CompoundTag $nbt) : FallingBlock{ - return new FallingBlock(EntityDataHelper::parseLocation($nbt, $world), FallingBlock::parseBlockNBT(BlockFactory::getInstance(), $nbt), $nbt); - }, ['FallingSand', 'minecraft:falling_block'], EntityLegacyIds::FALLING_BLOCK); + return new FallingBlock(Helper::parseLocation($nbt, $world), FallingBlock::parseBlockNBT(BlockFactory::getInstance(), $nbt), $nbt); + }, ['FallingSand', 'minecraft:falling_block'], LegacyIds::FALLING_BLOCK); $this->register(ItemEntity::class, function(World $world, CompoundTag $nbt) : ItemEntity{ $itemTag = $nbt->getCompoundTag("Item"); @@ -121,8 +122,8 @@ final class EntityFactory{ if($item->isNull()){ throw new SavedDataLoadingException("Item is invalid"); } - return new ItemEntity(EntityDataHelper::parseLocation($nbt, $world), $item, $nbt); - }, ['Item', 'minecraft:item'], EntityLegacyIds::ITEM); + return new ItemEntity(Helper::parseLocation($nbt, $world), $item, $nbt); + }, ['Item', 'minecraft:item'], LegacyIds::ITEM); $this->register(Painting::class, function(World $world, CompoundTag $nbt) : Painting{ $motive = PaintingMotive::getMotiveByName($nbt->getString("Motive")); @@ -138,39 +139,39 @@ final class EntityFactory{ throw new SavedDataLoadingException("Missing facing info"); } - return new Painting(EntityDataHelper::parseLocation($nbt, $world), $blockIn, $facing, $motive, $nbt); - }, ['Painting', 'minecraft:painting'], EntityLegacyIds::PAINTING); + return new Painting(Helper::parseLocation($nbt, $world), $blockIn, $facing, $motive, $nbt); + }, ['Painting', 'minecraft:painting'], LegacyIds::PAINTING); $this->register(PrimedTNT::class, function(World $world, CompoundTag $nbt) : PrimedTNT{ - return new PrimedTNT(EntityDataHelper::parseLocation($nbt, $world), $nbt); - }, ['PrimedTnt', 'PrimedTNT', 'minecraft:tnt'], EntityLegacyIds::TNT); + return new PrimedTNT(Helper::parseLocation($nbt, $world), $nbt); + }, ['PrimedTnt', 'PrimedTNT', 'minecraft:tnt'], LegacyIds::TNT); $this->register(Snowball::class, function(World $world, CompoundTag $nbt) : Snowball{ - return new Snowball(EntityDataHelper::parseLocation($nbt, $world), null, $nbt); - }, ['Snowball', 'minecraft:snowball'], EntityLegacyIds::SNOWBALL); + return new Snowball(Helper::parseLocation($nbt, $world), null, $nbt); + }, ['Snowball', 'minecraft:snowball'], LegacyIds::SNOWBALL); $this->register(SplashPotion::class, function(World $world, CompoundTag $nbt) : SplashPotion{ $potionType = PotionTypeIdMap::getInstance()->fromId($nbt->getShort("PotionId", PotionTypeIds::WATER)); if($potionType === null){ throw new SavedDataLoadingException("No such potion type"); } - return new SplashPotion(EntityDataHelper::parseLocation($nbt, $world), null, $potionType, $nbt); - }, ['ThrownPotion', 'minecraft:potion', 'thrownpotion'], EntityLegacyIds::SPLASH_POTION); + return new SplashPotion(Helper::parseLocation($nbt, $world), null, $potionType, $nbt); + }, ['ThrownPotion', 'minecraft:potion', 'thrownpotion'], LegacyIds::SPLASH_POTION); $this->register(Squid::class, function(World $world, CompoundTag $nbt) : Squid{ - return new Squid(EntityDataHelper::parseLocation($nbt, $world), $nbt); - }, ['Squid', 'minecraft:squid'], EntityLegacyIds::SQUID); + return new Squid(Helper::parseLocation($nbt, $world), $nbt); + }, ['Squid', 'minecraft:squid'], LegacyIds::SQUID); $this->register(Villager::class, function(World $world, CompoundTag $nbt) : Villager{ - return new Villager(EntityDataHelper::parseLocation($nbt, $world), $nbt); - }, ['Villager', 'minecraft:villager'], EntityLegacyIds::VILLAGER); + return new Villager(Helper::parseLocation($nbt, $world), $nbt); + }, ['Villager', 'minecraft:villager'], LegacyIds::VILLAGER); $this->register(Zombie::class, function(World $world, CompoundTag $nbt) : Zombie{ - return new Zombie(EntityDataHelper::parseLocation($nbt, $world), $nbt); - }, ['Zombie', 'minecraft:zombie'], EntityLegacyIds::ZOMBIE); + return new Zombie(Helper::parseLocation($nbt, $world), $nbt); + }, ['Zombie', 'minecraft:zombie'], LegacyIds::ZOMBIE); $this->register(Human::class, function(World $world, CompoundTag $nbt) : Human{ - return new Human(EntityDataHelper::parseLocation($nbt, $world), Human::parseSkinNBT($nbt), $nbt); + return new Human(Helper::parseLocation($nbt, $world), Human::parseSkinNBT($nbt), $nbt); }, ['Human']); PaintingMotive::init(); diff --git a/src/event/block/BlockTeleportEvent.php b/src/event/block/BlockTeleportEvent.php index 3dcd041ae..d20de90e1 100644 --- a/src/event/block/BlockTeleportEvent.php +++ b/src/event/block/BlockTeleportEvent.php @@ -27,6 +27,7 @@ use pocketmine\block\Block; use pocketmine\event\Cancellable; use pocketmine\event\CancellableTrait; use pocketmine\math\Vector3; +use pocketmine\utils\Utils; class BlockTeleportEvent extends BlockEvent implements Cancellable{ use CancellableTrait; @@ -44,6 +45,7 @@ class BlockTeleportEvent extends BlockEvent implements Cancellable{ } public function setTo(Vector3 $to) : void{ + Utils::checkVector3NotInfOrNaN($to); $this->to = $to; } } diff --git a/src/event/entity/EntityTeleportEvent.php b/src/event/entity/EntityTeleportEvent.php index 33f1d8de6..a513b4686 100644 --- a/src/event/entity/EntityTeleportEvent.php +++ b/src/event/entity/EntityTeleportEvent.php @@ -26,6 +26,7 @@ namespace pocketmine\event\entity; use pocketmine\entity\Entity; use pocketmine\event\Cancellable; use pocketmine\event\CancellableTrait; +use pocketmine\utils\Utils; use pocketmine\world\Position; /** @@ -54,6 +55,7 @@ class EntityTeleportEvent extends EntityEvent implements Cancellable{ } public function setTo(Position $to) : void{ + Utils::checkVector3NotInfOrNaN($to); $this->to = $to; } } diff --git a/src/event/player/PlayerMoveEvent.php b/src/event/player/PlayerMoveEvent.php index d9f258a3c..62b8a2843 100644 --- a/src/event/player/PlayerMoveEvent.php +++ b/src/event/player/PlayerMoveEvent.php @@ -27,6 +27,7 @@ use pocketmine\entity\Location; use pocketmine\event\Cancellable; use pocketmine\event\CancellableTrait; use pocketmine\player\Player; +use pocketmine\utils\Utils; class PlayerMoveEvent extends PlayerEvent implements Cancellable{ use CancellableTrait; @@ -51,6 +52,7 @@ class PlayerMoveEvent extends PlayerEvent implements Cancellable{ } public function setTo(Location $to) : void{ + Utils::checkLocationNotInfOrNaN($to); $this->to = $to; } } diff --git a/src/event/player/PlayerRespawnEvent.php b/src/event/player/PlayerRespawnEvent.php index 5f1f291ac..1bdc2446c 100644 --- a/src/event/player/PlayerRespawnEvent.php +++ b/src/event/player/PlayerRespawnEvent.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace pocketmine\event\player; use pocketmine\player\Player; +use pocketmine\utils\Utils; use pocketmine\world\Position; /** @@ -46,6 +47,7 @@ class PlayerRespawnEvent extends PlayerEvent{ if(!$position->isValid()){ throw new \InvalidArgumentException("Spawn position must reference a valid and loaded World"); } + Utils::checkVector3NotInfOrNaN($position); $this->position = $position; } } diff --git a/src/network/mcpe/convert/TypeConverter.php b/src/network/mcpe/convert/TypeConverter.php index d03918efd..de17acdb0 100644 --- a/src/network/mcpe/convert/TypeConverter.php +++ b/src/network/mcpe/convert/TypeConverter.php @@ -232,6 +232,9 @@ class TypeConverter{ $compound = null; } } + if($meta < 0 || $meta >= 0x7fff){ //this meta value may have been restored from the NBT + throw new TypeConversionException("Item meta must be in range 0 ... " . 0x7fff . " (received $meta)"); + } try{ return ItemFactory::getInstance()->get( diff --git a/src/player/Player.php b/src/player/Player.php index fd54f9a98..2a0e4191f 100644 --- a/src/player/Player.php +++ b/src/player/Player.php @@ -253,6 +253,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{ protected bool $blockCollision = true; protected bool $flying = false; + /** @phpstan-var positive-int|null */ protected ?int $lineHeight = null; protected string $locale = "en_US"; diff --git a/src/plugin/DiskResourceProvider.php b/src/plugin/DiskResourceProvider.php index b1fd02686..15851acbb 100644 --- a/src/plugin/DiskResourceProvider.php +++ b/src/plugin/DiskResourceProvider.php @@ -71,6 +71,7 @@ class DiskResourceProvider implements ResourceProvider{ public function getResources() : array{ $resources = []; if(is_dir($this->file)){ + /** @var \SplFileInfo $resource */ foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->file)) as $resource){ if($resource->isFile()){ $path = str_replace(DIRECTORY_SEPARATOR, "/", substr((string) $resource, strlen($this->file))); diff --git a/src/plugin/PluginDescription.php b/src/plugin/PluginDescription.php index 0bd7587bb..b0182870b 100644 --- a/src/plugin/PluginDescription.php +++ b/src/plugin/PluginDescription.php @@ -156,7 +156,7 @@ class PluginDescription{ $k = $v; $v = "*"; } - $this->extensions[$k] = array_map('strval', is_array($v) ? $v : [$v]); + $this->extensions[(string) $k] = array_map('strval', is_array($v) ? $v : [$v]); } } diff --git a/src/utils/EnumTrait.php b/src/utils/EnumTrait.php index 40057b9ea..48e705c57 100644 --- a/src/utils/EnumTrait.php +++ b/src/utils/EnumTrait.php @@ -23,8 +23,6 @@ declare(strict_types=1); namespace pocketmine\utils; -use function preg_match; - trait EnumTrait{ use RegistryTrait; use NotCloneable; @@ -70,9 +68,7 @@ trait EnumTrait{ * @throws \InvalidArgumentException */ private function __construct(string $enumName){ - if(preg_match('/^\D[A-Za-z\d_]+$/u', $enumName, $matches) === 0){ - throw new \InvalidArgumentException("Invalid enum member name \"$enumName\", should only contain letters, numbers and underscores, and must not start with a number"); - } + self::verifyName($enumName); $this->enumName = $enumName; if(self::$nextId === null){ self::$nextId = Process::pid(); //this provides enough base entropy to prevent hardcoding diff --git a/src/utils/RegistryTrait.php b/src/utils/RegistryTrait.php index 185dfefb3..a6e551c47 100644 --- a/src/utils/RegistryTrait.php +++ b/src/utils/RegistryTrait.php @@ -26,17 +26,25 @@ namespace pocketmine\utils; use function array_map; use function count; use function mb_strtoupper; +use function preg_match; trait RegistryTrait{ /** @var object[] */ private static $members = null; + private static function verifyName(string $name) : void{ + if(preg_match('/^(?!\d)[A-Za-z\d_]+$/u', $name) === 0){ + throw new \InvalidArgumentException("Invalid member name \"$name\", should only contain letters, numbers and underscores, and must not start with a number"); + } + } + /** * Adds the given object to the registry. * * @throws \InvalidArgumentException */ private static function _registryRegister(string $name, object $member) : void{ + self::verifyName($name); $upperName = mb_strtoupper($name); if(isset(self::$members[$upperName])){ throw new \InvalidArgumentException("\"$upperName\" is already reserved"); diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 0b772ae64..adb3187f5 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -28,7 +28,9 @@ declare(strict_types=1); namespace pocketmine\utils; use DaveRandom\CallbackValidator\CallbackType; +use pocketmine\entity\Location; use pocketmine\errorhandler\ErrorTypeToStringMap; +use pocketmine\math\Vector3; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; use function array_combine; @@ -57,7 +59,9 @@ use function interface_exists; use function is_a; use function is_array; use function is_bool; +use function is_infinite; use function is_int; +use function is_nan; use function is_object; use function is_string; use function mb_check_encoding; @@ -602,4 +606,27 @@ final class Utils{ } return $value; } + + public static function checkFloatNotInfOrNaN(string $name, float $float) : void{ + if(is_nan($float)){ + throw new \InvalidArgumentException("$name cannot be NaN"); + } + if(is_infinite($float)){ + throw new \InvalidArgumentException("$name cannot be infinite"); + } + } + + public static function checkVector3NotInfOrNaN(Vector3 $vector3) : void{ + if($vector3 instanceof Location){ //location could be masquerading as vector3 + self::checkFloatNotInfOrNaN("yaw", $vector3->yaw); + self::checkFloatNotInfOrNaN("pitch", $vector3->pitch); + } + self::checkFloatNotInfOrNaN("x", $vector3->x); + self::checkFloatNotInfOrNaN("y", $vector3->y); + self::checkFloatNotInfOrNaN("z", $vector3->z); + } + + public static function checkLocationNotInfOrNaN(Location $location) : void{ + self::checkVector3NotInfOrNaN($location); + } } diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index 13603dbe5..b5a613455 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -435,11 +435,6 @@ parameters: count: 3 path: ../../../src/block/tile/Spawnable.php - - - message: "#^Array \\(array\\, string\\>\\) does not accept string\\|false\\.$#" - count: 1 - path: ../../../src/block/tile/TileFactory.php - - message: "#^Parameter \\#2 \\$replace of function str_replace expects array\\|string, string\\|null given\\.$#" count: 1 @@ -765,14 +760,9 @@ parameters: count: 1 path: ../../../src/plugin/PluginDescription.php - - - message: "#^Array \\(array\\\\) does not accept mixed\\.$#" - count: 2 - path: ../../../src/plugin/PluginDescription.php - - message: "#^Cannot cast mixed to string\\.$#" - count: 4 + count: 5 path: ../../../src/plugin/PluginDescription.php - @@ -800,6 +790,16 @@ parameters: count: 1 path: ../../../src/plugin/PluginDescription.php + - + message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$authors \\(array\\\\) does not accept array\\.$#" + count: 1 + path: ../../../src/plugin/PluginDescription.php + + - + message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$authors \\(array\\\\) does not accept array\\\\.$#" + count: 1 + path: ../../../src/plugin/PluginDescription.php + - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$depend \\(array\\\\) does not accept array\\.$#" count: 1 @@ -860,11 +860,6 @@ parameters: count: 1 path: ../../../src/resourcepacks/ZippedResourcePack.php - - - message: "#^Cannot call method count\\(\\) on ArrayObject\\\\>\\|null\\.$#" - count: 1 - path: ../../../src/scheduler/AsyncTask.php - - message: "#^Cannot call method getNotifier\\(\\) on pocketmine\\\\scheduler\\\\AsyncWorker\\|null\\.$#" count: 1 diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index 99fcbe5e6..cb5242cd3 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -5,6 +5,16 @@ parameters: count: 1 path: ../../../src/block/BaseBanner.php + - + message: "#^Property pocketmine\\\\block\\\\tile\\\\TileFactory\\:\\:\\$saveNames \\(array\\, string\\>\\) does not accept array\\, bool\\|string\\>\\.$#" + count: 1 + path: ../../../src/block/tile/TileFactory.php + + - + message: "#^Comparison operation \"\\<\" between int\\<1, max\\> and 1 is always false\\.$#" + count: 1 + path: ../../../src/console/ConsoleCommandSender.php + - message: "#^Method pocketmine\\\\crafting\\\\CraftingManager\\:\\:getDestructorCallbacks\\(\\) should return pocketmine\\\\utils\\\\ObjectSet\\ but returns pocketmine\\\\utils\\\\ObjectSet\\\\|pocketmine\\\\utils\\\\ObjectSet\\\\.$#" count: 1 @@ -20,20 +30,50 @@ parameters: count: 1 path: ../../../src/entity/projectile/Projectile.php + - + message: "#^Match arm comparison between 4 and 4 is always true\\.$#" + count: 1 + path: ../../../src/network/mcpe/handler/InGamePacketHandler.php + + - + message: "#^Match arm is unreachable because previous comparison is always true\\.$#" + count: 1 + path: ../../../src/network/mcpe/handler/InGamePacketHandler.php + + - + message: "#^Property pocketmine\\\\network\\\\mcpe\\\\raklib\\\\PthreadsChannelWriter\\:\\:\\$buffer is never read, only written\\.$#" + count: 1 + path: ../../../src/network/mcpe/raklib/PthreadsChannelWriter.php + + - + message: "#^Property pocketmine\\\\network\\\\mcpe\\\\raklib\\\\SnoozeAwarePthreadsChannelWriter\\:\\:\\$buffer is never read, only written\\.$#" + count: 1 + path: ../../../src/network/mcpe/raklib/SnoozeAwarePthreadsChannelWriter.php + + - + message: "#^Comparison operation \"\\<\" between int\\<1, max\\> and 1 is always false\\.$#" + count: 1 + path: ../../../src/player/Player.php + - message: "#^Dead catch \\- RuntimeException is never thrown in the try block\\.$#" count: 1 path: ../../../src/plugin/PluginManager.php - - message: "#^Parameter \\#1 \\$closure of static method pocketmine\\\\utils\\\\Utils\\:\\:getNiceClosureName\\(\\) expects Closure\\(\\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*\\)\\: mixed, Closure\\(TEvent of pocketmine\\\\event\\\\Event\\)\\: void given\\.$#" + message: "#^Static property pocketmine\\\\scheduler\\\\AsyncTask\\:\\:\\$threadLocalStorage \\(ArrayObject\\\\>\\|null\\) does not accept non\\-empty\\-array\\\\>\\|ArrayObject\\\\>\\.$#" count: 1 - path: ../../../src/plugin/PluginManager.php + path: ../../../src/scheduler/AsyncTask.php - - message: "#^Parameter \\#1 \\$yamlString of class pocketmine\\\\plugin\\\\PluginDescription constructor expects array\\|string, array\\ given\\.$#" + message: "#^Property pocketmine\\\\thread\\\\Thread\\:\\:\\$classLoaders \\(\\(iterable\\&Threaded\\)\\|null\\) does not accept array\\\\|\\(iterable\\&Threaded\\)\\.$#" count: 1 - path: ../../../src/plugin/ScriptPluginLoader.php + path: ../../../src/thread/Thread.php + + - + message: "#^Property pocketmine\\\\thread\\\\Worker\\:\\:\\$classLoaders \\(\\(iterable\\&Threaded\\)\\|null\\) does not accept array\\\\|\\(iterable\\&Threaded\\)\\.$#" + count: 1 + path: ../../../src/thread/Worker.php - message: "#^Dead catch \\- JsonException is never thrown in the try block\\.$#" @@ -45,3 +85,8 @@ parameters: count: 2 path: ../../../src/world/format/io/region/RegionLoader.php + - + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotSame\\(\\) with arguments stdClass, stdClass and 'Cloning registry…' will always evaluate to false\\.$#" + count: 1 + path: ../../phpunit/utils/CloningRegistryTraitTest.php + diff --git a/tests/phpstan/stubs/leveldb.stub b/tests/phpstan/stubs/leveldb.stub index 0b8a4f7cc..11423d25c 100644 --- a/tests/phpstan/stubs/leveldb.stub +++ b/tests/phpstan/stubs/leveldb.stub @@ -8,4 +8,11 @@ class LevelDB{ * @return string|false */ public function get($key, array $read_options = []){} -} \ No newline at end of file +} + +/** + * @implements Iterator + */ +class LevelDBIterator implements Iterator{ + +}