Skip to content

Commit ae8b7b0

Browse files
authored
Merge pull request #46 from laravel-shift/l12-compatibility
Laravel 12.x Compatibility
2 parents 663b560 + ea518a9 commit ae8b7b0

File tree

10 files changed

+43
-24
lines changed

10 files changed

+43
-24
lines changed

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
- name: Install composer dependencies
2424
run: |
25-
composer require "larastan/larastan:^2.6"
25+
composer require "larastan/larastan:^3.0"
2626
composer update --prefer-dist --no-interaction
2727
2828
- name: Run PHPStan

.github/workflows/run-tests.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@ name: run-tests
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [main]
8+
branches:
9+
- main
810

911
jobs:
1012
test:
1113
runs-on: ${{ matrix.os }}
14+
1215
strategy:
1316
fail-fast: true
1417
matrix:
1518
os: [ubuntu-latest, windows-latest]
16-
php: [8.2, 8.3]
17-
laravel: [10.*, 11.*]
19+
php: [8.2, 8.3, 8.4]
20+
laravel: ['11.*', '12.*']
1821
stability: [prefer-stable]
1922
include:
20-
- laravel: 10.*
21-
testbench: 8.*
2223
- laravel: 11.*
2324
testbench: 9.*
25+
- laravel: 12.*
26+
testbench: 10.*
2427

2528
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2629

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
21
# Envy
2+
33
Automate keeping your environment files in sync.
44

55
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/worksome/envy/run-tests.yml?branch=main)](https://github.com/worksome/envy/actions?query=workflow%3Arun-tests+branch%3Amain)

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
],
1818
"require": {
1919
"php": "^8.2",
20-
"illuminate/contracts": "^10.0 || ^11.0",
20+
"illuminate/contracts": "^11.0 || ^12.0",
2121
"nikic/php-parser": "^4.19.1 || ^5.0.2",
2222
"nunomaduro/termwind": "^1.15 || ^2.0",
2323
"spatie/laravel-package-tools": "^1.16",
24-
"thecodingmachine/safe": "^2.4 || ^3.0"
24+
"thecodingmachine/safe": "^2.5 || ^3.0"
2525
},
2626
"require-dev": {
27-
"nunomaduro/collision": "^7.0 || ^8.1",
28-
"larastan/larastan": "^2.6",
29-
"orchestra/testbench": "^8.0 || ^9.0",
30-
"pestphp/pest": "^2.33",
31-
"pestphp/pest-plugin-laravel": "^2.2",
32-
"worksome/coding-style": "^2.8"
27+
"nunomaduro/collision": "^8.1",
28+
"larastan/larastan": "^3.0",
29+
"orchestra/testbench": "^9.0 || ^10.0",
30+
"pestphp/pest": "^3.7",
31+
"pestphp/pest-plugin-laravel": "^3.1",
32+
"worksome/coding-style": "^3.1"
3333
},
3434
"autoload": {
3535
"psr-4": {

src/Commands/PruneCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ public function handle(Envy $envy, BladeCompiler $blade): int
6868
*/
6969
private function getPendingPrunes(Envy $envy): Collection
7070
{
71+
/** @var string|null $path */
72+
$path = $this->option('path');
73+
7174
return $envy->pendingPrunes(
7275
$envy->environmentCalls(),
73-
$this->option('path') ? [strval($this->option('path'))] : null
76+
$path ? [strval($path)] : null
7477
);
7578
}
7679

@@ -110,6 +113,7 @@ private function askWhatWeShouldDoNext(bool $configFileHasBeenPublished): string
110113
self::ACTION_CANCEL => true,
111114
])->filter()->keys()->all();
112115

