encode arrays as string
This commit is contained in:
parent
9b652ed5d5
commit
5a3e57c2f5
2 changed files with 6 additions and 4 deletions
|
@ -127,9 +127,6 @@ class CheckCode extends Command {
|
||||||
if($value === [] || is_null($value) || $value === '') {
|
if($value === [] || is_null($value) || $value === '') {
|
||||||
$output->writeln("<info>Deprecated field available: $key</info>");
|
$output->writeln("<info>Deprecated field available: $key</info>");
|
||||||
} else {
|
} else {
|
||||||
if(is_array($value)) {
|
|
||||||
$value = 'Array of ' . count($value) . ' element(s)';
|
|
||||||
}
|
|
||||||
$output->writeln("<info>Deprecated field available: $key => $value</info>");
|
$output->writeln("<info>Deprecated field available: $key => $value</info>");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,6 +39,7 @@ class InfoChecker extends BasicEmitter {
|
||||||
private $optionalFields = [
|
private $optionalFields = [
|
||||||
'bugs',
|
'bugs',
|
||||||
'category',
|
'category',
|
||||||
|
'dependencies',
|
||||||
'documentation',
|
'documentation',
|
||||||
'namespace',
|
'namespace',
|
||||||
'ocsid',
|
'ocsid',
|
||||||
|
@ -51,6 +52,7 @@ class InfoChecker extends BasicEmitter {
|
||||||
];
|
];
|
||||||
private $deprecatedFields = [
|
private $deprecatedFields = [
|
||||||
'default_enable',
|
'default_enable',
|
||||||
|
'info',
|
||||||
'public',
|
'public',
|
||||||
'remote',
|
'remote',
|
||||||
'shipped',
|
'shipped',
|
||||||
|
@ -76,6 +78,9 @@ class InfoChecker extends BasicEmitter {
|
||||||
$info = $this->infoParser->parse($appPath . '/appinfo/info.xml');
|
$info = $this->infoParser->parse($appPath . '/appinfo/info.xml');
|
||||||
|
|
||||||
foreach ($info as $key => $value) {
|
foreach ($info as $key => $value) {
|
||||||
|
if(is_array($value)) {
|
||||||
|
$value = json_encode($value);
|
||||||
|
}
|
||||||
if (in_array($key, $this->mandatoryFields)) {
|
if (in_array($key, $this->mandatoryFields)) {
|
||||||
$this->emit('InfoChecker', 'mandatoryFieldFound', [$key, $value]);
|
$this->emit('InfoChecker', 'mandatoryFieldFound', [$key, $value]);
|
||||||
continue;
|
continue;
|
||||||
|
@ -88,7 +93,7 @@ class InfoChecker extends BasicEmitter {
|
||||||
|
|
||||||
if (in_array($key, $this->deprecatedFields)) {
|
if (in_array($key, $this->deprecatedFields)) {
|
||||||
// skip empty arrays - empty arrays for remote and public are always added
|
// skip empty arrays - empty arrays for remote and public are always added
|
||||||
if($value === []) {
|
if($value === '[]' && in_array($key, ['public', 'remote', 'info'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->emit('InfoChecker', 'deprecatedFieldFound', [$key, $value]);
|
$this->emit('InfoChecker', 'deprecatedFieldFound', [$key, $value]);
|
||||||
|
|
Loading…
Reference in a new issue