Merge pull request #4799 from Icinga/php-81-support

Fix PHP 8.1 deprecation errors
This commit is contained in:
Johannes Meyer 2022-06-07 15:11:44 +02:00 committed by GitHub
commit 77060ed312
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -124,6 +124,7 @@ class LinearUnit implements AxisUnit
* *
* @return int * @return int
*/ */
#[\ReturnTypeWillChange]
public function current() public function current()
{ {
return $this->currentTick; return $this->currentTick;
@ -132,7 +133,7 @@ class LinearUnit implements AxisUnit
/** /**
* Calculate the next tick and tick value * Calculate the next tick and tick value
*/ */
public function next() public function next(): void
{ {
$this->currentTick += (100 / $this->nrOfTicks); $this->currentTick += (100 / $this->nrOfTicks);
$this->currentValue += (($this->max - $this->min) / $this->nrOfTicks); $this->currentValue += (($this->max - $this->min) / $this->nrOfTicks);
@ -143,6 +144,7 @@ class LinearUnit implements AxisUnit
* *
* @return string The label for the current tick * @return string The label for the current tick
*/ */
#[\ReturnTypeWillChange]
public function key() public function key()
{ {
return (string) intval($this->currentValue); return (string) intval($this->currentValue);
@ -153,7 +155,7 @@ class LinearUnit implements AxisUnit
* *
* @return bool * @return bool
*/ */
public function valid() public function valid(): bool
{ {
return $this->currentTick >= 0 && $this->currentTick <= 100; return $this->currentTick >= 0 && $this->currentTick <= 100;
} }
@ -161,7 +163,7 @@ class LinearUnit implements AxisUnit
/** /**
* Reset the current tick and label value * Reset the current tick and label value
*/ */
public function rewind() public function rewind(): void
{ {
$this->currentTick = 0; $this->currentTick = 0;
$this->currentValue = $this->min; $this->currentValue = $this->min;

View File

@ -1221,7 +1221,8 @@ class Form extends Zend_Form
*/ */
public function isSubmitted() public function isSubmitted()
{ {
if (strtolower($this->getRequest()->getMethod()) !== $this->getMethod()) { $requestMethod = $this->getRequest()->getMethod();
if (strtolower($requestMethod ?: '') !== $this->getMethod()) {
return false; return false;
} }
if ($this->getIsApiTarget() || $this->getRequest()->isApiRequest()) { if ($this->getIsApiTarget() || $this->getRequest()->isApiRequest()) {
@ -1488,7 +1489,8 @@ class Form extends Zend_Form
*/ */
protected function getRequestData() protected function getRequestData()
{ {
if (strtolower($this->request->getMethod()) === $this->getMethod()) { $requestMethod = $this->getRequest()->getMethod();
if (strtolower($requestMethod ?: '') === $this->getMethod()) {
return $this->request->{'get' . ($this->request->isPost() ? 'Post' : 'Query')}(); return $this->request->{'get' . ($this->request->isPost() ? 'Post' : 'Query')}();
} }