Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New sniffs #359

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,44 @@ matrix:
#5.3.3 Ubuntu Precise exceptions
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.5"
env: FEDORA_VERSION="3.5" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.6.2"
env: FEDORA_VERSION="3.6.2" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.7.0"
env: FEDORA_VERSION="3.7.0" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.8.1"
env: FEDORA_VERSION="3.8.1" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
allow_failures:
# 5.3.3 can fail now.
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.5"
env: FEDORA_VERSION="3.5" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.6.2"
env: FEDORA_VERSION="3.6.2" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.7.0"
env: FEDORA_VERSION="3.7.0" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.8.1"
env: FEDORA_VERSION="3.8.1" CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
env:
- FEDORA_VERSION="3.5"
- FEDORA_VERSION="3.6.2"
- FEDORA_VERSION="3.7.0"
- FEDORA_VERSION="3.8.1"
global:
- CODESNIFFER_IGNORE="vendor,*.info,*.txt,*.md,SolrPhpClient"
matrix:
- FEDORA_VERSION="3.5"
- FEDORA_VERSION="3.6.2"
- FEDORA_VERSION="3.7.0"
- FEDORA_VERSION="3.8.1"

before_install:
- cd $HOME
Expand All @@ -55,8 +58,5 @@ before_script:
# Mysql might time out for long tests, increase the wait timeout.
- mysql -e 'SET @@GLOBAL.wait_timeout=1200'
script:
- ant -buildfile sites/all/modules/islandora_solr_search/build.xml lint
- $ISLANDORA_DIR/tests/scripts/line_endings.sh sites/all/modules/islandora_solr_search
- drush coder-review --reviews=production,security,style,i18n,potx,sniffer islandora_solr
- phpcpd --names *.module,*.inc,*.test sites/all/modules/islandora_solr_search
- php scripts/run-tests.sh --php `phpenv which php` --url http://localhost:8081 --verbose "Islandora Solr Search"
- $HOME/islandora/tests/scripts/travis_scripts.sh
- $HOME/islandora/tests/scripts/run_tests.sh "Islandora Solr Search"
6 changes: 4 additions & 2 deletions SolrPhpClient/Apache/Solr/Document.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php
// @codingStandardsIgnoreStart

