fix deprecations on php 8.4+
Mark threshold parameters as explicitly nullable and silence return type deprecations of ReflectionDecoratedFunction while keeping php 7.1 support.
This commit is contained in:
parent
fff1013711
commit
12918eb3cb
@ -23,126 +23,176 @@ class ReflectionDecoratedFunction extends \ReflectionFunction
|
|||||||
$this->reflection = reflect($decorated);
|
$this->reflection = reflect($decorated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function inNamespace()
|
public function inNamespace()
|
||||||
{
|
{
|
||||||
return $this->reflection->inNamespace();
|
return $this->reflection->inNamespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function isClosure()
|
public function isClosure()
|
||||||
{
|
{
|
||||||
return $this->reflection->isVariadic();
|
return $this->reflection->isVariadic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function isDeprecated()
|
public function isDeprecated()
|
||||||
{
|
{
|
||||||
return $this->reflection->isDeprecated();
|
return $this->reflection->isDeprecated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function isInternal()
|
public function isInternal()
|
||||||
{
|
{
|
||||||
return $this->reflection->isInternal();
|
return $this->reflection->isInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function isUserDefined()
|
public function isUserDefined()
|
||||||
{
|
{
|
||||||
return $this->reflection->isUserDefined();
|
return $this->reflection->isUserDefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getClosureThis()
|
public function getClosureThis()
|
||||||
{
|
{
|
||||||
return $this->reflection->getClosureThis();
|
return $this->reflection->getClosureThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getClosureScopeClass()
|
public function getClosureScopeClass()
|
||||||
{
|
{
|
||||||
return $this->reflection->getClosureScopeClass();
|
return $this->reflection->getClosureScopeClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getDocComment()
|
public function getDocComment()
|
||||||
{
|
{
|
||||||
return $this->reflection->getDocComment();
|
return $this->reflection->getDocComment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getEndLine()
|
public function getEndLine()
|
||||||
{
|
{
|
||||||
return $this->reflection->getEndLine();
|
return $this->reflection->getEndLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getExtension()
|
public function getExtension()
|
||||||
{
|
{
|
||||||
return $this->reflection->getExtension();
|
return $this->reflection->getExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getExtensionName()
|
public function getExtensionName()
|
||||||
{
|
{
|
||||||
return $this->reflection->getExtensionName();
|
return $this->reflection->getExtensionName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getFileName()
|
public function getFileName()
|
||||||
{
|
{
|
||||||
return $this->reflection->getFileName();
|
return $this->reflection->getFileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return $this->reflection->getName();
|
return $this->reflection->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getNamespaceName()
|
public function getNamespaceName()
|
||||||
{
|
{
|
||||||
return $this->reflection->getNamespaceName();
|
return $this->reflection->getNamespaceName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getNumberOfParameters()
|
public function getNumberOfParameters()
|
||||||
{
|
{
|
||||||
return $this->reflection->getNumberOfParameters();
|
return $this->reflection->getNumberOfParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getNumberOfRequiredParameters()
|
public function getNumberOfRequiredParameters()
|
||||||
{
|
{
|
||||||
return $this->reflection->getNumberOfRequiredParameters();
|
return $this->reflection->getNumberOfRequiredParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getParameters()
|
public function getParameters()
|
||||||
{
|
{
|
||||||
return $this->reflection->getParameters();
|
return $this->reflection->getParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getReturnType()
|
public function getReturnType()
|
||||||
{
|
{
|
||||||
return $this->reflection->getReturnType();
|
return $this->reflection->getReturnType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getShortName()
|
public function getShortName()
|
||||||
{
|
{
|
||||||
return $this->reflection->getShortName();
|
return $this->reflection->getShortName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getStartLine()
|
public function getStartLine()
|
||||||
{
|
{
|
||||||
return $this->reflection->getStartLine();
|
return $this->reflection->getStartLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function getStaticVariables()
|
public function getStaticVariables()
|
||||||
{
|
{
|
||||||
return $this->reflection->getStaticVariables();
|
return $this->reflection->getStaticVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function hasReturnType()
|
public function hasReturnType()
|
||||||
{
|
{
|
||||||
return $this->reflection->hasReturnType();
|
return $this->reflection->hasReturnType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function returnsReference()
|
public function returnsReference()
|
||||||
{
|
{
|
||||||
return $this->reflection->returnsReference();
|
return $this->reflection->returnsReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function isGenerator()
|
public function isGenerator()
|
||||||
{
|
{
|
||||||
return $this->reflection->isGenerator();
|
return $this->reflection->isGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
|
|
||||||
public function isVariadic()
|
public function isVariadic()
|
||||||
{
|
{
|
||||||
return $this->reflection->isVariadic();
|
return $this->reflection->isVariadic();
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class CurriedFunction extends PartiallyAppliedFunction
|
|||||||
* @param int|null $threshold
|
* @param int|null $threshold
|
||||||
* @param array $args
|
* @param array $args
|
||||||
*/
|
*/
|
||||||
public function __construct(callable $callable, int $threshold = null, ...$args)
|
public function __construct(callable $callable, ?int $threshold = null, ...$args)
|
||||||
{
|
{
|
||||||
parent::__construct($callable, ...$args);
|
parent::__construct($callable, ...$args);
|
||||||
$this->threshold = $threshold ?: reflect($callable)->getNumberOfRequiredParameters();
|
$this->threshold = $threshold ?: reflect($callable)->getNumberOfRequiredParameters();
|
||||||
@ -36,7 +36,7 @@ class CurriedFunction extends PartiallyAppliedFunction
|
|||||||
return $this->threshold;
|
return $this->threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function withThreshold(int $threshold = null)
|
public function withThreshold(?int $threshold = null)
|
||||||
{
|
{
|
||||||
return new static($this, $threshold);
|
return new static($this, $threshold);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ function apply(callable $callable, ...$args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function curry(callable $callable, int $threshold = null, ...$args): CurriedFunction
|
function curry(callable $callable, ?int $threshold = null, ...$args): CurriedFunction
|
||||||
{
|
{
|
||||||
return new CurriedFunction($callable, $threshold, ...$args);
|
return new CurriedFunction($callable, $threshold, ...$args);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user