diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Interceptor.txt b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Interceptor.txt index 896083ab4b720..fe9b4dad7022e 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Interceptor.txt +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Interceptor.txt @@ -54,13 +54,39 @@ class Interceptor extends \Magento\Framework\Interception\Code\Generator\Sample /** * {@inheritdoc} */ - public function variadic(... $values) + public function firstVariadicParameter(... $variadicValue) { - $pluginInfo = $this->pluginList->getNext($this->subjectType, 'variadic'); + $pluginInfo = $this->pluginList->getNext($this->subjectType, 'firstVariadicParameter'); if (!$pluginInfo) { - return parent::variadic(... $values); + return parent::firstVariadicParameter(... $variadicValue); } else { - return $this->___callPlugins('variadic', func_get_args(), $pluginInfo); + return $this->___callPlugins('firstVariadicParameter', func_get_args(), $pluginInfo); + } + } + + /** + * {@inheritdoc} + */ + public function secondVariadicParameter($value, ... $variadicValue) + { + $pluginInfo = $this->pluginList->getNext($this->subjectType, 'secondVariadicParameter'); + if (!$pluginInfo) { + return parent::secondVariadicParameter($value, ... $variadicValue); + } else { + return $this->___callPlugins('secondVariadicParameter', func_get_args(), $pluginInfo); + } + } + + /** + * {@inheritdoc} + */ + public function byRefVariadic(&... $variadicValue) + { + $pluginInfo = $this->pluginList->getNext($this->subjectType, 'byRefVariadic'); + if (!$pluginInfo) { + return parent::byRefVariadic(... $variadicValue); + } else { + return $this->___callPlugins('byRefVariadic', func_get_args(), $pluginInfo); } } } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Sample.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Sample.php index dd0b4dc1ada17..a862228c07dfd 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Sample.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/Sample.php @@ -8,6 +8,7 @@ class Sample { private $attribute; + private $variadicAttribute; public function getValue() { @@ -23,8 +24,19 @@ public function & getReference() { } - public function variadic(... $values) + public function firstVariadicParameter(...$variadicValue) { - $this->attribute = array_shift($values); + $this->variadicAttribute = $variadicValue; + } + + public function secondVariadicParameter($value, ...$variadicValue) + { + $this->attribute = $value; + $this->variadicAttribute = $variadicValue; + } + + public function byRefVariadic(& ...$variadicValue) + { + $this->variadicAttribute = $variadicValue; } } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt index b8cf751150536..86e3a95f48a6a 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TInterceptor.txt @@ -37,4 +37,43 @@ class Interceptor extends \Magento\Framework\Interception\Code\Generator\TSample return $this->___callPlugins('setValue', func_get_args(), $pluginInfo); } } + + /** + * {@inheritdoc} + */ + public function typeHintedFirstVariadicParameter(string ... $variadicValue) + { + $pluginInfo = $this->pluginList->getNext($this->subjectType, 'typeHintedFirstVariadicParameter'); + if (!$pluginInfo) { + return parent::typeHintedFirstVariadicParameter(... $variadicValue); + } else { + return $this->___callPlugins('typeHintedFirstVariadicParameter', func_get_args(), $pluginInfo); + } + } + + /** + * {@inheritdoc} + */ + public function typeHintedSecondVariadicParameter(string $value, string ... $variadicValue) + { + $pluginInfo = $this->pluginList->getNext($this->subjectType, 'typeHintedSecondVariadicParameter'); + if (!$pluginInfo) { + return parent::typeHintedSecondVariadicParameter($value, ... $variadicValue); + } else { + return $this->___callPlugins('typeHintedSecondVariadicParameter', func_get_args(), $pluginInfo); + } + } + + /** + * {@inheritdoc} + */ + public function byRefTypeHintedVariadic(string &... $variadicValue) + { + $pluginInfo = $this->pluginList->getNext($this->subjectType, 'byRefTypeHintedVariadic'); + if (!$pluginInfo) { + return parent::byRefTypeHintedVariadic(... $variadicValue); + } else { + return $this->___callPlugins('byRefTypeHintedVariadic', func_get_args(), $pluginInfo); + } + } } diff --git a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php index f751424e59103..df8e8570fdfb5 100644 --- a/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php +++ b/lib/internal/Magento/Framework/Interception/Test/Unit/Code/Generator/_files/TSample.php @@ -8,6 +8,7 @@ class TSample { private $value; + private $variadicValue; public function getValue() : string { @@ -18,4 +19,20 @@ public function setValue(string $value) { $this->value = $value; } + + public function typeHintedFirstVariadicParameter(string ...$variadicValue) + { + $this->variadicValue = $variadicValue; + } + + public function typeHintedSecondVariadicParameter(string $value, string ...$variadicValue) + { + $this->value = $value; + $this->variadicValue = $variadicValue; + } + + public function byRefTypeHintedVariadic(string & ...$variadicValue) + { + $this->variadicValue = $variadicValue; + } }