From 345ac75aacbc692043306646ef519ae219dea99f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 20 Jan 2022 19:25:34 +0000 Subject: [PATCH] Remove PHPStan rules (no longer needed) this is enforced by php-cs-fixer now instead. --- phpstan.neon.dist | 3 - tests/phpstan/configs/and-or-logical.neon | 577 ------------------ .../rules/DisallowLogicalAndOperatorRule.php | 44 -- .../rules/DisallowLogicalOrOperatorRule.php | 44 -- 4 files changed, 668 deletions(-) delete mode 100644 tests/phpstan/configs/and-or-logical.neon delete mode 100644 tests/phpstan/rules/DisallowLogicalAndOperatorRule.php delete mode 100644 tests/phpstan/rules/DisallowLogicalOrOperatorRule.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 28e70f224..9ebc98502 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,6 +1,5 @@ includes: - tests/phpstan/configs/actual-problems.neon - - tests/phpstan/configs/and-or-logical.neon - tests/phpstan/configs/gc-hacks.neon - tests/phpstan/configs/impossible-generics.neon - tests/phpstan/configs/php-bugs.neon @@ -13,8 +12,6 @@ includes: rules: - pocketmine\phpstan\rules\DisallowEnumComparisonRule - - pocketmine\phpstan\rules\DisallowLogicalAndOperatorRule - - pocketmine\phpstan\rules\DisallowLogicalOrOperatorRule - pocketmine\phpstan\rules\UnsafeForeachArrayOfStringRule # - pocketmine\phpstan\rules\ThreadedSupportedTypesRule diff --git a/tests/phpstan/configs/and-or-logical.neon b/tests/phpstan/configs/and-or-logical.neon deleted file mode 100644 index 3c3e513bf..000000000 --- a/tests/phpstan/configs/and-or-logical.neon +++ /dev/null @@ -1,577 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 6 - path: ../../../src/MemoryManager.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 3 - path: ../../../src/MemoryManager.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/PocketMine.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 10 - path: ../../../src/Server.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 5 - path: ../../../src/Server.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/crafting/CraftingGrid.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/crafting/ShapedRecipe.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 5 - path: ../../../src/crafting/ShapedRecipe.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/crafting/ShapelessRecipe.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/crash/CrashDump.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/data/bedrock/LegacyToStringBidirectionalIdMap.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/entity/Attribute.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 4 - path: ../../../src/entity/Attribute.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/entity/AttributeMap.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 29 - path: ../../../src/entity/Entity.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 19 - path: ../../../src/entity/Entity.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/entity/EntityDataHelper.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/entity/EntityDataHelper.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 3 - path: ../../../src/entity/ExperienceManager.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 6 - path: ../../../src/entity/Human.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 4 - path: ../../../src/entity/HungerManager.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 3 - path: ../../../src/entity/HungerManager.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 9 - path: ../../../src/entity/Living.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 6 - path: ../../../src/entity/Living.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/entity/Location.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/entity/Skin.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/entity/Squid.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/entity/Villager.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/entity/effect/EffectInstance.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 3 - path: ../../../src/entity/effect/EffectManager.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/entity/effect/EffectManager.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/entity/effect/PoisonEffect.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 5 - path: ../../../src/entity/object/ExperienceOrb.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/entity/object/ExperienceOrb.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/entity/object/FallingBlock.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 3 - path: ../../../src/entity/object/FallingBlock.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 7 - path: ../../../src/entity/object/ItemEntity.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/entity/object/ItemEntity.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/entity/object/Painting.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/entity/object/Painting.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/entity/object/PrimedTNT.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 3 - path: ../../../src/entity/projectile/Arrow.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/entity/projectile/Arrow.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 7 - path: ../../../src/entity/projectile/Projectile.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 3 - path: ../../../src/entity/projectile/SplashPotion.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/event/HandlerList.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/event/HandlerList.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/event/HandlerListManager.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/event/RegisteredListener.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 4 - path: ../../../src/inventory/BaseInventory.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/inventory/BaseInventory.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/inventory/PlayerInventory.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/inventory/transaction/CraftingTransaction.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/item/Armor.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/item/Bow.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/item/Bow.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/item/Bucket.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/item/ChorusFruit.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 3 - path: ../../../src/item/ChorusFruit.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/item/Durable.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 7 - path: ../../../src/item/Item.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 6 - path: ../../../src/item/Item.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/item/ItemFactory.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/item/ItemFactory.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/item/ItemIdentifier.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/item/WrittenBook.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/item/enchantment/ProtectionEnchantment.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 5 - path: ../../../src/lang/Language.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 7 - path: ../../../src/lang/Language.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/network/Network.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/InventoryManager.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/InventoryManager.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 6 - path: ../../../src/network/mcpe/NetworkSession.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 5 - path: ../../../src/network/mcpe/NetworkSession.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/network/mcpe/auth/ProcessLoginTask.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/cache/ChunkCache.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/compression/ZlibCompressor.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/convert/ItemTranslator.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/network/mcpe/convert/TypeConverter.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 8 - path: ../../../src/network/mcpe/handler/InGamePacketHandler.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 4 - path: ../../../src/network/mcpe/handler/InGamePacketHandler.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/handler/LoginPacketHandler.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/handler/ResourcePacksPacketHandler.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/raklib/RakLibInterface.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/network/mcpe/raklib/RakLibServer.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/network/query/QueryHandler.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/network/query/QueryInfo.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/permission/BanEntry.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/permission/PermissibleInternal.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/player/OfflinePlayer.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 51 - path: ../../../src/player/Player.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 15 - path: ../../../src/player/Player.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/player/SurvivalBlockBreakHandler.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/plugin/ApiVersion.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/plugin/PharPluginLoader.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/plugin/PluginBase.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/plugin/PluginBase.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/plugin/PluginLoadabilityChecker.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/plugin/PluginLoadabilityChecker.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 4 - path: ../../../src/plugin/PluginManager.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 3 - path: ../../../src/plugin/PluginManager.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/plugin/ScriptPluginLoader.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/resourcepacks/ZippedResourcePack.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/resourcepacks/ZippedResourcePack.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/scheduler/AsyncPool.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 3 - path: ../../../src/scheduler/AsyncPool.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/scheduler/AsyncTask.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 3 - path: ../../../src/scheduler/AsyncTask.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 1 - path: ../../../src/scheduler/Task.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/scheduler/TaskScheduler.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/thread/ThreadManager.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 1 - path: ../../../src/updater/UpdateCheckTask.php - - - - message: "#^Use of the \"and\" operator is discouraged\\. Use && instead\\.$#" - count: 2 - path: ../../../src/updater/UpdateChecker.php - - - - message: "#^Use of the \"or\" operator is discouraged\\. Use \\|\\| instead\\.$#" - count: 2 - path: ../../../src/wizard/SetupWizard.php - diff --git a/tests/phpstan/rules/DisallowLogicalAndOperatorRule.php b/tests/phpstan/rules/DisallowLogicalAndOperatorRule.php deleted file mode 100644 index 49e6bbcc4..000000000 --- a/tests/phpstan/rules/DisallowLogicalAndOperatorRule.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -final class DisallowLogicalAndOperatorRule implements Rule{ - - public function getNodeType() : string{ - return LogicalAnd::class; - } - - public function processNode(Node $node, Scope $scope) : array{ - return [RuleErrorBuilder::message('Use of the "and" operator is discouraged. Use && instead.')->build()]; - } -} diff --git a/tests/phpstan/rules/DisallowLogicalOrOperatorRule.php b/tests/phpstan/rules/DisallowLogicalOrOperatorRule.php deleted file mode 100644 index 7aa43c706..000000000 --- a/tests/phpstan/rules/DisallowLogicalOrOperatorRule.php +++ /dev/null @@ -1,44 +0,0 @@ - - */ -final class DisallowLogicalOrOperatorRule implements Rule{ - - public function getNodeType() : string{ - return LogicalOr::class; - } - - public function processNode(Node $node, Scope $scope) : array{ - return [RuleErrorBuilder::message('Use of the "or" operator is discouraged. Use || instead.')->build()]; - } -}