Skip to content

Commit 5073eff

Browse files
Merge pull request #188 from TheDragonCode/6.x
Renamed `withinEnvironment` with `shouldBeEnvironment`
2 parents 2f30933 + 464a224 commit 5073eff

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/Operation.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ abstract class Operation
2222
/**
2323
* Determines which environment to run on.
2424
*
25-
* @deprecated Will be removed in 7.x version. Use `withinEnvironment` method instead.
25+
* @deprecated Will be removed in 7.x version. Use `shouldEnvironment` method instead.
2626
*/
2727
protected array|string|null $environment = null;
2828

2929
/**
3030
* Determines in which environment it should not run.
3131
*
32-
* @deprecated Will be removed in 7.x version. Use `exceptEnvironment` method instead.
32+
* @deprecated Will be removed in 7.x version. Use `shouldEnvironment` method instead.
3333
*/
3434
protected array|string|null $exceptEnvironment = null;
3535

@@ -103,30 +103,30 @@ public function transactionAttempts(): int
103103
/**
104104
* Determines which environment to run on.
105105
*
106-
* @deprecated Will be removed in 7.x version. Use `withinEnvironment` method instead.
106+
* @deprecated Will be removed in 7.x version. Use `shouldEnvironment` method instead.
107107
*/
108108
public function onEnvironment(): array
109109
{
110110
return Arr::wrap($this->environment);
111111
}
112112

113-
public function withinEnvironment(): bool
114-
{
115-
$env = $this->onEnvironment();
116-
117-
return empty($env) || in_array(app()->environment(), $env, true);
118-
}
119-
120113
/**
121114
* Determines in which environment it should not run.
122115
*
123-
* @deprecated Since with version 7.0 will return `bool`.
116+
* @deprecated Will be removed in 7.x version. Use `shouldEnvironment` method instead.
124117
*/
125118
public function exceptEnvironment(): array
126119
{
127120
return Arr::wrap($this->exceptEnvironment);
128121
}
129122

123+
public function shouldBeEnvironment(): bool
124+
{
125+
$env = $this->onEnvironment();
126+
127+
return empty($env) || in_array(app()->environment(), $env, true);
128+
}
129+
130130
/**
131131
* Determines whether the given operation can be called conditionally.
132132
*

src/Services/Migrator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected function allowEnvironment(Operation $operation): bool
151151
$env = $this->config->environment();
152152

153153
return $operation->shouldRun()
154-
&& $operation->withinEnvironment()
154+
&& $operation->shouldBeEnvironment()
155155
&& $this->exceptEnvironment($env, $operation->exceptEnvironment());
156156
}
157157

0 commit comments

Comments
 (0)