Travis is giving me ~ Assignments must be the first block of code on a line for this specific line of code:
$validate_string = $pf_param_string = substr( $pf_param_string, 0, - 1 );
It seems fine to me or am I doing the assignments wrong?
Travis is giving me ~ Assignments must be the first block of code on a line for this specific line of code:
$validate_string = $pf_param_string = substr( $pf_param_string, 0, - 1 );
It seems fine to me or am I doing the assignments wrong?
Share Improve this question asked Nov 20, 2018 at 14:06 DemonixDemonix 613 silver badges12 bronze badges2 Answers
Reset to default 2You're not supposed to assign multiple variables on a single line. Do them separately:
$pf_param_string = substr( $pf_param_string, 0, - 1 );
$validate_string = $pf_param_string;
Or, if you don't need both variables, just skip one of them:
$validate_string = substr( $pf_param_string, 0, - 1 );
According to this answer on StackOverflow, it could be the problem with multiple assignments in one line. Refactoring to
$validate_string = substr( $pf_param_string, 0, - 1 );
$pf_param_string = $validate_string;
should solve this.