Fix PHPDoc placement before PHP 8 class attributes and add regression tests (#1769)

* Initial plan

* Add tests for PHP class attribute placement and fix whitespace in regex

Co-authored-by: barryvdh <[email protected]>

* Add advanced edge case tests: final+nested-brackets and multiple attributes

Co-authored-by: barryvdh <[email protected]>

* Add PHP 8.5 test for closures inside attribute arguments

Co-authored-by: barryvdh <[email protected]>

* composer fix-style

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: barryvdh <[email protected]>
Co-authored-by: laravel-ide-helper <[email protected]>
This commit is contained in:
Copilot
2026-03-04 12:00:42 +01:00
committed by GitHub
co-authored by barryvdh copilot-swe-agent[bot] <198982749+[email protected]> laravel-ide-helper
parent 39bcb60b7c
commit 2fba281b14
10 changed files with 195 additions and 1 deletions
+1 -1
View File
@@ -1206,7 +1206,7 @@ class ModelsCommand extends Command
// declaration, insert the docblock before the first attribute so that
// the resulting order is: docblock → attributes → class.
$before = substr($contents, 0, $pos);
if (preg_match('/(\s*(?:#\[.+?\]\s*)+)$/s', $before, $matches)) {
if (preg_match('/((?:#\[.+?\]\s*)+)$/s', $before, $matches)) {
$pos -= strlen($matches[1]);
$replace = "{$modelDocComment}\n";
}