Skip to content

Commit

Permalink
Merge branch '10.x'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
driesvints committed Feb 14, 2023
2 parents 0cb3f2f + fbd36fc commit 6a2f603
Show file tree
Hide file tree
Showing 115 changed files with 1,482 additions and 338 deletions.
2 changes: 1 addition & 1 deletion bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ git tag $VERSION
git push origin --tags

# Tag Components
for REMOTE in auth broadcasting bus cache collections conditionable config console container contracts cookie database encryption events filesystem hashing http log macroable mail notifications pagination pipeline queue redis routing session support testing translation validation view
for REMOTE in auth broadcasting bus cache collections conditionable config console container contracts cookie database encryption events filesystem hashing http log macroable mail notifications pagination pipeline process queue redis routing session support testing translation validation view
do
echo ""
echo ""
Expand Down
2 changes: 2 additions & 0 deletions bin/split.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ remote mail [email protected]:illuminate/mail.git
remote notifications [email protected]:illuminate/notifications.git
remote pagination [email protected]:illuminate/pagination.git
remote pipeline [email protected]:illuminate/pipeline.git
remote process [email protected]:illuminate/process.git
remote queue [email protected]:illuminate/queue.git
remote redis [email protected]:illuminate/redis.git
remote routing [email protected]:illuminate/routing.git
Expand Down Expand Up @@ -74,6 +75,7 @@ split 'src/Illuminate/Mail' mail
split 'src/Illuminate/Notifications' notifications
split 'src/Illuminate/Pagination' pagination
split 'src/Illuminate/Pipeline' pipeline
split 'src/Illuminate/Process' process
split 'src/Illuminate/Queue' queue
split 'src/Illuminate/Redis' redis
split 'src/Illuminate/Routing' routing
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"ext-openssl": "*",
"ext-session": "*",
"ext-tokenizer": "*",
"composer-runtime-api": "^2.2",
"brick/math": "^0.9.3|^0.10.2|^0.11",
"doctrine/inflector": "^2.0.5",
"dragonmantank/cron-expression": "^3.3.2",
Expand Down Expand Up @@ -78,6 +79,7 @@
"illuminate/notifications": "self.version",
"illuminate/pagination": "self.version",
"illuminate/pipeline": "self.version",
"illuminate/process": "self.version",
"illuminate/queue": "self.version",
"illuminate/redis": "self.version",
"illuminate/routing": "self.version",
Expand Down Expand Up @@ -105,7 +107,7 @@
"pda/pheanstalk": "^4.0",
"phpstan/phpdoc-parser": "^1.15",
"phpstan/phpstan": "^1.4.7",
"phpunit/phpunit": "^9.6.0 || ^10.0.1",
"phpunit/phpunit": "^9.6.0 || ^10.0.7",
"predis/predis": "^2.0.2",
"symfony/cache": "^6.2",
"symfony/http-client": "^6.2.4"
Expand Down Expand Up @@ -189,6 +191,6 @@
"composer/package-versions-deprecated": true
}
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true
}
16 changes: 16 additions & 0 deletions src/Illuminate/Cache/FileLock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Illuminate\Cache;

