Skip to content

Commit b9981ef

Browse files
committed
Run CS fixer on tools directory
1 parent 38ef774 commit b9981ef

File tree

5 files changed

+47
-52
lines changed

5 files changed

+47
-52
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
$finder = PhpCsFixer\Finder::create()
44
->in(__DIR__ . '/src')
5+
->in(__DIR__ . '/tools')
56
->in(__DIR__ . '/tests');
67

78
return (new PhpCsFixer\Config)

tools/generate-command-parameter-types.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
<?php
22

33
/*
4+
* This file is part of BedrockProtocol.
5+
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
46
*
5-
* ____ _ _ __ __ _ __ __ ____
6-
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7-
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8-
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9-
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10-
*
11-
* This program is free software: you can redistribute it and/or modify
7+
* BedrockProtocol is free software: you can redistribute it and/or modify
128
* it under the terms of the GNU Lesser General Public License as published by
139
* the Free Software Foundation, either version 3 of the License, or
1410
* (at your option) any later version.
15-
*
16-
* @author PocketMine Team
17-
* @link http://www.pocketmine.net/
18-
*
19-
*
2011
*/
2112

2213
declare(strict_types=1);
2314

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

2617
use function count;
18+
use function dirname;
19+
use function fclose;
2720
use function file_get_contents;
21+
use function fopen;
2822
use function fwrite;
23+
use function is_array;
24+
use function json_decode;
2925
use function strtoupper;
3026
use function uasort;
3127

tools/generate-create-static-methods.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,19 @@
11
<?php
22

33
/*
4+
* This file is part of BedrockProtocol.
5+
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
46
*
5-
* ____ _ _ __ __ _ __ __ ____
6-
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7-
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8-
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9-
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10-
*
11-
* This program is free software: you can redistribute it and/or modify
7+
* BedrockProtocol is free software: you can redistribute it and/or modify
128
* it under the terms of the GNU Lesser General Public License as published by
139
* the Free Software Foundation, either version 3 of the License, or
1410
* (at your option) any later version.
15-
*
16-
* @author PocketMine Team
17-
* @link http://www.pocketmine.net/
18-
*
19-
*
20-
*/
11+
*/
2112

2213
declare(strict_types=1);
2314

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

26-
use pocketmine\network\mcpe\protocol\Packet;
2717
use function array_map;
2818
use function array_slice;
2919
use function basename;
@@ -33,9 +23,12 @@
3323
use function file_get_contents;
3424
use function file_put_contents;
3525
use function implode;
26+
use function max;
3627
use function preg_match;
3728
use function preg_split;
29+
use function str_pad;
3830
use function str_repeat;
31+
use function strlen;
3932
use function substr;
4033
use function trim;
4134

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

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

tools/generate-entity-ids.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
<?php
22

33
/*
4+
* This file is part of BedrockProtocol.
5+
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
46
*
5-
* ____ _ _ __ __ _ __ __ ____
6-
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7-
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8-
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9-
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10-
*
11-
* This program is free software: you can redistribute it and/or modify
7+
* BedrockProtocol is free software: you can redistribute it and/or modify
128
* it under the terms of the GNU Lesser General Public License as published by
139
* the Free Software Foundation, either version 3 of the License, or
1410
* (at your option) any later version.
15-
*
16-
* @author PocketMine Team
17-
* @link http://www.pocketmine.net/
18-
*
19-
*
2011
*/
2112

2213
declare(strict_types=1);
2314

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

17+
use function count;
18+
use function dirname;
19+
use function explode;
20+
use function fclose;
21+
use function file_get_contents;
22+
use function fopen;
23+
use function fwrite;
24+
use function is_array;
25+
use function json_decode;
26+
use function ksort;
27+
use function strtoupper;
28+
2629
if(count($argv) !== 2){
2730
fwrite(STDERR, "Required arguments: path to entity ID mapping file\n");
2831
exit(1);

tools/generate-level-sound-ids.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
<?php
22

33
/*
4+
* This file is part of BedrockProtocol.
5+
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
46
*
5-
* ____ _ _ __ __ _ __ __ ____
6-
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7-
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8-
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9-
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10-
*
11-
* This program is free software: you can redistribute it and/or modify
7+
* BedrockProtocol is free software: you can redistribute it and/or modify
128
* it under the terms of the GNU Lesser General Public License as published by
139
* the Free Software Foundation, either version 3 of the License, or
1410
* (at your option) any later version.
15-
*
16-
* @author PocketMine Team
17-
* @link http://www.pocketmine.net/
18-
*
19-
*
2011
*/
2112

2213
declare(strict_types=1);
2314

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

17+
use function array_flip;
18+
use function count;
19+
use function dirname;
20+
use function fclose;
21+
use function file_get_contents;
22+
use function fopen;
23+
use function fwrite;
24+
use function is_array;
25+
use function json_decode;
26+
use function ksort;
27+
use function str_replace;
28+
use function strtoupper;
29+
2630
if(count($argv) !== 2){
2731
fwrite(STDERR, "Required arguments: path to level sound event ID mapping file\n");
2832
exit(1);

0 commit comments

Comments
 (0)