diff --git a/src/ArrayObject.php b/src/ArrayObject.php index 589a5693..24b823b9 100644 --- a/src/ArrayObject.php +++ b/src/ArrayObject.php @@ -18,7 +18,7 @@ use function asort; use function class_exists; use function count; -use function get_class; +use function get_debug_type; use function get_object_vars; use function gettype; use function in_array; @@ -31,7 +31,7 @@ use function natsort; use function serialize; use function sprintf; -use function strpos; +use function str_starts_with; use function uasort; use function uksort; use function unserialize; @@ -85,10 +85,9 @@ public function __construct($input = [], $flags = self::STD_PROP_LIST, $iterator /** * Returns whether the requested key exists * - * @param mixed $key * @return bool */ - public function __isset($key) + public function __isset(mixed $key) { if ($this->flag === self::ARRAY_AS_PROPS) { return $this->offsetExists($key); @@ -104,11 +103,9 @@ public function __isset($key) /** * Sets the value at the specified key to value * - * @param mixed $key - * @param mixed $value * @return void */ - public function __set($key, $value) + public function __set(mixed $key, mixed $value) { if ($this->flag === self::ARRAY_AS_PROPS) { $this->offsetSet($key, $value); @@ -125,10 +122,9 @@ public function __set($key, $value) /** * Unsets the value at the specified key * - * @param mixed $key * @return void */ - public function __unset($key) + public function __unset(mixed $key) { if ($this->flag === self::ARRAY_AS_PROPS) { $this->offsetUnset($key); @@ -145,10 +141,9 @@ public function __unset($key) /** * Returns the value at the specified key by reference * - * @param mixed $key * @return mixed */ - public function &__get($key) + public function &__get(mixed $key) { if ($this->flag === self::ARRAY_AS_PROPS) { $ret = &$this->offsetGet($key); @@ -166,10 +161,9 @@ public function &__get($key) /** * Appends the value * - * @param mixed $value * @return void */ - public function append($value) + public function append(mixed $value) { $this->storage[] = $value; } @@ -299,11 +293,10 @@ public function natsort() /** * Returns whether the requested key exists * - * @param mixed $key * @return bool */ #[ReturnTypeWillChange] - public function offsetExists($key) + public function offsetExists(mixed $key) { return isset($this->storage[$key]); } @@ -311,11 +304,10 @@ public function offsetExists($key) /** * Returns the value at the specified key * - * @param mixed $key * @return mixed */ #[ReturnTypeWillChange] - public function &offsetGet($key) + public function &offsetGet(mixed $key) { $ret = null; if (! $this->offsetExists($key)) { @@ -329,12 +321,10 @@ public function &offsetGet($key) /** * Sets the value at the specified key to value * - * @param mixed $key - * @param mixed $value * @return void */ #[ReturnTypeWillChange] - public function offsetSet($key, $value) + public function offsetSet(mixed $key, mixed $value) { $this->storage[$key] = $value; } @@ -342,11 +332,10 @@ public function offsetSet($key, $value) /** * Unsets the value at the specified key * - * @param mixed $key * @return void */ #[ReturnTypeWillChange] - public function offsetUnset($key) + public function offsetUnset(mixed $key) { if ($this->offsetExists($key)) { unset($this->storage[$key]); @@ -398,7 +387,7 @@ public function setIteratorClass($class) return; } - if (strpos($class, '\\') === 0) { + if (str_starts_with($class, '\\')) { $class = '\\' . $class; if (class_exists($class)) { $this->iteratorClass = $class; @@ -488,9 +477,7 @@ public function __unserialize($data) throw new UnexpectedValueException(sprintf( 'Cannot deserialize %s instance: invalid iteratorClass; expected string, received %s', self::class, - is_object($data['iteratorClass']) - ? get_class($data['iteratorClass']) - : gettype($data['iteratorClass']) + get_debug_type($data['iteratorClass']) )); } $this->setIteratorClass($data['iteratorClass']); diff --git a/src/ArraySerializableInterface.php b/src/ArraySerializableInterface.php index f2544535..adb5231f 100644 --- a/src/ArraySerializableInterface.php +++ b/src/ArraySerializableInterface.php @@ -9,7 +9,6 @@ interface ArraySerializableInterface /** * Exchange internal values from provided array * - * @param array $array * @return void */ public function exchangeArray(array $array); diff --git a/src/ArrayUtils.php b/src/ArrayUtils.php index 285e644d..75ddd529 100644 --- a/src/ArrayUtils.php +++ b/src/ArrayUtils.php @@ -46,11 +46,10 @@ abstract class ArrayUtils /** * Test whether an array contains one or more string keys * - * @param mixed $value * @param bool $allowEmpty Should an empty array() return true * @return bool */ - public static function hasStringKeys($value, $allowEmpty = false) + public static function hasStringKeys(mixed $value, $allowEmpty = false) { if (! is_array($value)) { return false; @@ -66,11 +65,10 @@ public static function hasStringKeys($value, $allowEmpty = false) /** * Test whether an array contains one or more integer keys * - * @param mixed $value * @param bool $allowEmpty Should an empty array() return true * @return bool */ - public static function hasIntegerKeys($value, $allowEmpty = false) + public static function hasIntegerKeys(mixed $value, $allowEmpty = false) { if (! is_array($value)) { return false; @@ -93,11 +91,10 @@ public static function hasIntegerKeys($value, $allowEmpty = false) * - a float: 2.2120, -78.150999 * - a string with float: '4000.99999', '-10.10' * - * @param mixed $value * @param bool $allowEmpty Should an empty array() return true * @return bool */ - public static function hasNumericKeys($value, $allowEmpty = false) + public static function hasNumericKeys(mixed $value, $allowEmpty = false) { if (! is_array($value)) { return false; @@ -126,11 +123,10 @@ public static function hasNumericKeys($value, $allowEmpty = false) * ); * * - * @param mixed $value * @param bool $allowEmpty Is an empty list a valid list? * @return bool */ - public static function isList($value, $allowEmpty = false) + public static function isList(mixed $value, $allowEmpty = false) { if (! is_array($value)) { return false; @@ -168,11 +164,10 @@ public static function isList($value, $allowEmpty = false) * ); * * - * @param mixed $value * @param bool $allowEmpty Is an empty array() a valid hash table? * @return bool */ - public static function isHashTable($value, $allowEmpty = false) + public static function isHashTable(mixed $value, $allowEmpty = false) { if (! is_array($value)) { return false; @@ -193,12 +188,11 @@ public static function isHashTable($value, $allowEmpty = false) * non-strict check is implemented. if $strict = -1, the default in_array * non-strict behaviour is used. * - * @param mixed $needle * @param array $haystack * @param int|bool $strict * @return bool */ - public static function inArray($needle, array $haystack, $strict = false) + public static function inArray(mixed $needle, array $haystack, $strict = false) { if (! $strict) { if (is_int($needle) || is_float($needle)) { @@ -318,7 +312,6 @@ public static function merge(array $a, array $b, $preserveNumericKeys = false) /** * @deprecated Since 3.2.0; use the native array_filter methods * - * @param array $data * @param callable $callback * @param null|int $flag * @return array diff --git a/src/ArrayUtils/MergeReplaceKey.php b/src/ArrayUtils/MergeReplaceKey.php index 6092747d..063e0681 100644 --- a/src/ArrayUtils/MergeReplaceKey.php +++ b/src/ArrayUtils/MergeReplaceKey.php @@ -6,15 +6,8 @@ final class MergeReplaceKey implements MergeReplaceKeyInterface { - /** @var mixed */ - protected $data; - - /** - * @param mixed $data - */ - public function __construct($data) + public function __construct(protected mixed $data) { - $this->data = $data; } /** diff --git a/src/FastPriorityQueue.php b/src/FastPriorityQueue.php index 4c9300eb..ac083c46 100644 --- a/src/FastPriorityQueue.php +++ b/src/FastPriorityQueue.php @@ -112,11 +112,10 @@ public function __unserialize(array $data): void /** * Insert an element in the queue with a specified priority * - * @param mixed $value * @param int $priority * @return void */ - public function insert($value, $priority) + public function insert(mixed $value, $priority) { if (! is_int($priority)) { throw new Exception\InvalidArgumentException('The priority must be an integer'); @@ -155,10 +154,9 @@ public function extract() * the same item has been added multiple times, it will not remove other * instances. * - * @param mixed $datum * @return bool False if the item was not found, true otherwise. */ - public function remove($datum) + public function remove(mixed $datum) { $currentIndex = $this->index; $currentSubIndex = $this->subIndex; @@ -356,15 +354,10 @@ public function unserialize($data) */ public function setExtractFlags($flag) { - switch ($flag) { - case self::EXTR_DATA: - case self::EXTR_PRIORITY: - case self::EXTR_BOTH: - $this->extractFlag = $flag; - break; - default: - throw new Exception\InvalidArgumentException("The extract flag specified is not valid"); - } + $this->extractFlag = match ($flag) { + self::EXTR_DATA, self::EXTR_PRIORITY, self::EXTR_BOTH => $flag, + default => throw new Exception\InvalidArgumentException("The extract flag specified is not valid"), + }; } /** @@ -380,10 +373,9 @@ public function isEmpty() /** * Does the queue contain the given datum? * - * @param mixed $datum * @return bool */ - public function contains($datum) + public function contains(mixed $datum) { foreach ($this->values as $values) { if (in_array($datum, $values)) { diff --git a/src/Guard/ArrayOrTraversableGuardTrait.php b/src/Guard/ArrayOrTraversableGuardTrait.php index 392a88d3..692e9a7b 100644 --- a/src/Guard/ArrayOrTraversableGuardTrait.php +++ b/src/Guard/ArrayOrTraversableGuardTrait.php @@ -8,10 +8,8 @@ use Laminas\Stdlib\Exception\InvalidArgumentException; use Traversable; -use function get_class; -use function gettype; +use function get_debug_type; use function is_array; -use function is_object; use function sprintf; /** @@ -29,7 +27,7 @@ trait ArrayOrTraversableGuardTrait * @throws Exception */ protected function guardForArrayOrTraversable( - $data, + mixed $data, $dataName = 'Argument', $exceptionClass = InvalidArgumentException::class ) { @@ -37,7 +35,7 @@ protected function guardForArrayOrTraversable( $message = sprintf( "%s must be an array or Traversable, [%s] given", $dataName, - is_object($data) ? get_class($data) : gettype($data) + get_debug_type($data) ); throw new $exceptionClass($message); } diff --git a/src/Guard/EmptyGuardTrait.php b/src/Guard/EmptyGuardTrait.php index bffaa38a..e8d35cc1 100644 --- a/src/Guard/EmptyGuardTrait.php +++ b/src/Guard/EmptyGuardTrait.php @@ -24,7 +24,7 @@ trait EmptyGuardTrait * @throws Exception */ protected function guardAgainstEmpty( - $data, + mixed $data, $dataName = 'Argument', $exceptionClass = InvalidArgumentException::class ) { diff --git a/src/Guard/NullGuardTrait.php b/src/Guard/NullGuardTrait.php index 32ef3400..763c36b3 100644 --- a/src/Guard/NullGuardTrait.php +++ b/src/Guard/NullGuardTrait.php @@ -24,7 +24,7 @@ trait NullGuardTrait * @throws Exception */ protected function guardAgainstNull( - $data, + mixed $data, $dataName = 'Argument', $exceptionClass = InvalidArgumentException::class ) { diff --git a/src/Message.php b/src/Message.php index d4f16140..fad6e4b7 100644 --- a/src/Message.php +++ b/src/Message.php @@ -7,10 +7,8 @@ use Traversable; use function array_key_exists; -use function get_class; -use function gettype; +use function get_debug_type; use function is_array; -use function is_object; use function is_scalar; use function sprintf; @@ -42,7 +40,7 @@ public function setMetadata($spec, $value = null) if (! is_array($spec) && ! $spec instanceof Traversable) { throw new Exception\InvalidArgumentException(sprintf( 'Expected a string, array, or Traversable argument in first position; received "%s"', - is_object($spec) ? get_class($spec) : gettype($spec) + get_debug_type($spec) )); } foreach ($spec as $key => $value) { diff --git a/src/ParameterObjectInterface.php b/src/ParameterObjectInterface.php index 60f531a6..b091c107 100644 --- a/src/ParameterObjectInterface.php +++ b/src/ParameterObjectInterface.php @@ -8,10 +8,9 @@ interface ParameterObjectInterface { /** * @param string $key - * @param mixed $value * @return void */ - public function __set($key, $value); + public function __set($key, mixed $value); /** * @param string $key diff --git a/src/PriorityList.php b/src/PriorityList.php index f4ecf9c9..8c50db25 100644 --- a/src/PriorityList.php +++ b/src/PriorityList.php @@ -65,11 +65,10 @@ class PriorityList implements Iterator, Countable * Insert a new item. * * @param string $name - * @param mixed $value * @param int $priority * @return void */ - public function insert($name, $value, $priority = 0) + public function insert($name, mixed $value, $priority = 0) { if (! isset($this->items[$name])) { $this->count++; @@ -162,7 +161,6 @@ protected function sort() * Compare the priority of two items. * * @param array $item1, - * @param array $item2 * @return int */ protected function compare(array $item1, array $item2) diff --git a/src/PriorityQueue.php b/src/PriorityQueue.php index 3b67dc6e..caec4848 100644 --- a/src/PriorityQueue.php +++ b/src/PriorityQueue.php @@ -12,7 +12,6 @@ use function array_map; use function count; -use function get_class; use function is_array; use function serialize; use function sprintf; @@ -96,10 +95,9 @@ public function insert($data, $priority = 1) * the same item has been added multiple times, it will not remove other * instances. * - * @param mixed $datum * @return bool False if the item was not found, true otherwise. */ - public function remove($datum) + public function remove(mixed $datum) { $found = false; $key = null; @@ -286,15 +284,11 @@ public function __unserialize($data) */ public function toArray($flag = self::EXTR_DATA) { - switch ($flag) { - case self::EXTR_BOTH: - return $this->items; - case self::EXTR_PRIORITY: - return array_map(static fn($item) => $item['priority'], $this->items); - case self::EXTR_DATA: - default: - return array_map(static fn($item) => $item['data'], $this->items); - } + return match ($flag) { + self::EXTR_BOTH => $this->items, + self::EXTR_PRIORITY => array_map(static fn($item): int => $item['priority'], $this->items), + default => array_map(static fn($item): mixed => $item['data'], $this->items), + }; } /** @@ -363,7 +357,7 @@ protected function getQueue() if (! $this->queue instanceof \SplPriorityQueue) { throw new Exception\DomainException(sprintf( 'PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"', - get_class($this->queue) + $this->queue::class )); } } diff --git a/src/SplPriorityQueue.php b/src/SplPriorityQueue.php index c4d12978..82abcbb8 100644 --- a/src/SplPriorityQueue.php +++ b/src/SplPriorityQueue.php @@ -8,10 +8,8 @@ use UnexpectedValueException; use function array_key_exists; -use function get_class; -use function gettype; +use function get_debug_type; use function is_array; -use function is_object; use function serialize; use function sprintf; use function unserialize; @@ -129,7 +127,7 @@ public function __unserialize($data) throw new UnexpectedValueException(sprintf( 'Cannot deserialize %s instance: corrupt item; expected array, received %s', self::class, - is_object($item) ? get_class($item) : gettype($item) + get_debug_type($item) )); } diff --git a/test/ArrayUtilsTest.php b/test/ArrayUtilsTest.php index c1626763..caba777c 100644 --- a/test/ArrayUtilsTest.php +++ b/test/ArrayUtilsTest.php @@ -429,9 +429,8 @@ public function testValidArraysWithNumericKeys(array $test): void /** * @dataProvider invalidArrays - * @param mixed $test */ - public function testInvalidArraysAlwaysReturnFalse($test): void + public function testInvalidArraysAlwaysReturnFalse(mixed $test): void { self::assertFalse(ArrayUtils::hasStringKeys($test, false)); self::assertFalse(ArrayUtils::hasIntegerKeys($test, false)); @@ -507,9 +506,8 @@ public function testValidIteratorsReturnArrayRepresentation(iterable $test, arra /** * @dataProvider invalidIterators - * @param mixed $test */ - public function testInvalidIteratorsRaiseInvalidArgumentException($test): void + public function testInvalidIteratorsRaiseInvalidArgumentException(mixed $test): void { $this->expectException(InvalidArgumentException::class); self::assertFalse(ArrayUtils::iteratorToArray($test)); diff --git a/test/ConsoleHelperTest.php b/test/ConsoleHelperTest.php index 68a33417..1ec3847b 100644 --- a/test/ConsoleHelperTest.php +++ b/test/ConsoleHelperTest.php @@ -43,8 +43,7 @@ public function overrideEolSequence(string $newSequence): void $r->setValue($this->helper, $newSequence); } - /** @param mixed $stderr */ - public function overrideStderrResource($stderr): void + public function overrideStderrResource(mixed $stderr): void { $r = new ReflectionProperty($this->helper, 'stderr'); $r->setAccessible(true); diff --git a/test/CustomArrayObject.php b/test/CustomArrayObject.php index 5e85bc37..dba3b4bc 100644 --- a/test/CustomArrayObject.php +++ b/test/CustomArrayObject.php @@ -8,7 +8,7 @@ final class CustomArrayObject extends ArrayObject { - protected bool $isImmutable = true; + private bool $isImmutable = true; public function isImmutable(): bool { diff --git a/test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php b/test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php index 72423c3f..b2ddb94a 100644 --- a/test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php +++ b/test/StaticAnalysis/PriorityQueueGenericsCanBeUnderstood.php @@ -11,16 +11,11 @@ final class PriorityQueueGenericsCanBeUnderstood { - /** @var PriorityQueue */ - private PriorityQueue $laminas; - /** * @param PriorityQueue $laminas */ - public function __construct( - PriorityQueue $laminas - ) { - $this->laminas = $laminas; + public function __construct(private PriorityQueue $laminas) + { } /** @return list */ diff --git a/test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php b/test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php index 303e9a20..58539ccd 100644 --- a/test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php +++ b/test/StaticAnalysis/SplPriorityQueueGenericsCanBeUnderstood.php @@ -11,16 +11,11 @@ final class SplPriorityQueueGenericsCanBeUnderstood { - /** @var SplPriorityQueue */ - private SplPriorityQueue $laminas; - /** * @param SplPriorityQueue $laminas */ - public function __construct( - SplPriorityQueue $laminas - ) { - $this->laminas = $laminas; + public function __construct(private SplPriorityQueue $laminas) + { } /** @return list */ diff --git a/test/StringUtilsTest.php b/test/StringUtilsTest.php index 2fbfcfeb..fd72a24b 100644 --- a/test/StringUtilsTest.php +++ b/test/StringUtilsTest.php @@ -16,7 +16,6 @@ use function defined; use function extension_loaded; -use function get_class; use function preg_match; class StringUtilsTest extends TestCase @@ -101,7 +100,7 @@ public function testGetWrapper(): void } elseif (extension_loaded('iconv')) { self::assertInstanceOf(Iconv::class, $wrapper); } - } catch (Exception $e) { + } catch (Exception) { if ( extension_loaded('intl') || extension_loaded('mbstring') @@ -118,7 +117,7 @@ public function testGetWrapper(): void } elseif (extension_loaded('iconv')) { self::assertInstanceOf(Iconv::class, $wrapper); } - } catch (Exception $e) { + } catch (Exception) { if (extension_loaded('mbstring') || extension_loaded('iconv')) { $this->fail("Failed to get mbstring or iconv wrapper for UTF-8 and ISO-8859-1"); } @@ -156,10 +155,9 @@ public function getUtf8StringValidity(): array /** * @dataProvider getUtf8StringValidity - * @param mixed $str * @param bool $valid */ - public function testIsValidUtf8($str, $valid): void + public function testIsValidUtf8(mixed $str, $valid): void { self::assertSame($valid, StringUtils::isValidUtf8($str)); } @@ -178,9 +176,9 @@ public function testRegisterSpecificWrapper(): void $wrapper = $this->createMock(StringWrapperInterface::class); StringUtils::resetRegisteredWrappers(); - StringUtils::registerWrapper(get_class($wrapper)); + StringUtils::registerWrapper($wrapper::class); - $this->assertContains(get_class($wrapper), StringUtils::getRegisteredWrappers()); + $this->assertContains($wrapper::class, StringUtils::getRegisteredWrappers()); } public function testUnregisterSpecificWrapper(): void diff --git a/test/StringWrapper/CommonStringWrapperTest.php b/test/StringWrapper/CommonStringWrapperTest.php index 56e19a9c..f95b072c 100644 --- a/test/StringWrapper/CommonStringWrapperTest.php +++ b/test/StringWrapper/CommonStringWrapperTest.php @@ -141,9 +141,8 @@ public function convertProvider(): array * @param string $str * @param string $encoding * @param string $convertEncoding - * @param mixed $expected */ - public function testConvert($encoding, $convertEncoding, $str, $expected): void + public function testConvert($encoding, $convertEncoding, $str, mixed $expected): void { $wrapper = $this->getWrapper($encoding, $convertEncoding); if (! $wrapper) { @@ -221,9 +220,8 @@ public function wordWrapProvider(): array * @param int $width * @param string $break * @param bool $cut - * @param mixed $expected */ - public function testWordWrap($encoding, $string, $width, $break, $cut, $expected): void + public function testWordWrap($encoding, $string, $width, $break, $cut, mixed $expected): void { $wrapper = $this->getWrapper($encoding); if (! $wrapper) { @@ -284,10 +282,9 @@ public function strPadProvider(): array * @param int $padLength * @param string $padString * @param int $padType - * @param mixed $expected * @group Laminas-12186 */ - public function testStrPad($encoding, $input, $padLength, $padString, $padType, $expected): void + public function testStrPad($encoding, $input, $padLength, $padString, $padType, mixed $expected): void { $wrapper = $this->getWrapper($encoding); if (! $wrapper) { diff --git a/test/StringWrapper/IconvTest.php b/test/StringWrapper/IconvTest.php index 5441c022..92fbc9fa 100644 --- a/test/StringWrapper/IconvTest.php +++ b/test/StringWrapper/IconvTest.php @@ -23,7 +23,7 @@ protected function setUp(): void try { new Iconv('utf-8'); $this->fail('Missing expected Laminas\Stdlib\Exception\ExtensionNotLoadedException'); - } catch (Exception\ExtensionNotLoadedException $e) { + } catch (Exception\ExtensionNotLoadedException) { $this->markTestSkipped('Missing ext/iconv'); } } diff --git a/test/StringWrapper/IntlTest.php b/test/StringWrapper/IntlTest.php index 8ceee991..293e71b1 100644 --- a/test/StringWrapper/IntlTest.php +++ b/test/StringWrapper/IntlTest.php @@ -18,7 +18,7 @@ protected function setUp(): void try { new Intl('utf-8'); $this->fail('Missing expected Laminas\Stdlib\Exception\ExtensionNotLoadedException'); - } catch (Exception\ExtensionNotLoadedException $e) { + } catch (Exception\ExtensionNotLoadedException) { $this->markTestSkipped('Missing ext/intl'); } } diff --git a/test/StringWrapper/MbStringTest.php b/test/StringWrapper/MbStringTest.php index c5edfc44..ea05bed0 100644 --- a/test/StringWrapper/MbStringTest.php +++ b/test/StringWrapper/MbStringTest.php @@ -18,7 +18,7 @@ protected function setUp(): void try { new MbString('utf-8'); $this->fail('Missing expected Laminas\Stdlib\Exception\ExtensionNotLoadedException'); - } catch (Exception\ExtensionNotLoadedException $e) { + } catch (Exception\ExtensionNotLoadedException) { $this->markTestSkipped('Missing ext/mbstring'); } } diff --git a/test/TestAsset/GuardedObject.php b/test/TestAsset/GuardedObject.php index 0e579628..00c76836 100644 --- a/test/TestAsset/GuardedObject.php +++ b/test/TestAsset/GuardedObject.php @@ -10,26 +10,17 @@ class GuardedObject { use AllGuardsTrait; - /** - * @param mixed $value - */ - public function setArrayOrTraversable($value): void + public function setArrayOrTraversable(mixed $value): void { $this->guardForArrayOrTraversable($value); } - /** - * @param mixed $value - */ - public function setNotEmpty($value): void + public function setNotEmpty(mixed $value): void { $this->guardAgainstEmpty($value); } - /** - * @param mixed $value - */ - public function setNotNull($value): void + public function setNotNull(mixed $value): void { $this->guardAgainstNull($value); } diff --git a/test/TestAsset/IteratorWithToArrayMethod.php b/test/TestAsset/IteratorWithToArrayMethod.php index 66ef662c..d4cef27e 100644 --- a/test/TestAsset/IteratorWithToArrayMethod.php +++ b/test/TestAsset/IteratorWithToArrayMethod.php @@ -14,11 +14,8 @@ class IteratorWithToArrayMethod implements Iterator { - private array $elements = []; - - public function __construct(array $elements) + public function __construct(private array $elements) { - $this->elements = $elements; } /** @return void */ diff --git a/test/TestAsset/TestOptions.php b/test/TestAsset/TestOptions.php index bf544006..660a64d7 100644 --- a/test/TestAsset/TestOptions.php +++ b/test/TestAsset/TestOptions.php @@ -23,10 +23,7 @@ class TestOptions extends AbstractOptions /** @var mixed */ protected $parentPublic; - /** - * @param mixed $value - */ - public function setTestField($value): void + public function setTestField(mixed $value): void { $this->testField = $value; } @@ -39,10 +36,8 @@ public function getTestField() /** * Needed to test accessibility of getters / setters within deriving classes - * - * @param mixed $parentPrivate */ - private function setParentPrivate($parentPrivate): void + private function setParentPrivate(mixed $parentPrivate): void { $this->parentPrivate = $parentPrivate; } @@ -59,10 +54,8 @@ private function getParentPrivate() /** * Needed to test accessibility of getters / setters within deriving classes - * - * @param mixed $parentProtected */ - protected function setParentProtected($parentProtected): void + protected function setParentProtected(mixed $parentProtected): void { $this->parentProtected = $parentProtected; } @@ -79,10 +72,8 @@ protected function getParentProtected() /** * Needed to test accessibility of getters / setters within deriving classes - * - * @param mixed $parentPublic */ - public function setParentPublic($parentPublic): void + public function setParentPublic(mixed $parentPublic): void { $this->parentPublic = $parentPublic; } diff --git a/test/TestAsset/TestOptionsDerived.php b/test/TestAsset/TestOptionsDerived.php index 07cf1631..54215d22 100644 --- a/test/TestAsset/TestOptionsDerived.php +++ b/test/TestAsset/TestOptionsDerived.php @@ -20,10 +20,8 @@ class TestOptionsDerived extends TestOptions /** * Needed to test accessibility of getters / setters within deriving classes - * - * @param mixed $derivedPrivate */ - private function setDerivedPrivate($derivedPrivate): void + private function setDerivedPrivate(mixed $derivedPrivate): void { $this->derivedPrivate = $derivedPrivate; } @@ -40,10 +38,8 @@ private function getDerivedPrivate() /** * Needed to test accessibility of getters / setters within deriving classes - * - * @param mixed $derivedProtected */ - protected function setDerivedProtected($derivedProtected): void + protected function setDerivedProtected(mixed $derivedProtected): void { $this->derivedProtected = $derivedProtected; } @@ -60,10 +56,8 @@ protected function getDerivedProtected() /** * Needed to test accessibility of getters / setters within deriving classes - * - * @param mixed $derivedPublic */ - public function setDerivedPublic($derivedPublic): void + public function setDerivedPublic(mixed $derivedPublic): void { $this->derivedPublic = $derivedPublic; } diff --git a/test/TestAsset/TestOptionsNoStrict.php b/test/TestAsset/TestOptionsNoStrict.php index 131d2dee..039d1095 100644 --- a/test/TestAsset/TestOptionsNoStrict.php +++ b/test/TestAsset/TestOptionsNoStrict.php @@ -21,10 +21,7 @@ class TestOptionsNoStrict extends AbstractOptions /** @var mixed */ protected $testField; - /** - * @param mixed $value - */ - public function setTestField($value): void + public function setTestField(mixed $value): void { $this->testField = $value; } diff --git a/test/TestAsset/TestOptionsWithoutGetter.php b/test/TestAsset/TestOptionsWithoutGetter.php index 13bdda0b..e0cfd5aa 100644 --- a/test/TestAsset/TestOptionsWithoutGetter.php +++ b/test/TestAsset/TestOptionsWithoutGetter.php @@ -14,10 +14,7 @@ class TestOptionsWithoutGetter extends AbstractOptions /** @var mixed */ protected $foo; - /** - * @param mixed $value - */ - public function setFoo($value): void + public function setFoo(mixed $value): void { $this->foo = $value; }