116+
// @phpstan-ignore return.type
113117
return $this->option('force')
114118
? self::ACTION_PRUNE_ENVIRONMENT_FILE
115119
: strval($this->choice(

src/Commands/SyncCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ public function handle(Envy $envy, Repository $config, BladeCompiler $blade): in
7070
*/
7171
private function getPendingPrunes(Envy $envy, Repository $config): Collection
7272
{
73+
/** @var string|null $path */
74+
$path = $this->option('path');
75+
7376
return $envy->pendingUpdates(
7477
$envy->environmentCalls(boolval($config->get('envy.exclude_calls_with_defaults', false))),
75-
$this->option('path') ? [strval($this->option('path'))] : null,
78+
$path ? [strval($path)] : null,
7679
);
7780
}
7881

@@ -114,6 +117,7 @@ private function askWhatWeShouldDoNext(bool $configFileHasBeenPublished): string
114117
self::ACTION_CANCEL => true,
115118
])->filter()->keys()->all();
116119

120+
// @phpstan-ignore return.type
117121
return $this->option('force')
118122
? self::ACTION_ADD_TO_ENVIRONMENT_FILE
119123
: strval($this->choice(

src/Envy.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function environmentCalls(bool $excludeCallsWithDefaults = false): Collec
4040
return collect($this->finder->configFilePaths())
4141
->map(fn (string $path) => ($this->findEnvironmentCalls)($path, $excludeCallsWithDefaults))
4242
->flatten()
43-
// @phpstan-ignore-next-line
4443
->sortBy(fn (EnvironmentCall $call) => $call->getKey());
4544
}
4645

@@ -92,9 +91,7 @@ public function updateExclusionsWithPendingUpdates(Collection $pendingUpdates):
9291
/** @var Collection<int, EnvironmentVariable> $updates */
9392
$updates = $pendingUpdates
9493
->flatten()
95-
// @phpstan-ignore-next-line
9694
->unique(fn (EnvironmentCall $environmentCall) => $environmentCall->getKey())
97-
// @phpstan-ignore-next-line
9895
->map(fn (EnvironmentCall $environmentCall) => new EnvironmentVariable(
9996
$environmentCall->getKey(),
10097
$environmentCall->getDefault() ?? ''
@@ -161,7 +158,6 @@ public function updateInclusionsWithPendingPrunes(Collection $pendingPrunes): vo
161158
/** @var Collection<int, EnvironmentVariable> $environmentVariables */
162159
$environmentVariables = $pendingPrunes
163160
->flatten()
164-
// @phpstan-ignore-next-line
165161
->map(fn (string $key) => new EnvironmentVariable($key, ''));
166162

167163
($this->addEnvironmentVariablesToList)($environmentVariables, AddsEnvironmentVariablesToList::INCLUSIONS);

src/EnvyServiceProvider.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ public function packageRegistered(): void
7777
$this->app->bind(PrunesEnvironmentFile::class, PruneEnvironmentFile::class);
7878
}
7979

80+
/**
81+
* @return array{
82+
* environment_files?: list<string>,
83+
* config_files?: list<string>,
84+
* display_comments?: bool,
85+
* display_location_hints?: bool,
86+
* display_default_values?: bool,
87+
* exclude_calls_with_defaults?: bool,
88+
* exclusions?: list<string>,
89+
* inclusions?: list<string>,
90+
* }
91+
*/
8092
private function config(): array
8193
{
8294
// @phpstan-ignore-next-line

src/Support/PhpParser/AppendEnvironmentVariablesNodeVisitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(private Collection $updates, private string $arrayKe
2121
{
2222
}
2323

24-
public function leaveNode(Node $node)
24+
public function leaveNode(Node $node): Node
2525
{
2626
if (! $node instanceof Node\Expr\Array_) {
2727
return $node;

src/Support/PhpParser/EnvCallNodeVisitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(
3030
private readonly string $filePath,
3131
private readonly bool $excludeVariablesWithDefaults = false,
3232
) {
33-
$this->environmentVariables = collect();
33+
$this->environmentVariables = new Collection();
3434
$this->printer = new Standard();
3535
}
3636

0 commit comments

Comments
 (0)