Skip to content

Commit eb47411

Browse files
committed
Refactor: replace inline FQCNs with use imports
1 parent 802b2b2 commit eb47411

6 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/imperazim/form/custom/elements/Slider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace imperazim\form\custom\elements;
66

7+
use InvalidArgumentException;
8+
79
/**
810
* Represents a slider element.
911
*/
@@ -25,10 +27,10 @@ public function __construct(
2527
private float $default
2628
) {
2729
if ($min >= $max) {
28-
throw new \InvalidArgumentException("Slider min ($min) must be less than max ($max)");
30+
throw new InvalidArgumentException("Slider min ($min) must be less than max ($max)");
2931
}
3032
if ($step <= 0) {
31-
throw new \InvalidArgumentException("Slider step must be greater than 0");
33+
throw new InvalidArgumentException("Slider step must be greater than 0");
3234
}
3335
$this->default = max($min, min($max, $default));
3436
parent::__construct($id);

src/imperazim/form/long/DynamicButtonForm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use imperazim\form\FormResult;
1111
use imperazim\form\base\elements\Title;
1212
use imperazim\form\long\elements\ButtonCollection;
13+
use pocketmine\form\FormValidationException;
1314

1415
/**
1516
* LongForm with buttons generated dynamically from a data source.
@@ -105,7 +106,7 @@ public function handleResponse(Player $player, mixed $raw): void {
105106
}
106107

107108
if (!is_int($raw)) {
108-
throw new \pocketmine\form\FormValidationException("Expected null or int, got " . gettype($raw));
109+
throw new FormValidationException("Expected null or int, got " . gettype($raw));
109110
}
110111

111112
$buttons = $this->resolveButtons();

src/imperazim/form/long/DynamicLongForm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use imperazim\form\long\elements\ButtonTexture;
1515
use imperazim\form\long\elements\ButtonCollection;
1616
use imperazim\form\long\response\ButtonResponse;
17+
use pocketmine\form\FormValidationException;
1718

1819
/**
1920
* Dynamic implementation of a long form with fluent interface.
@@ -211,7 +212,7 @@ public function handleResponse(Player $player, mixed $data): void {
211212
} elseif (is_int($data)) {
212213
$result = FormResult::CLOSE;
213214
} else {
214-
throw new \pocketmine\form\FormValidationException("Expected null or int, got " . gettype($data));
215+
throw new FormValidationException("Expected null or int, got " . gettype($data));
215216
}
216217

217218
if ($result === FormResult::KEEP) {

src/imperazim/form/long/LongForm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use imperazim\form\base\elements\Title;
1212
use imperazim\form\base\elements\Content;
1313
use imperazim\form\long\elements\ButtonCollection;
14+
use pocketmine\form\FormValidationException;
1415

1516
/**
1617
* Abstract base class for long (simple) forms.
@@ -124,7 +125,7 @@ public function handleResponse(Player $player, mixed $raw): void {
124125
$button = $buttons[$raw] ?? null;
125126
$result = $button ? $button->getResponse()->handle($player) : FormResult::CLOSE;
126127
} else {
127-
throw new \pocketmine\form\FormValidationException("Expected null or int, got " . gettype($raw));
128+
throw new FormValidationException("Expected null or int, got " . gettype($raw));
128129
}
129130

130131
if ($result === FormResult::KEEP) {

src/imperazim/form/long/PaginatedLongForm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use imperazim\form\long\elements\ButtonTexture;
1616
use imperazim\form\long\elements\ButtonCollection;
1717
use imperazim\form\long\response\ButtonResponse;
18+
use pocketmine\form\FormValidationException;
1819

1920
/**
2021
* LongForm with automatic pagination.
@@ -124,7 +125,7 @@ public function handleResponse(Player $player, mixed $raw): void {
124125
}
125126

126127
if (!is_int($raw)) {
127-
throw new \pocketmine\form\FormValidationException("Expected null or int, got " . gettype($raw));
128+
throw new FormValidationException("Expected null or int, got " . gettype($raw));
128129
}
129130

130131
$pageButtons = $this->getPageButtons();

src/imperazim/form/long/response/ButtonResponse.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use pocketmine\player\Player;
88
use imperazim\form\FormResult;
9+
use Closure;
910

1011
/**
1112
* Handles button click responses.
@@ -14,7 +15,7 @@ final class ButtonResponse {
1415
/**
1516
* @param \Closure $handler Response handler function
1617
*/
17-
public function __construct(private \Closure $handler) {}
18+
public function __construct(private Closure $handler) {}
1819

1920
/**
2021
* Executes the response handler.

0 commit comments

Comments
 (0)