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

More Phan Fixes #3535

Closed
wants to merge 10 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
15 changes: 1 addition & 14 deletions .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,21 @@
// FIXME: allow_missing_properties should be false, but there's
// too many other things to fix first.
"allow_missing_properties" => true,
// FIXME: null_casts_as_any_type should be false.
// This only adds 2 errors, which should be fairly easy to fix.
"null_casts_as_any_type" => true,
"null_casts_as_any_type" => false,
"scalar_implicit_cast" => false,
"ignore_undeclared_variables_in_global_scope" => false,
"suppress_issue_types" => [
"PhanTypeMismatchDeclaredReturn",
"PhanTypeNonVarPassByRef",
"PhanTypeExpectedObjectPropAccessButGotNull",
"PhanTypeInvalidDimOffset",
"PhanTypeMismatchDimAssignment",
"PhanDeprecatedFunction",
"PhanParamSuspiciousOrder",
"PhanTypeExpectedObjectPropAccess",
"PhanRedefineClass",
"PhanUndeclaredMethod",
"PhanUndeclaredFunction",
"PhanUndeclaredVariable",
"PhanUndeclaredVariableDim",
"PhanUndeclaredTypeReturnType",
"PhanTypeMismatchDimFetch",
"PhanTypeArraySuspiciousNullable",
"PhanUndeclaredStaticMethod",
"PhanUndeclaredClassMethod",
"PhanUndeclaredTypeParameter",
"PhanUndeclaredConstant",
Expand All @@ -55,15 +47,10 @@
"PhanTypeVoidAssignment",
"PhanParamTooFew",
"PhanParamTooMany",
"PhanStaticCallToNonStatic",
"PhanTypeComparisonToArray",
"PhanTypeArraySuspicious",
"PhanTypeInvalidRightOperand",
"PhanRedefineFunctionInternal",
"PhanRedefineFunction",
"PhanParamSpecial1",
"PhanParamSpecial2",
"PhanUnextractableAnnotation",
],
"analyzed_file_extensions" => ["php", "inc"],
"directory_list" => [
Expand Down
18 changes: 9 additions & 9 deletions htdocs/acknowledgements/acknowledgements.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
$publication_date = $_GET["date"];

$columns = array(
full_name => 'Full Name',
citation_name => 'Citation Name',
title => 'Title',
affiliations => 'Affiliations',
degrees => 'Degrees',
roles => 'Roles',
start_date => 'Start Date',
end_date => 'End Date',
present => 'Present?',
'full_name' => 'Full Name',
'citation_name' => 'Citation Name',
'title' => 'Title',
'affiliations' => 'Affiliations',
'degrees' => 'Degrees',
'roles' => 'Roles',
'start_date' => 'Start Date',
'end_date' => 'End Date',
'present' => 'Present?',
);

$keysAsString = implode(', ', array_keys($columns));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/api/v0.0.1/APIBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function handleOPTIONS()
{
$this->Header(
"Access-Control-Allow-Methods: ".
join($this->AllowedMethods, ",")
join(",", $this->AllowedMethods)
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to use implode() in lieu of join() as PHP docs description is in implode() and join() page refer to implode() page.
Not a blocker, just a discussion

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this is the minimum change to fix the "PhanParamSuspiciousOrder" error

$this->safeExit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/api/v0.0.1/candidates/InstrumentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function handleOPTIONS()
{
$this->Header(
"Access-Control-Allow-Methods: ".
join($this->AllowedMethods, ",")
join(",", $this->AllowedMethods)
);
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/api/v0.0.2/APIBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function handleOPTIONS()
{
$this->Header(
"Access-Control-Allow-Methods: ".
join($this->AllowedMethods, ",")
join(",", $this->AllowedMethods)
);
$this->safeExit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/api/v0.0.2/candidates/InstrumentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function handleOPTIONS()
{
$this->Header(
"Access-Control-Allow-Methods: ".
join($this->AllowedMethods, ",")
join(",", $this->AllowedMethods)
);
}

Expand Down
6 changes: 6 additions & 0 deletions htdocs/survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ class DirectDataEntryMainPage
var $key;

var $TestName;

/**
* The instrument subpage being accessed
*
* @var mixed
*/
var $Subtest;

var $NumPages;
Expand Down
2 changes: 1 addition & 1 deletion modules/candidate_list/test/candidate_listTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ private function _assertSearchBy(array $criteria, $expectedResults)
$selectElement->selectByVisibleText($elementValue);
break;
default:
throw Exception(
throw new Exception(
'Element type ' . $element->getTagName() . ' not supported'
);
}
Expand Down
4 changes: 3 additions & 1 deletion modules/document_repository/ajax/documentEditUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@

$fileSize = $_FILES["file"]["size"];
$fileName = $_FILES["file"]["name"];
$fileType = end((explode(".", $fileName)));

$ft = explode(".", $fileName);
$fileType = end($ft);

// __DIR__ is the document_repository ajax directory
// when this script is executing. Go up a level to the
Expand Down
2 changes: 1 addition & 1 deletion modules/new_profile/php/new_profile.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class New_Profile extends \NDB_Form
/**
* Validate function
*
* @param string $values the value
* @param array $values the value
*
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ class MriUploadServerProcess extends AbstractServerProcess
/**
* ID of the MRI upload request in the mri_upload table.
*
* @var
* @var int
*/
private $_mriUploadId;

/**
* Location of the MRI file uploaded.
*
* @var
* @var string
*/
private $_sourceLocation;

/**
* Root of the MRI files directory.
*
* @var
* @var string
*/
private $_mriCodePath;

Expand Down
5 changes: 3 additions & 2 deletions modules/training/php/training.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ class Training extends \NDB_Form

foreach ($certificationInstruments['test'] as $certificationInstrument) {
$test_key = $certificationInstrument['@']['value'];
$testID = $DB->selectOne(
$testID = $DB->pselectOne(
"SELECT ID
FROM test_names
WHERE Test_name
LIKE '%$test_key%'"
LIKE CONCAT('%', :testkey, '%')",
array('testkey' => $test_key)
);
$instruments[$testID] = $certificationInstrument['#'];
}
Expand Down
5 changes: 2 additions & 3 deletions php/libraries/Database.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ class Database
*/
function selectRow($query, &$result)
{
$this->select($query, $result);
$result = $this->pselect($query, array());
if (is_array($result) && isset($result[0])) {
$result = $result[0];
}
Expand All @@ -641,8 +641,7 @@ class Database
*/
function selectOne($query)
{
$result = null;
$this->select($query, $result);
$result = $this->pselect($query, array());
if (is_array($result) && count($result)) {
list(,$result) = each($result[0]);
}
Expand Down
2 changes: 1 addition & 1 deletion php/libraries/NDB_BVL_Feedback.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ class NDB_BVL_Feedback
*
* @return array
*/
function getThreadEntries($feedbackID)
static function getThreadEntries($feedbackID)
{
// new DB Object
$db =& Database::singleton();
Expand Down
2 changes: 1 addition & 1 deletion php/libraries/Utility.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ class Utility
* @param string $inst The test_name of the instrument for which you would
* like to know the score columns
*
* @return non-associative array of scored columns for the instrument given
* @return array (non-associative) of scored columns for the instrument given
*/
static function getScoreColsForInstrument($inst)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Provisioner.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function map(Mapper $map) : Provisioner;
*
* @param \User $user The user who data is being provisioned on behalf of.
*
* @return DataInstance[]
* @return \Traversable of DataInstance objects
*/
public function execute(\User $user) : \Traversable;
};
4 changes: 2 additions & 2 deletions src/Data/ProvisionerInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function map(Mapper $map) : Provisioner
* respect to the User accessing the data), which then gets mapped and
* filtered by execute.
*
* @return Traversable of all resources provided by this data source.
* @return \Traversable of all resources provided by this data source.
*/
abstract protected function getAllInstances() : \Traversable;

Expand All @@ -99,7 +99,7 @@ abstract protected function getAllInstances() : \Traversable;
*
* @param \User $user The user who data is being provisioned on behalf of.
*
* @return Instance[]
* @return \Traversable of DataInstance objects
*/
public function execute(\User $user) : \Traversable
{
Expand Down