Skip to content

Commit ad1b998

Browse files
authored
fix: normalize ACF migration results (#2128)
Cast mixed migrator results to the handler's declared boolean contract and return false for unsupported field definitions. This prevents successful ACF record IDs from causing strict return type errors while preserving existing boolean outcomes.
1 parent 8c8cd14 commit ad1b998

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Modularity/source/php/Upgrade/Migrators/Module/AcfModuleMigrationHandler.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ private function migrateField(string $oldFieldName, $newField): bool
3838

3939
if (is_string($newField)) {
4040
$migrator = new AcfModuleFieldMigrator($newField, $oldFieldValue, $this->moduleId);
41-
return $migrator->migrate();
41+
return (bool) $migrator->migrate();
4242
}
43+
44+
return false;
4345
}
4446

4547
private function migrateFieldByType(string $oldFieldName, $oldFieldValue, array $newField): bool
@@ -55,7 +57,7 @@ private function migrateFieldByType(string $oldFieldName, $oldFieldValue, array
5557
$migrator = new $class($newField, $oldFieldValue, $this->moduleId);
5658
}
5759

58-
return isset($migrator) ? $migrator->migrate() : false;
60+
return isset($migrator) ? (bool) $migrator->migrate() : false;
5961
}
6062

6163
private function isRemoveFieldMigration($newField)

0 commit comments

Comments
 (0)