Skip to content

Commit 31bbc16

Browse files
committed
Release PHP 7.4 downgraded
1 parent 360d68d commit 31bbc16

12 files changed

Lines changed: 121 additions & 34 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
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",

src/Rules/Laravel/EnforceCollationRule.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,35 @@
2424
*/
2525
final 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

src/Rules/Laravel/ForbidAfterRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@
1616
*/
1717
final 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.';

src/Rules/Laravel/ForbidEnumColumnRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@
1616
*/
1717
final class ForbidEnumColumnRule extends LaravelRule
1818
{
19-
private const string RULE_IDENTIFIER = 'laravel.schema.enumColumnForbidden';
19+
/**
20+
* @var string
21+
*/
22+
private const RULE_IDENTIFIER = 'laravel.schema.enumColumnForbidden';
2023

21-
private const string MESSAGE =
24+
/**
25+
* @var string
26+
*/
27+
private const MESSAGE =
2228
'Forbidden: enum column type. '
2329
. 'Why: adding or removing enum values requires a full ALTER TABLE, which can cause long locks on large tables. '
2430
. 'Fix: use a string column with application-level validation instead.';

src/Rules/Laravel/ForbidMultipleTableCreationsRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@
1616
*/
1717
final 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.';

src/Rules/Laravel/ForbidRawSqlRule.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,23 @@
1616
*/
1717
final class ForbidRawSqlRule extends LaravelRule
1818
{
19-
private const string RULE_IDENTIFIER = 'laravel.schema.rawSqlForbidden';
19+
/**
20+
* @var string
21+
*/
22+
private const RULE_IDENTIFIER = 'laravel.schema.rawSqlForbidden';
2023

21-
private const string MESSAGE =
24+
/**
25+
* @var string
26+
*/
27+
private const MESSAGE =
2228
'Forbidden: raw SQL via DB::%s(). '
2329
. 'Why: raw SQL bypasses the schema builder, making migrations harder to review, less portable, and prone to errors. '
2430
. 'Fix: use Laravel schema builder methods instead.';
2531

26-
private const array FORBIDDEN_METHODS = ['statement', 'unprepared'];
32+
/**
33+
* @var mixed[]
34+
*/
35+
private const FORBIDDEN_METHODS = ['statement', 'unprepared'];
2736

2837
public function getNodeType(): string
2938
{

src/Rules/Phinx/EnforceCollationRule.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,35 @@
1717
*/
1818
final 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

src/Rules/Phinx/ForbidAfterRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@
1717
*/
1818
final 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.';

src/Rules/Phinx/ForbidEnumColumnRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@
1616
*/
1717
final class ForbidEnumColumnRule extends PhinxRule
1818
{
19-
private const string RULE_IDENTIFIER = 'phinx.schema.enumColumnForbidden';
19+
/**
20+
* @var string
21+
*/
22+
private const RULE_IDENTIFIER = 'phinx.schema.enumColumnForbidden';
2023

21-
private const string MESSAGE =
24+
/**
25+
* @var string
26+
*/
27+
private const MESSAGE =
2228
'Forbidden: enum column type. '
2329
. 'Why: adding or removing enum values requires a full ALTER TABLE, which can cause long locks on large tables. '
2430
. 'Fix: use a string column with application-level validation instead.';

src/Rules/Phinx/ForbidMultipleTableCreationsRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@
1515
*/
1616
final 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.';

0 commit comments

Comments
 (0)