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

Fun Phan Fixes Part 3 #3544

Merged
merged 13 commits into from
Mar 19, 2018
Merged

Fun Phan Fixes Part 3 #3544

merged 13 commits into from
Mar 19, 2018

Conversation

driusan
Copy link
Collaborator

@driusan driusan commented Mar 12, 2018

This builds on #3535 to also fix the class of errors "PhanTypeMissingReturn"

This primarily involves changing the return comment from "none" (or similar) to "void", or fixing it to "void" on functions that don't return something when they claim to.

(The changes for this PR are entirely contained in 3a92d25, everything else in the diff is inherited from #3535 )

@driusan driusan requested a review from xlecours March 12, 2018 18:55
ZainVirani
ZainVirani previously approved these changes Mar 12, 2018
@ZainVirani ZainVirani dismissed their stale review March 12, 2018 21:32

realized travis failed because there were still mismatched signatures

@driusan
Copy link
Collaborator Author

driusan commented Mar 19, 2018

@ZainVirani Fixed them (hopefully)..

@@ -38,6 +38,12 @@ class DirectDataEntryMainPage
var $key;

var $TestName;

Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this the only varialbe that got a cooment ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was the only one generating an error.

Without it phan was inferring that it's a string, and generating the error:
htdocs/survey.php:112 PhanTypeComparisonToArray string to array comparison

@@ -147,7 +147,7 @@ class Mri_Protocol_Check_Violations extends \NDB_Menu_Filter
*
* @param integer $count The offset that this page is starting at
*
* @return none but as a side-effect populates $this->tpl_data['items']
* @return void but as a side-effect populates $this->tpl_data['items']
Copy link
Collaborator

Choose a reason for hiding this comment

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

no parentheses ??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, I'll add them for consistency..

* @access public
* @deprecated Use pselect wrappers instead
*/
function selectRow($query, &$result)
{
$this->select($query, $result);
$result = $this->pselect($query, array());
Copy link
Collaborator

@ridz1208 ridz1208 Mar 19, 2018

Choose a reason for hiding this comment

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

shouldn't this function be deprecated ? (replaced by pselectRow)

is this changes related to phan fixes ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

same applies below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, it should be.. but do you think 20.0 is the release to do it? It's been deprecated for a while now, so maybe it's finally time, but this change was just to fix an error from phan (I can't remember which)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it should either be completely removed or ignored by phan but I dont think we should update these functions to avoid people using them in the future...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, now I remember: it was to fix the error:

"Call to deprecated function \Database::select() defined at php/libraries/Database.class.inc:568"

so that PhanDeprecatedFunction could be removed from the ignore list.

Copy link
Collaborator

Choose a reason for hiding this comment

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

then I guess the solution would be to remove those

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll send a PR after this to remove, but I don't think it should be done as part of this PR, and I'm not convinced that we're ready with all the legacy instruments that might still be calling it. It's going to be really painful for projects to upgrade, but at least with this change we can be sure we're not calling anything that's been deprecated in the main codebase

Copy link
Collaborator

@ridz1208 ridz1208 Mar 19, 2018

Choose a reason for hiding this comment

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

Arguably with this change they have no more reason to stop calling these functions. I think it's been over 3 years these functions are deprecated.

We can do a very quick survey see the effect on projects. but yeah, it should not be part of this PR I agree

@@ -2060,7 +2060,7 @@ class LorisForm
* @param array $arr A reference to an array to store the
* extracted values into.
*
* @return none, but will modify &$arr parameter passed as a side-effect
* @return void, but will modify &$arr parameter passed as a side-effect
Copy link
Collaborator

Choose a reason for hiding this comment

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

no parentheses ??

@@ -603,7 +603,7 @@ class NDB_BVL_Feedback
*
* @return array
*/
function getThreadEntries($feedbackID)
static function getThreadEntries($feedbackID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this change seems out of context

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's to be able to remove "PhanStaticCallToNonStatic" from the ignored list. All the calls to it are static, so the method should be static too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just confirmed it. Dismissed

@ridz1208
Copy link
Collaborator

@driusan seems to be having a phpcs issue but otherwise looks good.

The only important comment is the "static" change, can you explain it ?

@ridz1208 ridz1208 added this to the 20.0 milestone Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants