문제

Could anyone help me with these errors? I am getting them from the code checker plugin.,

if·($this->content·!==·null){

Expected "if (...) {\n"; found "if (...){\n"

#38: ········if(isloggedin()·and·!has_capability('moodle/site:config',·get_context_instance(CONTEXT_SYSTEM)))·{

Expected "if (...) {\n"; found "if(...) {\n"

#44: ············if($courseid·>·1)·{

Expected "if (...) {\n"; found "if(...) {\n"

#49: ················foreach($criteriamods·as·$ctmds)·{

Expected "foreach (...) {\n"; found "foreach(...) {\n"
도움이 되었습니까?

해결책

Good news: these are not PHP errors. Bad news: they are violations of standard Moodle coding style.

Which means that fixing these "errors" will not have any effect on the way the code runs, but should (hopefully) lead to code which is easier for most Moodle developers to read and understand.

In all of the "errors" you have listed, the complaint looks to be related to spacing around the parentheses. For example, in the first one you need to put some space between the closing parenthesis ) and the opening brace {.

It's a similar story for the others. Once you have identified the appropriate lines of code, make sure there are spaces before the opening parentheses and after the closing parentheses.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top