-
Notifications
You must be signed in to change notification settings - Fork 179
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
Reports statistics demographic statistics fix #3628
Reports statistics demographic statistics fix #3628
Conversation
…ass.inc in setup() function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Why does Travis keep not starting on our PRs.. |
@@ -227,6 +227,11 @@ class Stats_Demographic extends \NDB_Form | |||
$this->tpl_data['Subprojects'] = $subprojects; | |||
$this->tpl_data['Visits'] = $Visits; | |||
|
|||
// PREVENT Undefined property Console Output | |||
if (!isset($this->params)) { | |||
$this->params = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just define params
as a class variable at the start of the class and instantiate it as null so that it's always defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way better solution, will do!
* @var array | ||
* @access private | ||
*/ | ||
var $params = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is PHP4 style. The @access private
should be removed, and use the language level private/protected/public keywords instead of var
in the code rather than a comment.
(This should also probably be protected, not private.)
used language level keywords instead of var
LWBTM (look way better to me :-) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have left the type annotation for phan, but we don't have it in most places and it's not a blocker
This pull request
Prevents console warning when going to Reports->Statistics and clicking on the Demographic Statistics when using a fresh installed version of Loris
. Itbecomes fixed by checking if $params has been set and prevent undefined property.
.See also:
Bug #14381