class FileLock extends CacheLock
{
/**
* Attempt to acquire the lock.
*
* @return bool
*/
public function acquire()
{
return $this->store->add($this->name, $this->owner, $this->seconds);
}
}
27 changes: 26 additions & 1 deletion src/Illuminate/Cache/FileStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class FileStore implements Store, LockProvider
{
use InteractsWithTime, HasCacheLock, RetrievesMultipleKeys;
use InteractsWithTime, RetrievesMultipleKeys;

/**
* The Illuminate Filesystem instance.
Expand Down Expand Up @@ -200,6 +200,31 @@ public function forever($key, $value)
return $this->put($key, $value, 0);
}

/**
* Get a lock instance.
*
* @param string $name
* @param int $seconds
* @param string|null $owner
* @return \Illuminate\Contracts\Cache\Lock
*/
public function lock($name, $seconds = 0, $owner = null)
{
return new FileLock($this, $name, $seconds, $owner);
}

/**
* Restore a lock instance using the owner identifier.
*
* @param string $name
* @param string $owner
* @return \Illuminate\Contracts\Cache\Lock
*/
public function restoreLock($name, $owner)
{
return $this->lock($name, 0, $owner);
}

/**
* Remove an item from the cache.
*
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Cache/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ public function remember($key, $ttl, Closure $callback)
return $value;
}

$this->put($key, $value = $callback(), value($ttl));
$value = $callback();

$this->put($key, $value, value($ttl, $value));

return $value;
}
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Collections/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,7 @@ public static function where($array, callable $callback)
*/
public static function whereNotNull($array)
{
return static::where($array, function ($value) {
return ! is_null($value);
});
return static::where($array, fn ($value) => ! is_null($value));
}

/**
Expand Down
28 changes: 8 additions & 20 deletions src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ public function avg($callback = null)
{
$callback = $this->valueRetriever($callback);

$items = $this->map(function ($value) use ($callback) {
return $callback($value);
})->filter(function ($value) {
return ! is_null($value);
});
$items = $this
->map(fn ($value) => $callback($value))
->filter(fn ($value) => ! is_null($value));

if ($count = $items->count()) {
return $items->sum() / $count;
Expand Down Expand Up @@ -349,14 +347,10 @@ public function duplicatesStrict($callback = null)
protected function duplicateComparator($strict)
{
if ($strict) {
return function ($a, $b) {
return $a === $b;
};
return fn ($a, $b) => $a === $b;
}

return function ($a, $b) {
return $a == $b;
};
return fn ($a, $b) => $a == $b;
}

/**
Expand Down Expand Up @@ -1151,9 +1145,7 @@ public function sliding($size = 2, $step = 1)
{
$chunks = floor(($this->count() - $size) / $step) + 1;

return static::times($chunks, function ($number) use ($size, $step) {
return $this->slice(($number - 1) * $step, $size);
});
return static::times($chunks, fn ($number) => $this->slice(($number - 1) * $step, $size));
}

/**
Expand Down Expand Up @@ -1634,13 +1626,9 @@ public function values()
*/
public function zip($items)
{
$arrayableItems = array_map(function ($items) {
return $this->getArrayableItems($items);
}, func_get_args());
$arrayableItems = array_map(fn ($items) => $this->getArrayableItems($items), func_get_args());

$params = array_merge([function () {
return new static(func_get_args());
}, $this->items], $arrayableItems);
$params = array_merge([fn () => new static(func_get_args()), $this->items], $arrayableItems);

return new static(array_map(...$params));
}
Expand Down
8 changes: 2 additions & 6 deletions src/Illuminate/Collections/LazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,7 @@ public function except($keys)
public function filter(callable $callback = null)
{
if (is_null($callback)) {
$callback = function ($value) {
return (bool) $value;
};
$callback = fn ($value) => (bool) $value;
}

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

return $this->takeUntil(function ($item, $key) use ($callback) {
return ! $callback($item, $key);
});
return $this->takeUntil(fn ($item, $key) => ! $callback($item, $key));
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Console/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ abstract class GeneratorCommand extends Command implements PromptsForMissingInpu
'require',
'require_once',
'return',
'self',
'static',
'switch',
'throw',
Expand Down
21 changes: 21 additions & 0 deletions src/Illuminate/Console/Scheduling/CacheEventMutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Console\Scheduling;

use Illuminate\Contracts\Cache\Factory as Cache;
use Illuminate\Contracts\Cache\LockProvider;

class CacheEventMutex implements EventMutex, CacheAware
{
Expand Down Expand Up @@ -39,6 +40,12 @@ public function __construct(Cache $cache)
*/
public function create(Event $event)
{
if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
return $this->cache->store($this->store)->getStore()
->lock($event->mutexName(), $event->expiresAt * 60)
->acquire();
}

return $this->cache->store($this->store)->add(
$event->mutexName(), true, $event->expiresAt * 60
);
Expand All @@ -52,6 +59,12 @@ public function create(Event $event)
*/
public function exists(Event $event)
{
if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
return ! $this->cache->store($this->store)->getStore()
->lock($event->mutexName(), $event->expiresAt * 60)
->get(fn () => true);
}

return $this->cache->store($this->store)->has($event->mutexName());
}

Expand All @@ -63,6 +76,14 @@ public function exists(Event $event)
*/
public function forget(Event $event)
{
if ($this->cache->store($this->store)->getStore() instanceof LockProvider) {
$this->cache->store($this->store)->getStore()
->lock($event->mutexName(), $event->expiresAt * 60)
->forceRelease();

return;
}

$this->cache->store($this->store)->forget($event->mutexName());
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Event
public $onOneServer = false;

/**
* The amount of time the mutex should be valid.
* The number of minutes the mutex should be valid.
*
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Contracts/Cookie/QueueingFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface QueueingFactory extends Factory
/**
* Queue a cookie to send with the next response.
*
* @param array ...$parameters
* @param mixed ...$parameters
* @return void
*/
public function queue(...$parameters);
Expand Down
15 changes: 15 additions & 0 deletions src/Illuminate/Contracts/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ public function databasePath($path = '');
*/
public function langPath($path = '');

/**
* Get the path to the public directory.
*
* @param string $path
* @return string
*/
public function publicPath($path = '');

/**
* Get the path to the resources directory.
*
Expand Down Expand Up @@ -91,6 +99,13 @@ public function runningInConsole();
*/
public function runningUnitTests();

/**
* Determine if the application is running with debug mode enabled.
*
* @return bool
*/
public function hasDebugModeEnabled();

/**
* Get an instance of the maintenance mode manager implementation.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Contracts\Console\Process;
namespace Illuminate\Contracts\Process;

interface InvokedProcess
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Illuminate\Contracts\Console\Process;
namespace Illuminate\Contracts\Process;

interface ProcessResult
{
Expand Down Expand Up @@ -28,7 +28,7 @@ public function failed();
/**
* Get the exit code of the process.
*
* @return int
* @return int|null
*/
public function exitCode();

Expand Down
8 changes: 8 additions & 0 deletions src/Illuminate/Contracts/Support/MessageBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ public function get($key, $format = null);
*/
public function all($format = null);

/**
* Remove a message from the bag.
*
* @param string $key
* @return $this
*/
public function forget($key);

/**
* Get the raw messages in the container.
*
Expand Down
6 changes: 5 additions & 1 deletion src/Illuminate/Database/Concerns/ManagesTransactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,11 @@ public function rollBack($toLevel = null)
protected function performRollBack($toLevel)
{
if ($toLevel == 0) {
$this->getPdo()->rollBack();
$pdo = $this->getPdo();

if ($pdo->inTransaction()) {
$pdo->rollBack();
}
} elseif ($this->queryGrammar->supportsSavepoints()) {
$this->getPdo()->exec(
$this->queryGrammar->compileSavepointRollBack('trans'.($toLevel + 1))
Expand Down
Loading

0 comments on commit 6a2f603

Please sign in to comment.