Files
dearpramodandAdam Daley bb7be09253 Fall back to the shipped preset for admin-created theme presets (#4595)
* Fall back to the shipped preset for admin-created theme presets

A preset created in the admin has no entry in settings_data.json, so getThemeSettings() had no defaults to merge saved values over and returned only the saved keys. Use the theme's shipped preset as the defaults in that case.

* Sync Rector's nested phpdoc-parser copy with the project's copy

Rector 2.8.2 ships an unprefixed phpstan/phpdoc-parser 2.3.x in its nested
vendor directory, which its bootstrap loads ahead of the project's 2.4 copy.
PHPStan 2.3.4+ relies on the 2.4 CallableTypeNode API, so Rector crashed with
a TypeError while analysing any file whose closure types get precisely
described (every Pest test file). A post-install/update hook now copies the
project's phpdoc-parser over the stale nested copy whenever it is older.

Unblocks the Rector check on PR #4595 and any future PR touching test files.

* Address review comments on theme preset fallback and parser sync

Prefer the 'Default' preset over the file's current preset when falling
back, since the file's current value may name another custom preset once
the admin has saved one. Honor COMPOSER_VENDOR_DIR in the Rector parser
sync helper and only rewrite its nested metadata after a successful copy.
Cover the no-saved-metadata branch with a dedicated test.

* Stage the Rector parser sync copy before replacing the working tree

Copy into a sibling staging directory and swap it into place only after
a verified copy, keeping a backup to restore from if the rename fails.
Also fix scandir() failure handling in the tree helpers: casting a false
return to array produced a phantom entry that recursed until path limits.

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-10-29 03:48:49 +00:00
..