Skip to content

Commit

Permalink
Remove some fully qualified function calls
Browse files Browse the repository at this point in the history
PhpStorm can't see these or understand how they are being called, which is very annoying for bug hunting. Additionally, we already have the CodeOptimizer for this.
  • Loading branch information
dktapps committed Jun 18, 2018
1 parent 49f8083 commit 2d3ce9e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/pocketmine/Player.php
Expand Up @@ -686,7 +686,7 @@ public function sendCommandData(){

$aliases = $command->getAliases();
if(!empty($aliases)){
if(!\in_array($data->commandName, $aliases, true)){
if(!in_array($data->commandName, $aliases, true)){
//work around a client bug which makes the original name not show when aliases are used
$aliases[] = $data->commandName;
}
Expand Down
4 changes: 2 additions & 2 deletions src/pocketmine/PocketMine.php
Expand Up @@ -171,8 +171,8 @@ function critical_error($message){

$opts = getopt("", ["data:", "plugins:", "no-wizard", "enable-profiler"]);

define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : \realpath(\getcwd()) . DIRECTORY_SEPARATOR);
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : \realpath(\getcwd()) . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
define('pocketmine\DATA', isset($opts["data"]) ? $opts["data"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR);
define('pocketmine\PLUGIN_PATH', isset($opts["plugins"]) ? $opts["plugins"] . DIRECTORY_SEPARATOR : realpath(getcwd()) . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);

if(!file_exists(\pocketmine\DATA)){
mkdir(\pocketmine\DATA, 0777, true);
Expand Down
2 changes: 1 addition & 1 deletion src/pocketmine/Server.php
Expand Up @@ -2162,7 +2162,7 @@ public function exceptionHandler(\Throwable $e, $trace = null){
$this->logger->logException($e, $trace);

$lastError = [
"type" => \get_class($e),
"type" => get_class($e),
"message" => $errstr,
"fullFile" => $e->getFile(),
"file" => $errfile,
Expand Down
4 changes: 2 additions & 2 deletions src/pocketmine/entity/Effect.php
Expand Up @@ -111,8 +111,8 @@ public static function getEffect(int $id) : ?Effect{
*/
public static function getEffectByName(string $name) : ?Effect{
$const = self::class . "::" . strtoupper($name);
if(\defined($const)){
return self::getEffect(\constant($const));
if(defined($const)){
return self::getEffect(constant($const));
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pocketmine/entity/projectile/Projectile.php
Expand Up @@ -215,7 +215,7 @@ public function move(float $dx, float $dy, float $dz) : void{
}elseif($blockHit !== null){
$ev = new ProjectileHitBlockEvent($this, $hitResult, $blockHit);
}else{
\assert(false, "unknown hit type");
assert(false, "unknown hit type");
}

if($ev !== null){
Expand Down
4 changes: 2 additions & 2 deletions src/pocketmine/event/EventPriority.php
Expand Up @@ -82,8 +82,8 @@ abstract class EventPriority{
public static function fromString(string $name) : int{
$name = strtoupper($name);
$const = self::class . "::" . $name;
if($name !== "ALL" and \defined($const)){
return \constant($const);
if($name !== "ALL" and defined($const)){
return constant($const);
}

throw new \InvalidArgumentException("Unable to resolve priority \"$name\"");
Expand Down
2 changes: 1 addition & 1 deletion src/pocketmine/plugin/PluginDescription.php
Expand Up @@ -59,7 +59,7 @@ class PluginDescription{
* @param string|array $yamlString
*/
public function __construct($yamlString){
$this->loadMap(!is_array($yamlString) ? \yaml_parse($yamlString) : $yamlString);
$this->loadMap(!is_array($yamlString) ? yaml_parse($yamlString) : $yamlString);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/pocketmine/plugin/PluginManager.php
Expand Up @@ -796,7 +796,7 @@ public function registerEvents(Listener $listener, Plugin $plugin) : void{
try{
$priority = isset($tags["priority"]) ? EventPriority::fromString($tags["priority"]) : EventPriority::NORMAL;
}catch(\InvalidArgumentException $e){
throw new PluginException("Event handler " . \get_class($listener) . "->" . $method->getName() . "() declares invalid/unknown priority \"" . $tags["priority"] . "\"");
throw new PluginException("Event handler " . get_class($listener) . "->" . $method->getName() . "() declares invalid/unknown priority \"" . $tags["priority"] . "\"");
}
$ignoreCancelled = isset($tags["ignoreCancelled"]) && strtolower($tags["ignoreCancelled"]) === "true";

Expand Down

0 comments on commit 2d3ce9e

Please sign in to comment.