I have a PHP-Lumen project and when I execute sonar scanner in my project I get this error.
'String literals should not be duplicated'
Is it something that I should fix or just ignore?
$errorArray['code'] = config('errormessages.invalidJson.error_code');
$errorArray['message'] = config('errormessages.invalidJson.error_message')
In the above code snippet, SonarQube says that the 'code' and 'messages' are duplicated across my the code and expects me to define a constant instead of using these index directly. But these are just indexes of $errorArray
, why should I have a constant defined?