Ban foreach(arrayWithStringKeys as k => v)

this is not as good as phpstan/phpstan-src#769 (e.g. array_key_first()/array_key_last() aren't covered by this, nor is array_rand()) but it does eliminate the most infuriating cases where this usually crops up.
This commit is contained in:
Dylan K. Taylor
2021-11-15 22:52:05 +00:00
parent f2d5455c5e
commit 269231c228
24 changed files with 150 additions and 33 deletions

View File

@ -26,6 +26,7 @@ namespace pocketmine\generate_permission_doc;
use pocketmine\permission\DefaultPermissions;
use pocketmine\permission\PermissionManager;
use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\Utils;
use pocketmine\VersionInfo;
use Webmozart\PathUtil\Path;
use function count;
@ -90,7 +91,7 @@ foreach($permissions as $permission){
fwrite($doc, "|:-----|:----:|\n");
$children = $permission->getChildren();
ksort($children, SORT_STRING);
foreach($children as $childName => $isGranted){
foreach(Utils::stringifyKeys($children) as $childName => $isGranted){
fwrite($doc, "| `$childName` | " . ($isGranted ? "Granted" : "Denied") . " |\n");
}
fwrite($doc, "\n");