Skip to content

Commit c9ba568

Browse files
committed
fix conflicts
2 parents 982710a + 58c2053 commit c9ba568

File tree

4 files changed

+281
-1
lines changed

4 files changed

+281
-1
lines changed

src/Illuminate/Database/Query/Builder.php

+42
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,13 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
15171517
$value, $operator, func_num_args() === 2
15181518
);
15191519

1520+
// If the given operator is not found in the list of valid operators we will
1521+
// assume that the developer is just short-cutting the '=' operators and
1522+
// we will set the operators to '=' and set the values appropriately.
1523+
if ($this->invalidOperator($operator)) {
1524+
[$value, $operator] = [$operator, '='];
1525+
}
1526+
15201527
$value = $this->flattenValue($value);
15211528

15221529
if ($value instanceof DateTimeInterface) {
@@ -1558,6 +1565,13 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
15581565
$value, $operator, func_num_args() === 2
15591566
);
15601567

1568+
// If the given operator is not found in the list of valid operators we will
1569+
// assume that the developer is just short-cutting the '=' operators and
1570+
// we will set the operators to '=' and set the values appropriately.
1571+
if ($this->invalidOperator($operator)) {
1572+
[$value, $operator] = [$operator, '='];
1573+
}
1574+
15611575
$value = $this->flattenValue($value);
15621576

15631577
if ($value instanceof DateTimeInterface) {
@@ -1599,6 +1613,13 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
15991613
$value, $operator, func_num_args() === 2
16001614
);
16011615

1616+
// If the given operator is not found in the list of valid operators we will
1617+
// assume that the developer is just short-cutting the '=' operators and
1618+
// we will set the operators to '=' and set the values appropriately.
1619+
if ($this->invalidOperator($operator)) {
1620+
[$value, $operator] = [$operator, '='];
1621+
}
1622+
16021623
$value = $this->flattenValue($value);
16031624

16041625
if ($value instanceof DateTimeInterface) {
@@ -1644,6 +1665,13 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
16441665
$value, $operator, func_num_args() === 2
16451666
);
16461667

1668+
// If the given operator is not found in the list of valid operators we will
1669+
// assume that the developer is just short-cutting the '=' operators and
1670+
// we will set the operators to '=' and set the values appropriately.
1671+
if ($this->invalidOperator($operator)) {
1672+
[$value, $operator] = [$operator, '='];
1673+
}
1674+
16471675
$value = $this->flattenValue($value);
16481676

16491677
if ($value instanceof DateTimeInterface) {
@@ -1689,6 +1717,13 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and')
16891717
$value, $operator, func_num_args() === 2
16901718
);
16911719

1720+
// If the given operator is not found in the list of valid operators we will
1721+
// assume that the developer is just short-cutting the '=' operators and
1722+
// we will set the operators to '=' and set the values appropriately.
1723+
if ($this->invalidOperator($operator)) {
1724+
[$value, $operator] = [$operator, '='];
1725+
}
1726+
16921727
$value = $this->flattenValue($value);
16931728

16941729
if ($value instanceof DateTimeInterface) {
@@ -2114,6 +2149,13 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a
21142149
$value, $operator, func_num_args() === 2
21152150
);
21162151

2152+
// If the given operator is not found in the list of valid operators we will
2153+
// assume that the developer is just short-cutting the '=' operators and
2154+
// we will set the operators to '=' and set the values appropriately.
2155+
if ($this->invalidOperator($operator)) {
2156+
[$value, $operator] = [$operator, '='];
2157+
}
2158+
21172159
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
21182160

21192161
if (! $value instanceof ExpressionContract) {

src/Illuminate/Foundation/EnvironmentDetector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function getEnvironmentArgument(array $args)
6565
return $args[$i + 1] ?? null;
6666
}
6767

68-
if (str_starts_with($value, '--env')) {
68+
if (str_starts_with($value, '--env=')) {
6969
return head(array_slice(explode('=', $value), 1));
7070
}
7171
}

tests/Foundation/FoundationEnvironmentDetectorTest.php

+30
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,34 @@ public function testConsoleEnvironmentDetectionWithNoValue()
4646
}, ['--env']);
4747
$this->assertSame('foobar', $result);
4848
}
49+
50+
public function testConsoleEnvironmentDetectionDoesNotUseArgumentThatStartsWithEnv()
51+
{
52+
$env = new EnvironmentDetector;
53+
54+
$result = $env->detect(function () {
55+
return 'foobar';
56+
}, ['--envelope=mail']);
57+
$this->assertSame('foobar', $result);
58+
}
59+
60+
public function testConsoleEnvironmentDetectionDoesNotUseArgumentThatStartsWithEnvSeparatedWithSpace()
61+
{
62+
$env = new EnvironmentDetector;
63+
64+
$result = $env->detect(function () {
65+
return 'foobar';
66+
}, ['--envelope', 'mail']);
67+
$this->assertSame('foobar', $result);
68+
}
69+
70+
public function testConsoleEnvironmentDetectionDoesNotUseArgumentThatStartsWithEnvWithNoValue()
71+
{
72+
$env = new EnvironmentDetector;
73+
74+
$result = $env->detect(function () {
75+
return 'foobar';
76+
}, ['--envelope']);
77+
$this->assertSame('foobar', $result);
78+
}
4979
}

0 commit comments

Comments
 (0)