Skip to content

Commit f6297f9

Browse files
committed
fix conflicts
2 parents 3b26bb2 + eb85cd9 commit f6297f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+917
-84
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
## [Unreleased](https://github.com/laravel/framework/compare/v10.0.0..10.x)
44

55

6-
## [v10.0.0 (2023-??-??)](https://github.com/laravel/framework/compare/v10.0.0...10.x)
6+
## [v10.0.0 (2023-02-14)](https://github.com/laravel/framework/compare/v10.0.0...10.x)
77

8-
Check the upgrade guide in the [Official Laravel Upgrade Documentation](https://laravel.com/docs/10.x/upgrade). Also you can see some release notes in the [Official Laravel Release Documentation](https://laravel.com/docs/10.x/releases).
8+
Please consult the [upgrade guide](https://laravel.com/docs/10.x/upgrade) and [release notes](https://laravel.com/docs/10.x/releases) in the official Laravel documentation.

src/Illuminate/Cache/FileLock.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Illuminate\Cache;
4+
5+
class FileLock extends CacheLock
6+
{
7+
/**
8+
* Attempt to acquire the lock.
9+
*
10+
* @return bool
11+
*/
12+
public function acquire()
13+
{
14+
return $this->store->add($this->name, $this->owner, $this->seconds);
15+
}
16+
}

src/Illuminate/Cache/FileStore.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class FileStore implements Store, LockProvider
1414
{
15-
use InteractsWithTime, HasCacheLock, RetrievesMultipleKeys;
15+
use InteractsWithTime, RetrievesMultipleKeys;
1616

1717
/**
1818
* The Illuminate Filesystem instance.
@@ -200,6 +200,31 @@ public function forever($key, $value)
200200
return $this->put($key, $value, 0);
201201
}
202202

203+
/**
204+
* Get a lock instance.
205+
*
206+
* @param string $name
207+
* @param int $seconds
208+
* @param string|null $owner
209+
* @return \Illuminate\Contracts\Cache\Lock
210+
*/
211+
public function lock($name, $seconds = 0, $owner = null)
212+
{
213+
return new FileLock($this, $name, $seconds, $owner);
214+
}
215+
216+
/**
217+
* Restore a lock instance using the owner identifier.
218+
*
219+
* @param string $name
220+
* @param string $owner
221+
* @return \Illuminate\Contracts\Cache\Lock
222+
*/
223+
public function restoreLock($name, $owner)
224+
{
225+
return $this->lock($name, 0, $owner);
226+
}
227+
203228
/**
204229
* Remove an item from the cache.
205230
*

src/Illuminate/Cache/Repository.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ public function remember($key, $ttl, Closure $callback)
394394
return $value;
395395
}
396396

397-
$this->put($key, $value = $callback(), value($ttl));
397+
$value = $callback();
398+
399+
$this->put($key, $value, value($ttl, $value));
398400

399401
return $value;
400402
}

src/Illuminate/Collections/Arr.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,7 @@ public static function where($array, callable $callback)
836836
*/
837837
public static function whereNotNull($array)
838838
{
839-
return static::where($array, function ($value) {
840-
return ! is_null($value);
841-
});
839+
return static::where($array, fn ($value) => ! is_null($value));
842840
}
843841

844842
/**

src/Illuminate/Collections/Collection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ public function avg($callback = null)
8484
{
8585
$callback = $this->valueRetriever($callback);
8686

87-
$items = $this->map(fn ($value) => $callback($value))
88-
->filter(fn ($value) => ! is_null($value));
87+
$items = $this
88+
->map(fn ($value) => $callback($value))
89+
->filter(fn ($value) => ! is_null($value));
8990

9091
if ($count = $items->count()) {
9192
return $items->sum() / $count;

src/Illuminate/Collections/LazyCollection.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,7 @@ public function except($keys)
430430
public function filter(callable $callback = null)
431431
{
432432
if (is_null($callback)) {
433-
$callback = function ($value) {
434-
return (bool) $value;
435-
};
433+
$callback = fn ($value) => (bool) $value;
436434
}
437435

438436
return new static(function () use ($callback) {
@@ -1500,9 +1498,7 @@ public function takeWhile($value)
15001498
/** @var callable(TValue, TKey): bool $callback */
15011499
$callback = $this->useAsCallable($value) ? $value : $this->equality($value);
15021500

1503-
return $this->takeUntil(function ($item, $key) use ($callback) {
1504-
return ! $callback($item, $key);
1505-
});
1501+
return $this->takeUntil(fn ($item, $key) => ! $callback($item, $key));
15061502
}
15071503

15081504
/**

src/Illuminate/Console/GeneratorCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ abstract class GeneratorCommand extends Command implements PromptsForMissingInpu
9292
'require',
9393
'require_once',
9494
'return',
95+
'self',
9596
'static',
9697
'switch',
9798
'throw',

src/Illuminate/Console/Scheduling/CacheEventMutex.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Console\Scheduling;
44

55
use Illuminate\Contracts\Cache\Factory as Cache;
6+
use Illuminate\Contracts\Cache\LockProvider;
67

78
class CacheEventMutex implements EventMutex, CacheAware
89
{
@@ -39,6 +40,12 @@ public function __construct(Cache $cache)
3940
*/
4041
public function create(Event $event)
4142
{
43+
if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
44+
return $this->cache->store($this->store)->getStore()
45+
->lock($event->mutexName(), $event->expiresAt * 60)
46+
->acquire();
47+
}
48+
4249
return $this->cache->store($this->store)->add(
4350
$event->mutexName(), true, $event->expiresAt * 60
4451
);
@@ -52,6 +59,12 @@ public function create(Event $event)
5259
*/
5360
public function exists(Event $event)
5461
{
62+
if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
63+
return ! $this->cache->store($this->store)->getStore()
64+
->lock($event->mutexName(), $event->expiresAt * 60)
65+
->get(fn () => true);
66+
}
67+
5568
return $this->cache->store($this->store)->has($event->mutexName());
5669
}
5770

@@ -63,6 +76,14 @@ public function exists(Event $event)
6376
*/
6477
public function forget(Event $event)
6578
{
79+
if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
80+
$this->cache->store($this->store)->getStore()
81+
->lock($event->mutexName(), $event->expiresAt * 60)
82+
->forceRelease();
83+
84+
return;
85+
}
86+
6687
$this->cache->store($this->store)->forget($event->mutexName());
6788
}
6889

src/Illuminate/Console/Scheduling/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Event
8080
public $onOneServer = false;
8181

8282
/**
83-
* The amount of time the mutex should be valid.
83+
* The number of minutes the mutex should be valid.
8484
*
8585
* @var int
8686
*/

0 commit comments

Comments
 (0)