S1068 false positive if class properties are filled by a foreach loop

I have a class with lots of private properties.
The values of this properties are stored in an external json file where the name of the property is the key of the json entry.
Because of this I loop through the array keys of the parsed json and do this:

if(file_exists($this->dir.self::FILE)){ // FILE is a class constant which contains the name of the json file and the property dir contains the path to this file and is determine at the initialisation of the class object
				$json = json_decode(file_get_contents($this->dir.self::FILE),true);
				if(!is_null($json) && is_array($json)){
					foreach($json as $key => $value){
						$this->$key = $value;
					}
				}
			}

Is there maybe a special comment so that I would be able to make sonarLint ignore it because it seems not to understand my logic?

Hi @mumbomedia,

you are right. Currently, SonarPHP is not able to recognize this property assignment strategy.
However, you can suppress raising any issue on this line by adding a //NOSONAR comment to this line.
I hope that can solve your problem for now.

Best,
Nils