'', ]; foreach ($itemArray as $version => $present) { if (\preg_match('`^\d\.\d(\.\d{1,2})?$`', $version) !== 1) { // Not a version key. continue; } if ($versionInfo['not_in_version'] === '' && $present === false) { $versionInfo['not_in_version'] = $version; } } return $versionInfo; } /** * Convenience method to retrieve the information to be passed to a call to the PHPCS native * `addError()` or `addWarning()` methods in a simple organized array. * * @param string $itemName Item name, normally name of the function or class detected. * @param string $itemBaseCode The basis for the error code. * @param string[] $versionInfo Array of version info as received from the getVersionInfo() method. * * @return array */ protected function getMessageInfo($itemName, $itemBaseCode, array $versionInfo) { return [ 'message' => $this->msgTemplate, 'errorcode' => MessageHelper::stringToErrorCode($itemBaseCode, true) . 'Found', 'data' => [ $itemName, $versionInfo['not_in_version'], ], ]; } }