Yoast/Sniffs/Files/FileNameSniff.php
protected function is_file_excluded( File $phpcsFile, $path_to_file ) {
		$exclude = $this->clean_custom_array_property( $this->exclude, true, true );

		if ( ! empty( $exclude ) ) {
			$exclude      = array_map( array( $this, 'normalize_directory_separators' ), $exclude );
			$path_to_file = $this->normalize_directory_separators( $path_to_file );

			if ( ! isset( $phpcsFile->config->basepath ) ) {
				$phpcsFile->addWarning(
					'For the exclude property to work with relative file path files, the --basepath needs to be set.',
					0,
					'MissingBasePath'
				);
			}
			else {
				$base_path    = $this->normalize_directory_separators( $phpcsFile->config->basepath );
				$path_to_file = Common::stripBasepath( $path_to_file, $base_path );
			}

			// Lowercase the filename to not interfere with the lowercase/dashes rule.
			$path_to_file = strtolower( ltrim( $path_to_file, '/' ) );

			if ( isset( $exclude[ $path_to_file ] ) ) {
				// Filename is on the exclude list.
				return true;
			}
		}

		return false;
	}
protected function is_file_excluded( File $phpcsFile, $path_to_file ) {
		$exclude = $this->clean_custom_array_property( $this->exclude, true, true );

		if ( ! empty( $exclude ) ) {
			$exclude      = array_map( array( $this, 'normalize_directory_separators' ), $exclude );
			$path_to_file = $this->normalize_directory_separators( $path_to_file );

			if ( ! isset( $phpcsFile->config->basepath ) ) {
				$phpcsFile->addWarning(
					'For the exclude property to work with relative file path files, the --basepath needs to be set.',
					0,
					'MissingBasePath'
				);
			}
			else {
				$base_path    = $this->normalize_directory_separators( $phpcsFile->config->basepath );
				$path_to_file = Common::stripBasepath( $path_to_file, $base_path );
			}

			// Lowercase the filename to not interfere with the lowercase/dashes rule.
			$path_to_file = strtolower( ltrim( $path_to_file, '/' ) );

			if ( isset( $exclude[ $path_to_file ] ) ) {
				// Filename is on the exclude list.
				return true;
			}
		}

		return false;
	}
protected function is_file_excluded ( File $ phpcsFile , $ path_to_file ) { $ exclude = $ this -> clean_custom_array_property ( $ this -> exclude , true , true ) ; if ( ! empty ( $ exclude ) ) { $ exclude = array_map ( array ( $ this , 'normalize_directory_separators' ) , $ exclude ) ; $ path_to_file = $ this -> normalize_directory_separators ( $ path_to_file ) ; if ( ! isset ( $ phpcsFile -> config -> basepath ) ) { $ phpcsFile -> addWarning ( 'For the exclude property to work with relative file path files, the --basepath needs to be set.' , 0 , 'MissingBasePath' ) ; } else { $ base_path = $ this -> normalize_directory_separators ( $ phpcsFile -> config -> basepath ) ; $ path_to_file = Common :: stripBasepath ( $ path_to_file , $ base_path ) ; } // Lowercase the filename to not interfere with the lowercase/dashes rule. $ path_to_file = strtolower ( ltrim ( $ path_to_file , '/' ) ) ; if ( isset ( $ exclude [ $ path_to_file ] ) ) { // Filename is on the exclude list. return true ; } } return false ; }
Check if the file is on the exclude list.

@param \PHP_CodeSniffer\Files\File $phpcsFile    The file being scanned.
@param string                      $path_to_file The full path to the file
currently being examined.

@return bool
Check if the file is on the exclude list .