<?php /** * PHPCompatibility, an external standard for PHP_CodeSniffer. * * @package PHPCompatibility * @copyright 2012-2019 PHPCompatibility Contributors * @license https://opensource.org/licenses/LGPL-3.0 LGPL3 * @link https://github.com/PHPCompatibility/PHPCompatibility */ namespace PHPCompatibility; use PHP_CodeSniffer_File as File; /** * Complex Version Interface. * * Interface to be implemented by sniffs using a multi-dimensional array of * PHP features (functions, classes etc) being sniffed for with version * information in sub-arrays. * * @since 7.1.0 */ interface ComplexVersionInterface { /** * Handle the retrieval of relevant information and - if necessary - throwing of an * error/warning for an item. * * @since 7.1.0 * * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. * @param int $stackPtr The position of the relevant token in * the stack. * @param array $itemInfo Base information about the item. * * @return void */ public function handleFeature(File $phpcsFile, $stackPtr, array $itemInfo); /** * Get the relevant sub-array for a specific item from a multi-dimensional array. * * @since 7.1.0 * * @param array $itemInfo Base information about the item. * * @return array Version and other information about the item. */ public function getItemArray(array $itemInfo); /** * Retrieve the relevant detail (version) information for use in an error message. * * @since 7.1.0 * * @param array $itemArray Version and other information about the item. * @param array $itemInfo Base information about the item. * * @return array */ public function getErrorInfo(array $itemArray, array $itemInfo); /** * Generates the error or warning for this item. * * @since 7.1.0 * * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. * @param int $stackPtr The position of the relevant token in * the stack. * @param array $itemInfo Base information about the item. * @param array $errorInfo Array with detail (version) information * relevant to the item. * * @return void */ public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo); }