Skip to content

Commit 3e998a4

Browse files
authored
Merge pull request #348 from tighten/drift/php-83-support
Add support for PHP 8.3
2 parents 4d126aa + 847b69f commit 3e998a4

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu, macos, windows]
15-
php: ["8.1", "8.2"]
15+
php: ["8.1", "8.2", "8.3"]
1616
dependencies: [lowest, stable]
1717
steps:
1818
- uses: actions/checkout@v2

src/Formatters/NoDatesPropertyOnModels.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class NoDatesPropertyOnModels extends BaseFormatter
2525

2626
public const DESCRIPTION = 'Use `$casts` instead of `$dates` on Eloquent models.';
2727

28+
protected bool $model = false;
29+
2830
public function format(Parser $parser, Lexer $lexer): string
2931
{
3032
$traverser = new NodeTraverser;
@@ -65,13 +67,12 @@ public function format(Parser $parser, Lexer $lexer): string
6567
private function nodeFinderForModelProperty(string $attribute): Closure
6668
{
6769
return function (Node $node) use ($attribute) {
68-
static $model = false;
6970

7071
if ($this->extendsAny($node, ['Model', 'Pivot', 'Authenticatable'])) {
71-
$model = true;
72+
$this->model = true;
7273
}
7374

74-
return $model && $node instanceof Property && (string) $node->props[0]->name === $attribute;
75+
return $this->model && $node instanceof Property && (string) $node->props[0]->name === $attribute;
7576
};
7677
}
7778

src/Linters/NoDatesPropertyOnModels.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ class NoDatesPropertyOnModels extends BaseLinter
1414

1515
public const DESCRIPTION = 'The `$dates` property was deprecated in Laravel 8. Use `$casts` instead.';
1616

17+
protected bool $model = false;
18+
1719
protected function visitor(): Closure
1820
{
19-
return function (Node $node) use (&$model) {
20-
static $model = false;
21-
21+
return function (Node $node) {
2222
if ($this->extendsAny($node, ['Model', 'Pivot', 'Authenticatable'])) {
23-
$model = true;
23+
$this->model = true;
2424
}
2525

26-
return $model && $node instanceof Property && (string) $node->props[0]->name === 'dates';
26+
return $this->model && $node instanceof Property && (string) $node->props[0]->name === 'dates';
2727
};
2828
}
2929
}

0 commit comments

Comments
 (0)