Skip to content

Commit 948f49c

Browse files
committed
fixed: PHP implicit null declaration
1 parent 81d9f38 commit 948f49c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

classes/ElggAnswer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function isCorrectAnswer(): bool {
105105
*
106106
* @return bool
107107
*/
108-
public function canMarkAnswer(\ElggUser $user = null): bool {
108+
public function canMarkAnswer(?\ElggUser $user = null): bool {
109109
// check if we have a user
110110
if (empty($user)) {
111111
$user = elgg_get_logged_in_user_entity();

lib/functions.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function questions_experts_only_answer(): bool {
5858
*
5959
* @return bool
6060
*/
61-
function questions_is_expert(\ElggEntity $container = null, \ElggUser $user = null): bool {
61+
function questions_is_expert(?\ElggEntity $container = null, ?\ElggUser $user = null): bool {
6262
if (!questions_experts_enabled()) {
6363
return false;
6464
}
@@ -226,7 +226,7 @@ function questions_get_group_access_level(\ElggGroup $group) {
226226
*
227227
* @return int
228228
*/
229-
function questions_get_solution_time(\ElggEntity $container = null): int {
229+
function questions_get_solution_time(?\ElggEntity $container = null): int {
230230
static $plugin_setting;
231231

232232
if (!isset($plugin_setting)) {
@@ -270,11 +270,11 @@ function questions_limited_to_groups(): bool {
270270
* Check if a user can ask a question in a container
271271
*
272272
* @param null|\ElggEntity $container the container to check (default: page_owner)
273-
* @param null|\ElggUser $user the user askting the question (default: current user)
273+
* @param null|\ElggUser $user the user asking the question (default: current user)
274274
*
275275
* @return bool
276276
*/
277-
function questions_can_ask_question(\ElggEntity $container = null, \ElggUser $user = null): bool {
277+
function questions_can_ask_question(?\ElggEntity $container = null, ?\ElggUser $user = null): bool {
278278
// default to page owner
279279
if (!$container instanceof \ElggEntity) {
280280
$container = elgg_get_page_owner_entity();
@@ -300,12 +300,12 @@ function questions_can_ask_question(\ElggEntity $container = null, \ElggUser $us
300300
/**
301301
* Check if a user can answer a question
302302
*
303-
* @param null|\ElggQuestion $question the question that needs answer
304-
* @param null|\ElggUser $user the user askting the question (default: current user)
303+
* @param \ElggQuestion $question the question that needs answer
304+
* @param null|\ElggUser $user the user asking the question (default: current user)
305305
*
306306
* @return bool
307307
*/
308-
function questions_can_answer_question(\ElggQuestion $question, \ElggUser $user = null): bool {
308+
function questions_can_answer_question(\ElggQuestion $question, ?\ElggUser $user = null): bool {
309309
static $general_experts_only;
310310

311311
// default to current user
@@ -366,7 +366,7 @@ function questions_can_answer_question(\ElggQuestion $question, \ElggUser $user
366366
*
367367
* @return bool
368368
*/
369-
function questions_auto_mark_answer_correct(\ElggEntity $container, \ElggUser $user = null) {
369+
function questions_auto_mark_answer_correct(\ElggEntity $container, ?\ElggUser $user = null) {
370370
if (!$container instanceof \ElggGroup) {
371371
// for now only supported in groups
372372
return false;

0 commit comments

Comments
 (0)