Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/FileUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static function upgradePhpFiles(): void
strpos($fileStr, 'FacturaScripts\Core\Model\Base') === false &&
strpos($fileStr, 'function clear()') === false &&
strpos($fileStr, 'DataBaseWhere') === false &&
strpos($fileStr, '$this->addButton(') === false &&
strpos($fileStr, '->addButton(') === false &&
strpos($fileStr, 'Core\Model\Base\JoinModel') === false
) {
continue;
Expand Down Expand Up @@ -442,6 +442,13 @@ public static function upgradePhpFiles(): void
// reemplazamos protected function onChange($field) por protected function onChange(string $field): bool
$fileStr = str_replace('protected function onChange($field)', 'protected function onChange(string $field): bool', $fileStr);

// migramos addButton($viewName, [...]) a tab($viewName)->addButton([...])
$fileStr = preg_replace(
'/\$this->addButton\(\s*([^,]+)\s*,\s*(\[[\s\S]*?\])\s*\);/m',
'$this->tab($1)->addButton($2);',
$fileStr
);

// manejamos el archivo Init.php específicamente
if (basename($pathFile) === 'Init.php') {
// añadimos tipo de retorno void a init() y update() si no existe
Expand Down