Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Commit

Permalink
Remove phpstan and php unit tests from travis (#289)
Browse files Browse the repository at this point in the history
* Remove phpstan and php unit tests from travis
* Added PhpStan config for Poggit
* Clean up PhpStan errors on poggit
* Remove support for non-poggit released economies (cleaning up phpstan errors)
* Version bump for BC Breaks
  • Loading branch information
jasonw4331 authored May 7, 2020
1 parent 18a1882 commit 9afbe6e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 315 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ before_script:
- cd ${TRAVIS_BUILD_DIR}
- chmod 777 ${TRAVIS_BUILD_DIR}/tests/travisScript.sh
- chmod 777 ${TRAVIS_BUILD_DIR}/tests/lint.sh
- curl -sSLO https://github.com/phpstan/phpstan/releases/download/0.12.3/phpstan.phar
- curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar

script:
- ${TRAVIS_BUILD_DIR}/tests/lint.sh -p php -d ${TRAVIS_BUILD_DIR}/src/MyPlot
- php phpstan.phar analyze --no-progress --memory-limit=2G || exit 1
# - (php phpunit.phar --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit || exit 1) | bash -s -
- cd ${TRAVIS_BUILD_DIR}/../PocketMine && ls
- ${TRAVIS_BUILD_DIR}/tests/travisScript.sh MyPlot MyPlot
- sed -i 's/world/Plots/' server.properties
Expand Down
193 changes: 12 additions & 181 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,182 +1,13 @@
parameters:
paths:
- src
level: 7
autoload_files:
- phar://%currentWorkingDirectory%/../PocketMine/PocketMine-MP.phar/vendor/autoload.php
autoload_directories:
- src
reportUnmatchedIgnoredErrors: false
checkMissingIterableValueType: false
ignoreErrors:
# level 1
-
message: "#^Call to static method fromSelection\\(\\) on an unknown class muqsit\\\\worldstyler\\\\shapes\\\\Cuboid\\.$#"
count: 5
path: src/MyPlot/MyPlot.php

-
message: "#^Call to static method fromSelection\\(\\) on an unknown class muqsit\\\\worldstyler\\\\shapes\\\\CommonShape\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Call to static method printSpoon\\(\\) on an unknown class spoondetector\\\\SpoonDetector\\.$#"
count: 1
path: src/MyPlot/MyPlot.php

-
message: "#^Class onebone\\\\economyapi\\\\EconomyAPI not found\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Class EssentialsPE\\\\Loader not found\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Class PocketMoney\\\\PocketMoney not found\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Class muqsit\\\\worldstyler\\\\WorldStyler not found\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Parameter \\$plugin of method MyPlot\\\\provider\\\\EconomySProvider\\:\\:__construct\\(\\) has invalid typehint type onebone\\\\economyapi\\\\EconomyAPI\\.$#"
path: src/MyPlot/provider/EconomySProvider.php

-
message: "#^Access to constant RET_SUCCESS on an unknown class onebone\\\\economyapi\\\\EconomyAPI\\.$#"
path: src/MyPlot/provider/EconomySProvider.php

-
message: "#^Parameter \\$plugin of method MyPlot\\\\provider\\\\EssentialsPEProvider\\:\\:__construct\\(\\) has invalid typehint type EssentialsPE\\\\Loader\\.$#"
path: src/MyPlot/provider/EssentialsPEProvider.php

-
message: "#^Parameter \\$plugin of method MyPlot\\\\provider\\\\PocketMoneyProvider\\:\\:__construct\\(\\) has invalid typehint type PocketMoney\\\\PocketMoney\\.$#"
path: src/MyPlot/provider/PocketMoneyProvider.php
# level 3
-
message: "#^PHPDoc tag @var for variable \\$styler contains unknown class muqsit\\\\worldstyler\\\\WorldStyler\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Call to method getSelection\\(\\) on an unknown class muqsit\\\\worldstyler\\\\WorldStyler\\.$#"
count: 6
path: src/MyPlot/MyPlot.php

-
message: "#^Call to method removeSelection\\(\\) on an unknown class muqsit\\\\worldstyler\\\\WorldStyler\\.$#"
count: 5
path: src/MyPlot/MyPlot.php

-
message: "#^Property MyPlot\\\\provider\\\\EconomySProvider\\:\\:\\$plugin has unknown class onebone\\\\economyapi\\\\EconomyAPI as its type\\.$#"
path: src/MyPlot/provider/EconomySProvider.php

-
message: "#^Call to method reduceMoney\\(\\) on an unknown class onebone\\\\economyapi\\\\EconomyAPI\\.$#"
path: src/MyPlot/provider/EconomySProvider.php

-
message: "#^Call to method getLogger\\(\\) on an unknown class onebone\\\\economyapi\\\\EconomyAPI\\.$#"
path: src/MyPlot/provider/EconomySProvider.php

-
message: "#^Property MyPlot\\\\provider\\\\EssentialsPEProvider\\:\\:\\$plugin has unknown class EssentialsPE\\\\Loader as its type\\.$#"
path: src/MyPlot/provider/EssentialsPEProvider.php

-
message: "#^Call to method getAPI\\(\\) on an unknown class EssentialsPE\\\\Loader\\.$#"
count: 3
path: src/MyPlot/provider/EssentialsPEProvider.php

-
message: "#^Call to method getLogger\\(\\) on an unknown class EssentialsPE\\\\Loader\\.$#"
count: 2
path: src/MyPlot/provider/EssentialsPEProvider.php

-
message: "#^Property MyPlot\\\\provider\\\\PocketMoneyProvider\\:\\:\\$plugin has unknown class PocketMoney\\\\PocketMoney as its type\\.$#"
path: src/MyPlot/provider/PocketMoneyProvider.php

-
message: "#^Call to method getMoney\\(\\) on an unknown class PocketMoney\\\\PocketMoney\\.$#"
path: src/MyPlot/provider/PocketMoneyProvider.php

-
message: "#^Call to method setMoney\\(\\) on an unknown class PocketMoney\\\\PocketMoney\\.$#"
path: src/MyPlot/provider/PocketMoneyProvider.php

-
message: "#^Call to method getLogger\\(\\) on an unknown class PocketMoney\\\\PocketMoney\\.$#"
path: src/MyPlot/provider/PocketMoneyProvider.php
# level 7
-
message: "#^Cannot cast pocketmine\\\\level\\\\generator\\\\Generator\\|string to string\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Parameter \\#2 \\$y of class pocketmine\\\\level\\\\Position constructor expects int, float\\|int given\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Parameter \\#3 \\$generator of method pocketmine\\\\Server\\:\\:generateLevel\\(\\) expects string\\|null, pocketmine\\\\level\\\\generator\\\\Generator\\|string given\\.$#"
path: src/MyPlot/MyPlot.php

-
message: "#^Cannot call method fetch_array\\(\\) on mysqli_result\\|false\\.$#"
count: 3
path: src/MyPlot/provider/MySQLProvider.php

-
message: "#^Property MyPlot\\\\provider\\\\MySQLProvider\\:\\:\\$[a-zA-Z0-9]* \\(mysqli_stmt\\) does not accept mysqli_stmt\\|false\\.$#"
count: 8
path: src/MyPlot/provider/MySQLProvider.php

-
message: "#^Property MyPlot\\\\provider\\\\SQLiteDataProvider\\:\\:\\$[a-zA-Z90-9]* \\(SQLite3Stmt\\) does not accept SQLite3Stmt\\|false\\.$#"
count: 8
path: src/MyPlot/provider/SQLiteDataProvider.php

-
message: "#^Parameter \\#2 \\$params of method pocketmine\\\\lang\\\\BaseLang\\:\\:translateString\\(\\) expects array<string>, array<float\\|int\\|string> given\\.$#"
path: src/MyPlot/subcommand/SubCommand.php
#level 8
-
message: "#^Parameter \\#1 \\$str of function strtolower expects string, string\\|null given\\.$#"
path: src/MyPlot/Commands.php

-
message: "#^Cannot call method getFolderName\\(\\) on pocketmine\\\\level\\\\Level\\|null\\.$#"
path: src/MyPlot/EventListener.php

-
message: "#^Cannot clone non-object variable \\$beginPos of type pocketmine\\\\level\\\\Position\\|null\\.$#"
path: src/MyPlot/EventListener.php

-
message: "#^Cannot access property \\$x on pocketmine\\\\level\\\\Position\\|null\\.$#"
path: src/MyPlot/EventListener.php

-
message: "#^Cannot access property \\$z on pocketmine\\\\level\\\\Position\\|null\\.$#"
path: src/MyPlot/EventListener.php

-
message: "#^Cannot access property \\$plotSize on MyPlot\\\\PlotLevelSettings\\|null\\.$#"
count: 2
path: src/MyPlot/EventListener.php

-
message: "#^Cannot access property \\$restrictEntityMovement on MyPlot\\\\PlotLevelSettings\\|null\\.$#"
path: src/MyPlot/EventListener.php

-
message: "#^Cannot access property \\$updatePlotLiquids on MyPlot\\\\PlotLevelSettings\\|null\\.$#"
path: src/MyPlot/EventListener.php

-
message: "#^Cannot access property \\$restrictPVP on MyPlot\\\\PlotLevelSettings\\|null\\.$#"
count: 2
path: src/MyPlot/EventListener.php
level: 6
checkMissingIterableValueType: false
paths:
- /source/src
- /deps
autoload_files:
- phar:///pocketmine/PocketMine-MP.phar/vendor/autoload.php
autoload_directories:
- /source/src
- /deps
excludes_analyse:
- /deps
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: MyPlot
main: MyPlot\MyPlot
version: 1.6.10
version: 1.7.0
api:
- 3.4.0
authors:
Expand Down
2 changes: 1 addition & 1 deletion resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MySQLSettings:
ShutdownOnFailure: false

# Use an economy with MyPlot. This will allow for plot pricing such as claiming, clearing, etc.
# Currently supported economy plugins: Economy$, PocketMoney, EssentialsPE, EconomyPlus
# Currently supported economy plugins: Economy$
# Be sure not to use more than 1 economy plugin!
UseEconomy: false

Expand Down
14 changes: 0 additions & 14 deletions src/MyPlot/MyPlot.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,20 +1056,6 @@ public function onEnable() : void {
}else
$this->getLogger()->debug("Eco not instance of EconomyAPI");
}
elseif(($plugin = $this->getServer()->getPluginManager()->getPlugin("EssentialsPE")) !== null) {
if($plugin instanceof Loader) {
$this->economyProvider = new EssentialsPEProvider($plugin);
$this->getLogger()->debug("Eco set to EssentialsPE");
}else
$this->getLogger()->debug("Eco not instance of EssentialsPE");
}
elseif(($plugin = $this->getServer()->getPluginManager()->getPlugin("PocketMoney")) !== null) {
if($plugin instanceof PocketMoney) {
$this->economyProvider = new PocketMoneyProvider($plugin);
$this->getLogger()->debug("Eco set to PocketMoney");
}else
$this->getLogger()->debug("Eco not instance of PocketMoney");
}
if(!isset($this->economyProvider)) {
$this->getLogger()->info("No supported economy plugin found!");
$this->getConfig()->set("UseEconomy", false);
Expand Down
2 changes: 1 addition & 1 deletion src/MyPlot/MyPlotGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function generateChunk(int $chunkX, int $chunkZ) : void {
* @param int $x
* @param int $z
*
* @return \SplFixedArray
* @return \SplFixedArray<int>
*/
public function getShape(int $x, int $z) {
$totalSize = $this->plotSize + $this->roadWidth;
Expand Down
42 changes: 0 additions & 42 deletions src/MyPlot/provider/EssentialsPEProvider.php

This file was deleted.

45 changes: 0 additions & 45 deletions src/MyPlot/provider/PocketMoneyProvider.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/MyPlot/task/ClearBorderTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function onRun(int $currentTick) : void {
$block = $this->plotWallBlock;
elseif($y === $this->height)
$block = $this->roadBlock;
elseif($y < $this->height)
else//if($y < $this->height)
$block = $this->groundBlock;
$this->level->setBlock(new Vector3($x, $y, $this->plotBeginPos->z), $block, false, false);
$this->level->setBlock(new Vector3($x, $y, $this->zMax), $block, false, false);
Expand All @@ -82,7 +82,7 @@ public function onRun(int $currentTick) : void {
$block = $this->plotWallBlock;
elseif($y === $this->height)
$block = $this->roadBlock;
elseif($y < $this->height)
else//if($y < $this->height)
$block = $this->groundBlock;
$this->level->setBlock(new Vector3($this->plotBeginPos->x, $y, $z), $block, false, false);
$this->level->setBlock(new Vector3($this->xMax, $y, $z), $block, false, false);
Expand Down
24 changes: 0 additions & 24 deletions tests/phpstan/bootstrap.php

This file was deleted.

0 comments on commit 9afbe6e

Please sign in to comment.