diff --git a/.phan/config.php b/.phan/config.php index 1e7ef453e4d..972a1ab8344 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -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", @@ -55,15 +47,10 @@ "PhanTypeVoidAssignment", "PhanParamTooFew", "PhanParamTooMany", - "PhanStaticCallToNonStatic", - "PhanTypeComparisonToArray", "PhanTypeArraySuspicious", "PhanTypeInvalidRightOperand", "PhanRedefineFunctionInternal", "PhanRedefineFunction", - "PhanParamSpecial1", - "PhanParamSpecial2", - "PhanUnextractableAnnotation", ], "analyzed_file_extensions" => ["php", "inc"], "directory_list" => [ diff --git a/htdocs/acknowledgements/acknowledgements.php b/htdocs/acknowledgements/acknowledgements.php index ca20c232ba6..6484c28db18 100644 --- a/htdocs/acknowledgements/acknowledgements.php +++ b/htdocs/acknowledgements/acknowledgements.php @@ -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)); diff --git a/htdocs/api/v0.0.1/APIBase.php b/htdocs/api/v0.0.1/APIBase.php index c85c3e37cbb..2b4ff3c8af4 100644 --- a/htdocs/api/v0.0.1/APIBase.php +++ b/htdocs/api/v0.0.1/APIBase.php @@ -199,7 +199,7 @@ function handleOPTIONS() { $this->Header( "Access-Control-Allow-Methods: ". - join($this->AllowedMethods, ",") + join(",", $this->AllowedMethods) ); $this->safeExit(0); } diff --git a/htdocs/api/v0.0.1/candidates/InstrumentData.php b/htdocs/api/v0.0.1/candidates/InstrumentData.php index 98b2bf96274..e7f72f8dfea 100644 --- a/htdocs/api/v0.0.1/candidates/InstrumentData.php +++ b/htdocs/api/v0.0.1/candidates/InstrumentData.php @@ -156,7 +156,7 @@ function handleOPTIONS() { $this->Header( "Access-Control-Allow-Methods: ". - join($this->AllowedMethods, ",") + join(",", $this->AllowedMethods) ); } diff --git a/htdocs/api/v0.0.2/APIBase.php b/htdocs/api/v0.0.2/APIBase.php index dde294e8059..be8c89fa0b3 100644 --- a/htdocs/api/v0.0.2/APIBase.php +++ b/htdocs/api/v0.0.2/APIBase.php @@ -199,7 +199,7 @@ function handleOPTIONS() { $this->Header( "Access-Control-Allow-Methods: ". - join($this->AllowedMethods, ",") + join(",", $this->AllowedMethods) ); $this->safeExit(0); } diff --git a/htdocs/api/v0.0.2/candidates/InstrumentData.php b/htdocs/api/v0.0.2/candidates/InstrumentData.php index 2b5a789b610..f82fb4401c7 100644 --- a/htdocs/api/v0.0.2/candidates/InstrumentData.php +++ b/htdocs/api/v0.0.2/candidates/InstrumentData.php @@ -156,7 +156,7 @@ function handleOPTIONS() { $this->Header( "Access-Control-Allow-Methods: ". - join($this->AllowedMethods, ",") + join(",", $this->AllowedMethods) ); } diff --git a/htdocs/survey.php b/htdocs/survey.php index 3ec8291e02f..cecf94b4e7a 100644 --- a/htdocs/survey.php +++ b/htdocs/survey.php @@ -38,6 +38,12 @@ class DirectDataEntryMainPage var $key; var $TestName; + + /** + * The instrument subpage being accessed + * + * @var mixed + */ var $Subtest; var $NumPages; diff --git a/modules/candidate_list/test/candidate_listTest.php b/modules/candidate_list/test/candidate_listTest.php index 5f25a3e60d2..963b377cb7c 100644 --- a/modules/candidate_list/test/candidate_listTest.php +++ b/modules/candidate_list/test/candidate_listTest.php @@ -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' ); } diff --git a/modules/document_repository/ajax/documentEditUpload.php b/modules/document_repository/ajax/documentEditUpload.php index e50c3125652..d8865e3f2ae 100644 --- a/modules/document_repository/ajax/documentEditUpload.php +++ b/modules/document_repository/ajax/documentEditUpload.php @@ -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 diff --git a/modules/new_profile/php/new_profile.class.inc b/modules/new_profile/php/new_profile.class.inc index 832c6efcca3..55b63d50923 100644 --- a/modules/new_profile/php/new_profile.class.inc +++ b/modules/new_profile/php/new_profile.class.inc @@ -240,7 +240,7 @@ class New_Profile extends \NDB_Form /** * Validate function * - * @param string $values the value + * @param array $values the value * * @return string */ diff --git a/modules/server_processes_manager/php/mriuploadserverprocess.class.inc b/modules/server_processes_manager/php/mriuploadserverprocess.class.inc index 6fba07db4ab..43db4bfcd17 100644 --- a/modules/server_processes_manager/php/mriuploadserverprocess.class.inc +++ b/modules/server_processes_manager/php/mriuploadserverprocess.class.inc @@ -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; diff --git a/modules/training/php/training.class.inc b/modules/training/php/training.class.inc index 4ddd6eddf98..576188b77f6 100644 --- a/modules/training/php/training.class.inc +++ b/modules/training/php/training.class.inc @@ -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['#']; } diff --git a/php/libraries/Database.class.inc b/php/libraries/Database.class.inc index a89aeb719a1..b18369aa5d8 100644 --- a/php/libraries/Database.class.inc +++ b/php/libraries/Database.class.inc @@ -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]; } @@ -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]); } diff --git a/php/libraries/NDB_BVL_Feedback.class.inc b/php/libraries/NDB_BVL_Feedback.class.inc index ce48eee1e3e..d48537b4091 100644 --- a/php/libraries/NDB_BVL_Feedback.class.inc +++ b/php/libraries/NDB_BVL_Feedback.class.inc @@ -603,7 +603,7 @@ class NDB_BVL_Feedback * * @return array */ - function getThreadEntries($feedbackID) + static function getThreadEntries($feedbackID) { // new DB Object $db =& Database::singleton(); diff --git a/php/libraries/Utility.class.inc b/php/libraries/Utility.class.inc index bdd7e448f64..1e3a083f0ab 100644 --- a/php/libraries/Utility.class.inc +++ b/php/libraries/Utility.class.inc @@ -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) { diff --git a/src/Data/Provisioner.php b/src/Data/Provisioner.php index 1f58b02e5c0..3ab51ef42dd 100644 --- a/src/Data/Provisioner.php +++ b/src/Data/Provisioner.php @@ -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; }; diff --git a/src/Data/ProvisionerInstance.php b/src/Data/ProvisionerInstance.php index dd1050f6059..2002c12890f 100644 --- a/src/Data/ProvisionerInstance.php +++ b/src/Data/ProvisionerInstance.php @@ -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; @@ -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 {