Skip to content

Commit

Permalink
Fix phan on 20.0-release branch (#3735)
Browse files Browse the repository at this point in the history
Phan is failing with redeclared class exceptions on some
PRs that otherwise pass, this is a check for whether that's
just broken on the 20.0-release branch in general.
  • Loading branch information
driusan committed Jun 18, 2018
1 parent dfcca64 commit 29ee4df
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .phan/config.php
Expand Up @@ -20,10 +20,11 @@
"PhanTypeInvalidDimOffset",
"PhanTypeMismatchDimAssignment",
"PhanRedefineClass",
"PhanRedefinedExtendedClass",
"PhanUndeclaredMethod",
"PhanUndeclaredVariable",
"PhanUndeclaredVariableDim",
"PhanUndeclaredTypeReturnType",
"PhanUndeclaredTypeReturnType",
"PhanTypeMismatchDimFetch",
"PhanTypeArraySuspiciousNullable",
"PhanUndeclaredClassMethod",
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -94,7 +94,6 @@ before_script:
# - "LORIS_DB_CONFIG=test/config.xml"

script:
- vendor/bin/phan
- npm run lint:php && npm run lint:javascript && vendor/bin/phpunit --configuration test/phpunit.xml
- vendor/bin/phan && npm run lint:php && npm run lint:javascript && vendor/bin/phpunit --configuration test/phpunit.xml

dist: precise
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -91,3 +91,4 @@ LORIS requires Apache's mod_rewrite module to rewrite its URLs. Enable this modu

# Community
Please feel free to subscribe to the [LORIS Developers mailing list](http://www.bic.mni.mcgill.ca/mailman/listinfo/loris-dev) to ask any LORIS-related questions.

1 change: 1 addition & 0 deletions modules/imaging_browser/php/imaging_browser.class.inc
Expand Up @@ -84,6 +84,7 @@ class Imaging_Browser extends \NDB_Menu_Filter
$this->acqpid = "AND AcquisitionProtocolID IN (".
implode(",", array_keys($scan_id_types)) .")";
$isFirst = true;
$acqpif = '';
foreach ($scan_id_types as $key => $value) {
if ($isFirst) {
$acqpif = "IF(FIND_IN_SET({$key},GROUP_CONCAT(
Expand Down
5 changes: 2 additions & 3 deletions php/libraries/FeedbackMRI.class.inc
Expand Up @@ -472,12 +472,11 @@ class FeedbackMRI
// build the where depending on object and subject type
if ($this->objectType == 'volume') {
// per-volume
$where .= "FileID='$this->fileID'";
return "FileID='$this->fileID'";
} else {
// per-visit
$where .= "SessionID='$this->sessionID'";
return "SessionID='$this->sessionID'";
}
return $where;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions php/libraries/NDB_BVL_Instrument.class.inc
Expand Up @@ -837,7 +837,7 @@ class NDB_BVL_Instrument extends NDB_Page
* override getExaminerNames() can still easily get the config
* settings and don't need to parse the config file themselves.
*
* @return three element array.
* @return array
*/
function _getCertificationConfig()
{
Expand Down Expand Up @@ -1243,7 +1243,7 @@ class NDB_BVL_Instrument extends NDB_Page
* @param elements $elements Array of values submitted on current page.
* @param array $rules Array of rules that have been registered.
*
* @return associative array of errors (fieldname => error message)
* @return array of errors (fieldname => error message)
*/
function XINRunElementRules($elname, $elements, $rules)
{
Expand Down Expand Up @@ -1371,7 +1371,7 @@ class NDB_BVL_Instrument extends NDB_Page
*
* @param string $field The field to get from this instrument
*
* @return The value of the field, or false if it's empty.
* @return string|false The value of the field, or false if it's empty.
*/
function getFieldValue($field)
{
Expand Down Expand Up @@ -1935,7 +1935,7 @@ class NDB_BVL_Instrument extends NDB_Page
*
* @param array $scoreCols list of scoring fields to null
*
* @return none
* @return void
*/
function _nullScores($scoreCols)
{
Expand Down Expand Up @@ -2040,7 +2040,7 @@ class NDB_BVL_Instrument extends NDB_Page
* @param array $Date_taken (optional) The date that the age is to
* be calculated based on.
*
* @return The age of the candidate in an array containing years, months
* @return array The age of the candidate in an array containing years, months
* and days.
*/
function getCandidateAge($Date_taken = false)
Expand Down Expand Up @@ -2071,7 +2071,7 @@ class NDB_BVL_Instrument extends NDB_Page
/**
* Get the candidates PSCID.
*
* @return The candidate's PSCID.
* @return string The candidate's PSCID.
*/
function getPSCID()
{
Expand Down
6 changes: 3 additions & 3 deletions php/libraries/NDB_Config.class.inc
Expand Up @@ -455,7 +455,7 @@ class NDB_Config
*
* @param integer $ProjectID The ProjectID we want settings for
*
* @return an array of settings for this project.
* @return array of settings for this project.
*/
function getProjectSettings($ProjectID)
{
Expand Down Expand Up @@ -488,7 +488,7 @@ class NDB_Config
* @param integer $subprojectID The subprojectID we want the settings
* for
*
* @return associative array of settings for this subprojectID
* @return array of settings for this subprojectID
*/
function getSubprojectSettings($subprojectID)
{
Expand Down Expand Up @@ -620,7 +620,7 @@ class NDB_Config
*
* @param string $type The type of links to show
*
* @return associative array of Label => URL
* @return array of Label => URL
*/
function getExternalLinks($type)
{
Expand Down
2 changes: 1 addition & 1 deletion php/libraries/NDB_Menu_Filter.class.inc
Expand Up @@ -216,7 +216,7 @@ class NDB_Menu_Filter extends NDB_Menu
* ]
* to retrieve the values from.
*
* @return An array of filters in the same form as the $values parameter
* @return array of filters in the same form as the $values parameter
* that can be saved for future use.
*/
function _setFilters($values)
Expand Down
16 changes: 8 additions & 8 deletions php/libraries/NDB_Page.class.inc
Expand Up @@ -447,7 +447,7 @@ class NDB_Page implements RequestHandlerInterface
* @param array $options Extra options to pass to QuickForm
* @param array $attr Extra HTML attributes to add to the element
*
* @return HTML_QuickForm select element
* @return array representing select element
*/
function createSelect(
$field,
Expand All @@ -463,7 +463,7 @@ class NDB_Page implements RequestHandlerInterface
*
* @param string $labelString The label to attach to the element
*
* @return HTML_QuickForm Label element
* @return array representing label element
*/
function createLabel(
$labelString
Expand All @@ -482,7 +482,7 @@ class NDB_Page implements RequestHandlerInterface
* @param string $label The label to attach to the element
* @param array $attribs Extra HTML attributes to add to the element
*
* @return HTML_QuickForm Text element
* @return array representing text element
*/
function createText(
$field,
Expand All @@ -499,7 +499,7 @@ class NDB_Page implements RequestHandlerInterface
* @param string $field The field name for the TextArea
* @param string $label The label to attach to this TextArea
*
* @return HTML_QuickForm textarea element
* @return array representing textarea element
*/
function createTextArea($field, $label=null)
{
Expand All @@ -520,7 +520,7 @@ class NDB_Page implements RequestHandlerInterface
* @param array $attr List of HTML attributes to add to the date
* group.
*
* @return HTML_QuickForm date element
* @return array representing date element
*/
function createDate(
$field,
Expand Down Expand Up @@ -548,7 +548,7 @@ class NDB_Page implements RequestHandlerInterface
* @param string $options Options to pass to HTML_QuickForm
* @param string $closer ?????
*
* @return QuickForm_Element representing checkbox
* @return array representing checkbox
*/
function createCheckbox($field, $label, $options=null, $closer='</label>')
{
Expand All @@ -568,7 +568,7 @@ class NDB_Page implements RequestHandlerInterface
* @param string $label The label to attach to this radio button
* @param string $options Options to pass to LorisForm
*
* @return QuickForm_Element representing radio button
* @return array representing radio button
*/
function createRadio($field, $label, $options=null)
{
Expand All @@ -588,7 +588,7 @@ class NDB_Page implements RequestHandlerInterface
* @param string $label The label to attach to the form element
* @param array $attr List of HTML attributes to add to the element
*
* @return QuickForm_Element Form element
* @return array representing form element
*/
function createPassword(
$field,
Expand Down
6 changes: 3 additions & 3 deletions php/libraries/NDB_Reliability.class.inc
Expand Up @@ -214,7 +214,7 @@ class NDB_Reliability extends NDB_Form
* @param string $message The message if this rule fails
* @param string $group The group that should display the error
*
* @return none
* @return void
*/
function XINRegisterRule($elname, $rules, $message="", $group="")
{
Expand Down Expand Up @@ -312,7 +312,7 @@ class NDB_Reliability extends NDB_Form
* @param string $rule_message The error message to display if a rule is
* violated.
*
* @return none
* @return void
*/
function addLargeTextAreaElement(
$field,
Expand Down Expand Up @@ -401,7 +401,7 @@ class NDB_Reliability extends NDB_Form
* @param array $formDateValue Date in the array format returned
* by QuickForm
*
* @return MySQL formatted string
* @return string MySQL formatted date string
*/
function _getDatabaseDate($formDateValue)
{
Expand Down
2 changes: 1 addition & 1 deletion php/libraries/SinglePointLogin.class.inc
Expand Up @@ -141,7 +141,7 @@ class SinglePointLogin
/**
* Attempt to authenticate a user's credentials by any supported means.
*
* @return none (but may modified session state)
* @return void (but may modified session state)
*/
function authenticate()
{
Expand Down
4 changes: 2 additions & 2 deletions php/libraries/TimePoint.class.inc
Expand Up @@ -547,7 +547,7 @@ class TimePoint
/**
* Gets the current stage status
*
* @return status of current stage or null
* @return ?string status of current stage or null
*/
function getCurrentStatus()
{
Expand All @@ -562,7 +562,7 @@ class TimePoint
/**
* Gets the date of the current stage.
*
* @return date or false on failure.
* @return string of the form "YYYY-MM-DD"
*/
function getCurrentDate()
{
Expand Down
14 changes: 6 additions & 8 deletions php/libraries/Utility.class.inc
Expand Up @@ -128,7 +128,7 @@ class Utility
* table
* @param boolean $DCC Whether the DCC should be included or not
*
* @return Associative array of the form CenterID => Site Name.
* @return array of the form CenterID => Site Name.
* Note that even though CenterID is numeric, the array
* should be interpreted as an associative array since the keys
* refer to the centerID, not the array index.
Expand Down Expand Up @@ -376,7 +376,7 @@ class Utility
* the parameters into. If not specified,
* a new array will be created
*
* @return An array with the two parameters recursively merged
* @return array with the two parameters recursively merged
*/
static function arrayMergeRecursiveOverwriting(
$array1,
Expand Down Expand Up @@ -516,8 +516,7 @@ class Utility
/**
* Get a list of instruments installed in Loris.
*
* @return Associative array of the form Test_name => Full Description
* @note Arguably, this should be a static function in NDB_BVL_Instrument
* @return array of the form Test_name => Full Description
*/
static function getAllInstruments()
{
Expand All @@ -540,8 +539,7 @@ class Utility
/**
* Get a list of DDE instruments installed in Loris.
*
* @return Associative array of the form Test_name => Full Description
* @note Arguably, this should be a static function in NDB_BVL_Instrument
* @return array of the form Test_name => Full Description
*/
static function getAllDDEInstruments()
{
Expand Down Expand Up @@ -573,7 +571,7 @@ class Utility
* This should return an array in a format suitable for addSelect() from
* NDB_Page
*
* @return associative array of test_names in a Test_Name => "Full Name"
* @return array of test_names in a Test_Name => "Full Name"
*/
static function getDirectInstruments()
{
Expand Down Expand Up @@ -784,7 +782,7 @@ class Utility
*
* @param integer $projectID Limit visit labels to labels used by this project
*
* @return An associated array of study visits in the format array('VL' => 'VL')
* @return array of study visits in the format array('VL' => 'VL')
* where VL is the visit label
*
* @note THIS FUNCTION USES STRING CONCATENATION TO GENERATE AN
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/Loris_PHPUnit_Database_TestCase.php
Expand Up @@ -87,7 +87,7 @@ protected function setUp()
* Get database connection which will be used by PHPUnit
* for clean-up and fixture loading into the test DB.
*
* @return PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection
* @return \PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection
*/
final public function getConnection()
{
Expand Down

0 comments on commit 29ee4df

Please sign in to comment.