Skip to content

Commit

Permalink
Run CS fixer on tools directory
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Mar 13, 2024
1 parent 38ef774 commit b9981ef
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 52 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tools')
->in(__DIR__ . '/tests');

return (new PhpCsFixer\Config)
Expand Down
20 changes: 8 additions & 12 deletions tools/generate-command-parameter-types.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
<?php

/*
* This file is part of BedrockProtocol.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* BedrockProtocol is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/

declare(strict_types=1);

namespace pocketmine\network\mcpe\protocol\tools\generate_command_parameter_types;

use function count;
use function dirname;
use function fclose;
use function file_get_contents;
use function fopen;
use function fwrite;
use function is_array;
use function json_decode;
use function strtoupper;
use function uasort;

Expand Down
23 changes: 7 additions & 16 deletions tools/generate-create-static-methods.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
<?php

/*
* This file is part of BedrockProtocol.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* BedrockProtocol is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
*/

declare(strict_types=1);

namespace pocketmine\network\mcpe\protocol\tools\generate_create_static_methods;

use pocketmine\network\mcpe\protocol\Packet;
use function array_map;
use function array_slice;
use function basename;
Expand All @@ -33,9 +23,12 @@
use function file_get_contents;
use function file_put_contents;
use function implode;
use function max;
use function preg_match;
use function preg_split;
use function str_pad;
use function str_repeat;
use function strlen;
use function substr;
use function trim;

Expand Down Expand Up @@ -119,7 +112,6 @@ function generateCreateFunction(\ReflectionClass $reflect, int $indentLevel, int
return array_map(fn(string $line) => str_repeat("\t", $indentLevel) . $line, $lines);
}


foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(dirname(__DIR__) . '/src', \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::CURRENT_AS_PATHNAME)) as $file){
if(substr($file, -4) !== ".php"){
continue;
Expand Down Expand Up @@ -162,4 +154,3 @@ function generateCreateFunction(\ReflectionClass $reflect, int $indentLevel, int
file_put_contents($file, implode("\n", $beforeLines) . "\n" . implode("\n", generateCreateFunction($reflect, 1, $createReflect->getModifiers())) . "\n" . implode("\n", $afterLines));
echo "successfully patched class\n";
}

27 changes: 15 additions & 12 deletions tools/generate-entity-ids.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
<?php

/*
* This file is part of BedrockProtocol.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* BedrockProtocol is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/

declare(strict_types=1);

namespace pocketmine\network\mcpe\protocol\tools\generate_entity_ids;

use function count;
use function dirname;
use function explode;
use function fclose;
use function file_get_contents;
use function fopen;
use function fwrite;
use function is_array;
use function json_decode;
use function ksort;
use function strtoupper;

if(count($argv) !== 2){
fwrite(STDERR, "Required arguments: path to entity ID mapping file\n");
exit(1);
Expand Down
28 changes: 16 additions & 12 deletions tools/generate-level-sound-ids.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
<?php

/*
* This file is part of BedrockProtocol.
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* BedrockProtocol is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/

declare(strict_types=1);

namespace pocketmine\network\mcpe\protocol\tools\generate_entity_ids;

use function array_flip;
use function count;
use function dirname;
use function fclose;
use function file_get_contents;
use function fopen;
use function fwrite;
use function is_array;
use function json_decode;
use function ksort;
use function str_replace;
use function strtoupper;

if(count($argv) !== 2){
fwrite(STDERR, "Required arguments: path to level sound event ID mapping file\n");
exit(1);
Expand Down

0 comments on commit b9981ef

Please sign in to comment.