V
V
va1errr2020-04-25 10:23:30
PHP
va1errr, 2020-04-25 10:23:30

Error: Call to a member function on null?

Code:
public function donat ($player) {
$form = $api->createSimpleForm (function (Player $player int $data = null) {
if ($data === null) {
return;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
John Didact, 2020-04-25
@va1errr

For me, it’s written here in black and white what the problem is))
Also, as far as I know, the arguments should be separated by a comma ...
For me, it’s quite confusing: incomprehensible variables, calling a method, passing a function to its argument that takes its arguments of a certain class and number (but null by default). I would separate it all, but it doesn't matter.
The important thing is that there is no comma between Player $playerand int $data = null.

R
Rsa97, 2020-04-25
@Rsa97

Where is the $api variable defined inside the function?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question