// @codingStandardsIgnoreFile
// XXX: This is an included library... Should have minimal changes from
// upstream.
// phpcs:ignoreFile
// XXX: @codingStandards will be removed in PHP_CodeSniffer version 4.0
/**
* Copyright (c) 2007-2009, Conduit Internet Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -363,4 +366,3 @@ public function __unset($key)
unset($this->_fieldBoosts[$key]);
}
}
// @codingStandardsIgnoreEnd
6 changes: 4 additions & 2 deletions SolrPhpClient/Apache/Solr/Response.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php
// @codingStandardsIgnoreStart

// @codingStandardsIgnoreFile
// XXX: This is an included library... Should have minimal changes from
// upstream.
// phpcs:ignoreFile
// XXX: @codingStandards will be removed in PHP_CodeSniffer version 4.0
/**
* Copyright (c) 2007-2009, Conduit Internet Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -289,4 +292,3 @@ protected function _parseData()
$this->_parsedData = $data;
}
}
// @codingStandardsIgnoreEnd
6 changes: 4 additions & 2 deletions SolrPhpClient/Apache/Solr/Service.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php
// @codingStandardsIgnoreStart

// @codingStandardsIgnoreFile
// XXX: This is an included library... Should have minimal changes from
// upstream.
// phpcs:ignoreFile
// XXX: @codingStandards will be removed in PHP_CodeSniffer version 4.0
/**
* Copyright (c) 2007-2009, Conduit Internet Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -980,4 +983,3 @@ public function search($query, $offset = 0, $limit = 10, $params = array(), $met
}
}
}
// @codingStandardsIgnoreEnd
6 changes: 4 additions & 2 deletions SolrPhpClient/Apache/Solr/Service/Balancer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
// @codingStandardsIgnoreStart

// @codingStandardsIgnoreFile
// XXX: This is an included library... Shouldn't change.
// phpcs:ignoreFile
// XXX: @codingStandards will be removed in PHP_CodeSniffer version 4.0
/**
* Copyright (c) 2007-2009, Conduit Internet Technologies, Inc.
* All rights reserved.
Expand Down Expand Up @@ -774,4 +777,3 @@ public function search($query, $offset = 0, $limit = 10, $params = array())
return false;
}
}
// @codingStandardsIgnoreEnd
34 changes: 17 additions & 17 deletions includes/admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ function _islandora_solr_admin_index_settings_submit($form, &$form_state) {
* @return array
* The form array.
*/
function islandora_solr_admin_settings($form, &$form_state) {
function islandora_solr_admin_settings(array $form, array &$form_state) {
// Add admin form css.
drupal_set_title(t('Solr settings'));

Expand Down Expand Up @@ -826,7 +826,7 @@ function islandora_solr_admin_settings_default_confirm_form_submit(array $form,
*
* @link http://drupal.stackexchange.com/questions/14855/how-do-i-dynamically-fill-a-textfield-with-ajax/16576#16576 Stackexchange Post @endlink
*/
function islandora_solr_admin_settings_fields(&$form_state, &$terms, $field_type) {
function islandora_solr_admin_settings_fields(array &$form_state, array &$terms, $field_type) {

// Set variables.
$field_type_class = str_replace('_', '-', $field_type);
Expand Down Expand Up @@ -1125,7 +1125,7 @@ function islandora_solr_admin_breadcrumbs_settings(array $form, array &$form_sta
* @return string
* Rendered table.
*/
function theme_islandora_solr_admin_fields($variables) {
function theme_islandora_solr_admin_fields(array $variables) {
$form = $variables['form'];

$field_type = $form['#field_type'];
Expand Down Expand Up @@ -1222,7 +1222,7 @@ function theme_islandora_solr_admin_fields($variables) {
*
* @see islandora_solr_admin_settings()
*/
function theme_islandora_solr_admin_primary_display($variables) {
function theme_islandora_solr_admin_primary_display(array $variables) {
$form = $variables['form'];

$default = variable_get('islandora_solr_primary_display', 'default');
Expand Down Expand Up @@ -1288,7 +1288,7 @@ function theme_islandora_solr_admin_primary_display($variables) {
* @param array $form_state
* The form state.
*/
function _islandora_solr_admin_settings_validate($form, &$form_state) {
function _islandora_solr_admin_settings_validate(array $form, array &$form_state) {
$limits = explode(',', $form_state['values']['islandora_solr_num_of_results_advanced']);
$form_state['values']['islandora_solr_num_of_results_advanced'] = array_filter(array_map('trim', $limits), 'is_numeric');
$form_state['values']['islandora_solr_namespace_restriction'] = preg_replace('/:$/', '', $form_state['values']['islandora_solr_namespace_restriction']);
Expand All @@ -1302,7 +1302,7 @@ function _islandora_solr_admin_settings_validate($form, &$form_state) {
* @param array $form_state
* The form state.
*/
function _islandora_solr_admin_settings_submit($form, &$form_state) {
function _islandora_solr_admin_settings_submit(array $form, array &$form_state) {

// If this function is called not using submit or reset buttons.
if ($form_state['clicked_button']['#id'] != 'edit-submit' && $form_state['clicked_button']['#id'] != 'edit-reset') {
Expand Down Expand Up @@ -1478,7 +1478,7 @@ function _islandora_solr_get_handlers($solr_url) {
*
* @see islandora_solr_admin_settings()
*/
function _islandora_solr_update_solr_url($form, $form_state) {
function _islandora_solr_update_solr_url(array $form, array $form_state) {
unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state);
$form_state['rebuild'] = TRUE;
Expand All @@ -1496,7 +1496,7 @@ function _islandora_solr_update_solr_url($form, $form_state) {
*
* @see islandora_solr_admin_settings()
*/
function _islandora_solr_admin_refresh($form, &$form_state) {
function _islandora_solr_admin_refresh(array $form, array &$form_state) {
unset($form_state['submit_handlers']);
form_execute_handlers('submit', $form, $form_state);
$form_state['rebuild'] = TRUE;
Expand Down Expand Up @@ -1560,8 +1560,8 @@ function _islandora_solr_check_dismax($solr_url, $selected_handler) {
* @param string $string
* String filled out in the autocomplete textfield.
*
* @return json
* A json array containing the Solr luke values that contain the given string.
* Outputs a json array containing the Solr luke values that contain the
* given string.
*/
function _islandora_solr_autocomplete_luke($string = '') {

Expand Down Expand Up @@ -1593,7 +1593,7 @@ function _islandora_solr_autocomplete_luke($string = '') {
* @param array $form_state
* An associative array containing the form state.
*/
function _islandora_solr_update_fields_submit($form, &$form_state) {
function _islandora_solr_update_fields_submit(array $form, array &$form_state) {
$form_state['rebuild'] = TRUE;
}

Expand All @@ -1610,7 +1610,7 @@ function _islandora_solr_update_fields_submit($form, &$form_state) {
* @return array
* The part of the form array that needs asynchronous updating.
*/
function _islandora_solr_update_fields($form, &$form_state) {
function _islandora_solr_update_fields(array $form, array &$form_state) {

// Check what section the call is from.
switch ($form_state['triggering_element']['#field_type']) {
Expand Down Expand Up @@ -1642,7 +1642,7 @@ function _islandora_solr_update_fields($form, &$form_state) {
* @return array
* An array of AJAX commands.
*/
function _islandora_solr_admin_settings_field_configure($form, &$form_state) {
function _islandora_solr_admin_settings_field_configure(array $form, array &$form_state) {
$variables = $form_state['dialog'];
$field_type = $form_state['dialog']['field_type'];
$solr_field = $form_state['dialog']['solr_field'];
Expand Down Expand Up @@ -1678,7 +1678,7 @@ function _islandora_solr_admin_settings_field_configure($form, &$form_state) {
* @return array
* An array of AJAX commands.
*/
function _islandora_solr_admin_settings_dialog($form, &$form_state) {
function _islandora_solr_admin_settings_dialog(array $form, array &$form_state) {

$dialog_id = $form_state['dialog']['dialog_id'];

Expand Down Expand Up @@ -1836,7 +1836,7 @@ function _islandora_solr_admin_get_form_function($field_type = NULL) {
* An associative array containing the definition for the permissions
* fieldset.
*/
function islandora_solr_get_admin_permissions_fieldset($permissions, $permissions_default, $permissions_disable, $default_value) {
function islandora_solr_get_admin_permissions_fieldset($permissions, array $permissions_default, array $permissions_disable, $default_value) {
if (is_array($permissions)) {
$default_enable = !empty($permissions) ? TRUE : $default_value;
}
Expand Down Expand Up @@ -2018,9 +2018,9 @@ function islandora_solr_admin_settings_result_fields($form, &$form_state, $varia
* @param array $form
* An array representing the Drupal form, passed by reference.
* @param bool $default_value
* Whether the default enabled checkbox is to be TRUE or FALSE. *
* Whether the default enabled checkbox is to be TRUE or FALSE.
*/
function islandora_solr_append_permissions_and_actions($values, &$form, $default_value = TRUE) {
function islandora_solr_append_permissions_and_actions(array $values, array &$form, $default_value = TRUE) {
$permissions = isset($values['permissions']) ? $values['permissions'] : array();
$permissions_disable = _islandora_solr_permissions_disable();
$permissions_default = _islandora_solr_permissions_default();
Expand Down
21 changes: 9 additions & 12 deletions includes/blocks.inc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function islandora_solr_islandora_solr_query_blocks() {
);
}


/**
* Implements hook_block_info().
*/
Expand Down Expand Up @@ -145,7 +144,7 @@ function islandora_solr_block_save($delta = '', $edit = array()) {
* Currently checks for delta of explore and modifies the form to add custom
* configuration options to setup facet display filters to be rendered.
*/
function islandora_solr_form_BLOCK_ADMIN_CONFIGURE_alter(&$form, &$form_state) {
function islandora_solr_form_block_admin_configure_alter(&$form, &$form_state) {
if ($form['module']['#value'] == 'islandora_solr' && $form['delta']['#value'] == 'explore') {
// Get the variables for the form display facets.
$expore_config = (isset($form_state['islandora_solr_facet_filters']) ? $form_state['islandora_solr_facet_filters'] : variable_get('islandora_solr_explore_config', array()));
Expand Down Expand Up @@ -451,7 +450,7 @@ function islandora_solr_block_view($block_name = '') {
* @return array
* An associative array containing the fully built form structure.
*/
function islandora_solr_simple_search_form($form, &$form_state) {
function islandora_solr_simple_search_form(array $form, array &$form_state) {

$form['simple'] = array(
'#type' => 'container',
Expand Down Expand Up @@ -494,7 +493,7 @@ function islandora_solr_simple_search_form($form, &$form_state) {
* @param array $form_state
* An associative array containing form state.
*/
function islandora_solr_simple_search_form_submit($form, &$form_state) {
function islandora_solr_simple_search_form_submit(array $form, array &$form_state) {
module_load_include('inc', 'islandora_solr', 'includes/utilities');
$search_string = islandora_solr_replace_slashes($form_state['values']['islandora_simple_search_query']);

Expand Down Expand Up @@ -530,7 +529,7 @@ function islandora_solr_simple_search_form_submit($form, &$form_state) {
* @return array
* An associative array containing the fully built form structure.
*/
function islandora_solr_advanced_search_form($form, &$form_state) {
function islandora_solr_advanced_search_form(array $form, array &$form_state) {
global $_islandora_solr_queryclass;

// 1: Form update using AJAX.
Expand Down Expand Up @@ -723,11 +722,10 @@ function islandora_solr_advanced_search_form($form, &$form_state) {
*
* @see islandora_solr_advanced_search_form()
*/
function _islandora_solr_advanced_search_terms($form, &$form_state) {
function _islandora_solr_advanced_search_terms(array $form, array &$form_state) {
return $form['terms'];
}


/**
* Islandora Solr advanced search form submit callback.
*
Expand All @@ -738,7 +736,7 @@ function _islandora_solr_advanced_search_terms($form, &$form_state) {
*
* @see islandora_solr_advanced_search_form()
*/
function islandora_solr_advanced_search_form_submit($form, &$form_state) {
function islandora_solr_advanced_search_form_submit(array $form, array &$form_state) {
module_load_include('inc', 'islandora_solr', 'includes/utilities');

// Collect query values.
Expand Down Expand Up @@ -871,7 +869,7 @@ function islandora_solr_display() {
$attr['title'] = $display_description;
$attr['href'] = url($path, array('query' => $query));

// XXX: We're not using l() because of
// XXX: We're not using l() because of.
// @link http://drupal.org/node/41595 active classes. @endlink
$item = '<a' . drupal_attributes($attr) . '>' . check_plain($display_name) . '</a>';

Expand All @@ -893,7 +891,6 @@ function islandora_solr_display() {
return $output;
}


/**
* Provides a list to change the sorting on a current search query.
*
Expand Down Expand Up @@ -985,7 +982,7 @@ function islandora_solr_sort() {
$hooks = islandora_build_hook_list(ISLANDORA_SOLR_FACET_BUCKET_CLASSES_HOOK_BASE);
drupal_alter($hooks, $attributes, $_islandora_solr_queryclass);

// XXX: We're not using l() because of
// XXX: We're not using l() because of.
// @link http://drupal.org/node/41595 active classes. @endlink
$item = '<a' . drupal_attributes($attr) . '>' . $label . ' ' . $indicator . '</a>';

Expand Down Expand Up @@ -1174,7 +1171,7 @@ function islandora_solr_search_results_limit() {
$query['limit'] = $limit;
unset($query['page']);
$attr['href'] = url($path, array('query' => $query));
// XXX: We're not using l() because of
// XXX: We're not using l() because of.
// @link http://drupal.org/node/41595 active classes. @endlink
$limit_list[] = '<a' . drupal_attributes($attr) . '>' . $limit . '</a>';
}
Expand Down
3 changes: 2 additions & 1 deletion includes/breadcrumbs.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file
* Breadcrumb functions.
Expand Down Expand Up @@ -121,7 +122,7 @@ function islandora_solr_get_breadcrumb_parent($pid) {
$solr_build->executeQuery(FALSE);
$results = (array) $solr_build->islandoraSolrResult['response']['objects'];

$find_solr_value = function($o, $field) {
$find_solr_value = function ($o, $field) {
if (isset($o[$field])) {
return $o[$field];
}
Expand Down
Loading