mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 15:19:56 +00:00
Drop some obviously useless static function variables
these are better suited as constant literals.
This commit is contained in:
parent
6b6f77f8af
commit
b96565faa4
@ -61,18 +61,15 @@ class Rail extends BaseRail{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function getPossibleConnectionDirectionsOneConstraint(int $constraint) : array{
|
protected function getPossibleConnectionDirectionsOneConstraint(int $constraint) : array{
|
||||||
/** @var int[] $horizontal */
|
$possible = parent::getPossibleConnectionDirectionsOneConstraint($constraint);
|
||||||
static $horizontal = [
|
|
||||||
|
if(($constraint & self::FLAG_ASCEND) === 0){
|
||||||
|
foreach([
|
||||||
Facing::NORTH,
|
Facing::NORTH,
|
||||||
Facing::SOUTH,
|
Facing::SOUTH,
|
||||||
Facing::WEST,
|
Facing::WEST,
|
||||||
Facing::EAST
|
Facing::EAST
|
||||||
];
|
] as $d){
|
||||||
|
|
||||||
$possible = parent::getPossibleConnectionDirectionsOneConstraint($constraint);
|
|
||||||
|
|
||||||
if(($constraint & self::FLAG_ASCEND) === 0){
|
|
||||||
foreach($horizontal as $d){
|
|
||||||
if($constraint !== $d){
|
if($constraint !== $d){
|
||||||
$possible[$d] = true;
|
$possible[$d] = true;
|
||||||
}
|
}
|
||||||
|
@ -72,14 +72,13 @@ class Torch extends Flowable{
|
|||||||
$this->facing = $face;
|
$this->facing = $face;
|
||||||
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
return parent::place($tx, $item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||||
}else{
|
}else{
|
||||||
static $faces = [
|
foreach([
|
||||||
Facing::SOUTH,
|
Facing::SOUTH,
|
||||||
Facing::WEST,
|
Facing::WEST,
|
||||||
Facing::NORTH,
|
Facing::NORTH,
|
||||||
Facing::EAST,
|
Facing::EAST,
|
||||||
Facing::DOWN
|
Facing::DOWN
|
||||||
];
|
] as $side){
|
||||||
foreach($faces as $side){
|
|
||||||
$block = $this->getSide($side);
|
$block = $this->getSide($side);
|
||||||
if(!$block->isTransparent()){
|
if(!$block->isTransparent()){
|
||||||
$this->facing = Facing::opposite($side);
|
$this->facing = Facing::opposite($side);
|
||||||
|
@ -82,8 +82,7 @@ trait EnumTrait{
|
|||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
private function __construct(string $enumName){
|
private function __construct(string $enumName){
|
||||||
static $pattern = '/^\D[A-Za-z\d_]+$/u';
|
if(preg_match('/^\D[A-Za-z\d_]+$/u', $enumName, $matches) === 0){
|
||||||
if(preg_match($pattern, $enumName, $matches) === 0){
|
|
||||||
throw new \InvalidArgumentException("Invalid enum member name \"$enumName\", should only contain letters, numbers and underscores, and must not start with a number");
|
throw new \InvalidArgumentException("Invalid enum member name \"$enumName\", should only contain letters, numbers and underscores, and must not start with a number");
|
||||||
}
|
}
|
||||||
$this->enumName = $enumName;
|
$this->enumName = $enumName;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user