File tree Expand file tree Collapse file tree 7 files changed +71
-20
lines changed
Expand file tree Collapse file tree 7 files changed +71
-20
lines changed Original file line number Diff line number Diff line change 44 "type" : " phpstan-extension" ,
55 "license" : " MIT" ,
66 "require" : {
7- "php" : " ^8.3 "
7+ "php" : " ^7.4 || ^8.0 "
88 },
99 "require-dev" : {
1010 "phpunit/phpunit" : " ^9.5|^10.0" ,
Original file line number Diff line number Diff line change 2424 */
2525final class EnforceCollationRule extends LaravelRule
2626{
27+ /**
28+ * @readonly
29+ */
30+ private string $ requiredCollation ;
2731 // Same identifier as Phinx (as requested)
28- private const string RULE_IDENTIFIER = 'laravel.schema.requiredCollation ' ;
29-
30- private const string MESSAGE_MISSING =
32+ /**
33+ * @var string
34+ */
35+ private const RULE_IDENTIFIER = 'laravel.schema.requiredCollation ' ;
36+
37+ /**
38+ * @var string
39+ */
40+ private const MESSAGE_MISSING =
3141 'Required: table collation must be "%s". '
3242 . 'Why: prevents environment-dependent defaults and keeps schema consistent. '
3343 . 'Fix: set the table collation explicitly in the migration. ' ;
3444
35- private const string MESSAGE_WRONG =
45+ /**
46+ * @var string
47+ */
48+ private const MESSAGE_WRONG =
3649 'Required: table collation must be "%s". Found: "%s". '
3750 . 'Why: prevents environment-dependent defaults and keeps schema consistent. '
3851 . 'Fix: set the table collation explicitly in the migration. ' ;
3952
40- public function __construct (
41- private readonly string $ requiredCollation
42- ) {
53+ public function __construct (string $ requiredCollation )
54+ {
55+ $ this -> requiredCollation = $ requiredCollation ;
4356 }
4457
4558 public function getNodeType (): string
Original file line number Diff line number Diff line change 1616 */
1717final class ForbidAfterRule extends LaravelRule
1818{
19- private const string RULE_IDENTIFIER = 'laravel.schema.afterForbidden ' ;
19+ /**
20+ * @var string
21+ */
22+ private const RULE_IDENTIFIER = 'laravel.schema.afterForbidden ' ;
2023
21- private const string MESSAGE =
24+ /**
25+ * @var string
26+ */
27+ private const MESSAGE =
2228 'Forbidden: column positioning ("after"). '
2329 . 'Why: can trigger a full table rewrite or long locks depending on the engine. '
2430 . 'Fix: avoid column ordering in migrations. ' ;
Original file line number Diff line number Diff line change 1616 */
1717final class ForbidMultipleTableCreationsRule extends LaravelRule
1818{
19- private const string RULE_IDENTIFIER = 'laravel.schema.multipleTableCreationsForbidden ' ;
19+ /**
20+ * @var string
21+ */
22+ private const RULE_IDENTIFIER = 'laravel.schema.multipleTableCreationsForbidden ' ;
2023
21- private const string MESSAGE =
24+ /**
25+ * @var string
26+ */
27+ private const MESSAGE =
2228 'Forbidden: creating multiple tables in a single migration. '
2329 . 'Why: reduces reviewability and rollback safety. '
2430 . 'Fix: split into one migration per table. ' ;
Original file line number Diff line number Diff line change 1717 */
1818final class EnforceCollationRule extends PhinxRule
1919{
20+ /**
21+ * @readonly
22+ */
23+ private string $ requiredCollation ;
2024 // Same identifier as Laravel
21- private const string RULE_IDENTIFIER = 'phinx.schema.requiredCollation ' ;
25+ /**
26+ * @var string
27+ */
28+ private const RULE_IDENTIFIER = 'phinx.schema.requiredCollation ' ;
2229
23- private const string MESSAGE_MISSING =
30+ /**
31+ * @var string
32+ */
33+ private const MESSAGE_MISSING =
2434 'Required: table collation must be "%s". '
2535 . 'Why: prevents environment-dependent defaults and keeps schema consistent. '
2636 . 'Fix: set the table collation explicitly in the migration. ' ;
2737
28- private const string MESSAGE_WRONG =
38+ /**
39+ * @var string
40+ */
41+ private const MESSAGE_WRONG =
2942 'Required: table collation must be "%s". Found: "%s". '
3043 . 'Why: prevents environment-dependent defaults and keeps schema consistent. '
3144 . 'Fix: set the table collation explicitly in the migration. ' ;
3245
33- public function __construct (private readonly string $ requiredCollation )
46+ public function __construct (string $ requiredCollation )
3447 {
48+ $ this ->requiredCollation = $ requiredCollation ;
3549 }
3650
3751 public function getNodeType (): string
Original file line number Diff line number Diff line change 1717 */
1818final class ForbidAfterRule extends PhinxRule
1919{
20- private const string RULE_IDENTIFIER = 'phinx.schema.afterForbidden ' ;
20+ /**
21+ * @var string
22+ */
23+ private const RULE_IDENTIFIER = 'phinx.schema.afterForbidden ' ;
2124
22- private const string MESSAGE =
25+ /**
26+ * @var string
27+ */
28+ private const MESSAGE =
2329 'Forbidden: column positioning ("after"). '
2430 . 'Why: can trigger a full table rewrite or long locks depending on the engine. '
2531 . 'Fix: avoid column ordering in migrations. ' ;
Original file line number Diff line number Diff line change 1515 */
1616final class ForbidMultipleTableCreationsRule extends PhinxRule
1717{
18- private const string RULE_IDENTIFIER = 'phinx.schema.multipleTableCreationsForbidden ' ;
18+ /**
19+ * @var string
20+ */
21+ private const RULE_IDENTIFIER = 'phinx.schema.multipleTableCreationsForbidden ' ;
1922
20- private const string MESSAGE =
23+ /**
24+ * @var string
25+ */
26+ private const MESSAGE =
2127 'Forbidden: creating multiple tables in a single migration. '
2228 . 'Why: reduces reviewability and rollback safety. '
2329 . 'Fix: split into one migration per table. ' ;
You can’t perform that action at this time.
0 commit comments