mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
PHPStan: don't remember possibly-impure function return values
I don't think we get much benefit from this, and the assumption that functions with a return value are pure is sketchy. In any case, it's better to avoid these repeated calls anyway.
This commit is contained in:
parent
d42ec06647
commit
847ae26cad
@ -19,6 +19,7 @@ rules:
|
|||||||
parameters:
|
parameters:
|
||||||
level: 9
|
level: 9
|
||||||
checkMissingCallableSignature: true
|
checkMissingCallableSignature: true
|
||||||
|
rememberPossiblyImpureFunctionValues: false #risky to remember these, better for performance to avoid repeated calls anyway
|
||||||
treatPhpDocTypesAsCertain: false
|
treatPhpDocTypesAsCertain: false
|
||||||
bootstrapFiles:
|
bootstrapFiles:
|
||||||
- tests/phpstan/bootstrap.php
|
- tests/phpstan/bootstrap.php
|
||||||
|
@ -290,10 +290,11 @@ abstract class Projectile extends Entity{
|
|||||||
$damage = $this->getResultDamage();
|
$damage = $this->getResultDamage();
|
||||||
|
|
||||||
if($damage >= 0){
|
if($damage >= 0){
|
||||||
if($this->getOwningEntity() === null){
|
$owner = $this->getOwningEntity();
|
||||||
|
if($owner === null){
|
||||||
$ev = new EntityDamageByEntityEvent($this, $entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage);
|
$ev = new EntityDamageByEntityEvent($this, $entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage);
|
||||||
}else{
|
}else{
|
||||||
$ev = new EntityDamageByChildEntityEvent($this->getOwningEntity(), $this, $entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage);
|
$ev = new EntityDamageByChildEntityEvent($owner, $this, $entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
$entityHit->attack($ev);
|
$entityHit->attack($ev);
|
||||||
|
@ -101,11 +101,12 @@ class BanEntry{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getString() : string{
|
public function getString() : string{
|
||||||
|
$expires = $this->getExpires();
|
||||||
return implode("|", [
|
return implode("|", [
|
||||||
$this->getName(),
|
$this->getName(),
|
||||||
$this->getCreated()->format(self::$format),
|
$this->getCreated()->format(self::$format),
|
||||||
$this->getSource(),
|
$this->getSource(),
|
||||||
$this->getExpires() === null ? "Forever" : $this->getExpires()->format(self::$format),
|
$expires === null ? "Forever" : $expires->format(self::$format),
|
||||||
$this->getReason()
|
$this->getReason()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user