Skip to content

Commit

Permalink
Merge branch '8.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Jan 30, 2021
2 parents c848d93 + f0e1d78 commit 8076d86
Show file tree
Hide file tree
Showing 41 changed files with 203 additions and 54 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Auth/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ protected function attemptBasic(Request $request, $field, $extraConditions = [])
}

/**
* Get the credential array for a HTTP Basic request.
* Get the credential array for an HTTP Basic request.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param string $field
Expand Down
36 changes: 34 additions & 2 deletions src/Illuminate/Bus/DatabaseBatchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Closure;
use DateTimeInterface;
use Illuminate\Database\Connection;
use Illuminate\Database\PostgresConnection;
use Illuminate\Database\Query\Expression;
use Illuminate\Support\Str;

Expand Down Expand Up @@ -102,7 +103,7 @@ public function store(PendingBatch $batch)
'pending_jobs' => 0,
'failed_jobs' => 0,
'failed_job_ids' => '[]',
'options' => serialize($batch->options),
'options' => $this->serialize($batch->options),
'created_at' => time(),
'cancelled_at' => null,
'finished_at' => null,
Expand Down Expand Up @@ -267,6 +268,37 @@ public function transaction(Closure $callback)
});
}

/**
* Serialize the given value.
*
* @param mixed $value
* @return string
*/
protected function serialize($value)
{
$serialized = serialize($value);

return $this->connection instanceof PostgresConnection
? base64_encode($serialized)
: $serialized;
}

/**
* Unserialize the given value.
*
* @param string $serialized
* @return mixed
*/
protected function unserialize($serialized)
{
if ($this->connection instanceof PostgresConnection &&
! Str::contains($serialized, [':', ';'])) {
$serialized = base64_decode($serialized);
}

return unserialize($serialized);
}

/**
* Convert the given raw batch to a Batch object.
*
Expand All @@ -283,7 +315,7 @@ protected function toBatch($batch)
(int) $batch->pending_jobs,
(int) $batch->failed_jobs,
json_decode($batch->failed_job_ids, true),
unserialize($batch->options),
$this->unserialize($batch->options),
CarbonImmutable::createFromTimestamp($batch->created_at),
$batch->cancelled_at ? CarbonImmutable::createFromTimestamp($batch->cancelled_at) : $batch->cancelled_at,
$batch->finished_at ? CarbonImmutable::createFromTimestamp($batch->finished_at) : $batch->finished_at
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Bus/UpdatedBatchJobCounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(int $pendingJobs = 0, int $failedJobs = 0)
}

/**
* Determine if all jobs have ran exactly once.
* Determine if all jobs have run exactly once.
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Collections/LazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ public function intersectByKeys($items)
}

/**
* Determine if the items is empty or not.
* Determine if the items are empty or not.
*
* @return bool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function make(array $attributes = [])
}

/**
* Create and return an un-saved instances of the related models.
* Create and return an un-saved instance of the related models.
*
* @param iterable $records
* @return \Illuminate\Database\Eloquent\Collection
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Relations/MorphTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function morphWithCount(array $withCount)
}

/**
* Specify constraints on the query for a given morph types.
* Specify constraints on the query for a given morph type.
*
* @param array $callbacks
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/PDO/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function commit()
}

/**
* Roll back a database transaction.
* Rollback a database transaction.
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/PDO/SqlServerConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function commit()
}

/**
* Roll back a database transaction.
* Rollback a database transaction.
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class Builder
];

/**
* Whether use write pdo for select.
* Whether to use write pdo for the select.
*
* @var bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ protected function dateBasedWhere($type, Builder $query, $where)
}

/**
* Compile a where clause comparing two columns..
* Compile a where clause comparing two columns.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $where
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ public function getChangedColumns()
}

/**
* Determine if the blueprint has auto increment columns.
* Determine if the blueprint has auto-increment columns.
*
* @return bool
*/
Expand All @@ -1619,7 +1619,7 @@ public function hasAutoIncrementColumn()
}

/**
* Get the auto increment column starting values.
* Get the auto-increment column starting values.
*
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function compileAdd(Blueprint $blueprint, Fluent $command)
}

/**
* Compile the auto incrementing column starting values.
* Compile the auto-incrementing column starting values.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
* @return array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function compileAdd(Blueprint $blueprint, Fluent $command)
}

/**
* Compile the auto incrementing column starting values.
* Compile the auto-incrementing column starting values.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
* @return array
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/SqlServerConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function transaction(Closure $callback, $attempts = 1)
$this->getPdo()->exec('COMMIT TRAN');
}

// If we catch an exception, we will roll back so nothing gets messed
// If we catch an exception, we will rollback so nothing gets messed
// up in the database. Then we'll re-throw the exception so it can
// be handled how the developer sees fit for their applications.
catch (Throwable $e) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Hashing/ArgonHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ protected function time(array $options)
}

/**
* Extract the threads value from the options array.
* Extract the thread's value from the options array.
*
* @param array $options
* @return int
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Client/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function assertSent($callback)
}

/**
* Assert that the given request were sent in the given order.
* Assert that the given request was sent in the given order.
*
* @param array $callbacks
* @return void
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function routeIs(...$patterns)
}

/**
* Determine if the current request URL and query string matches a pattern.
* Determine if the current request URL and query string match a pattern.
*
* @param mixed ...$patterns
* @return bool
Expand Down Expand Up @@ -241,7 +241,7 @@ public function ajax()
}

/**
* Determine if the request is the result of an PJAX call.
* Determine if the request is the result of a PJAX call.
*
* @return bool
*/
Expand All @@ -251,7 +251,7 @@ public function pjax()
}

/**
* Determine if the request is the result of an prefetch call.
* Determine if the request is the result of a prefetch call.
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Mail/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function bcc($address, $name = null, $override = false)
}

/**
* Add a reply to address to the message.
* Add a "reply to" address to the message.
*
* @param string|array $address
* @param string|null $name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct($connection, $name)
}

/**
* Set the maximum number of locks that can obtained per time window.
* Set the maximum number of locks that can be obtained per time window.
*
* @param int $maxLocks
* @return $this
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Redis/Limiters/DurationLimiterBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DurationLimiterBuilder
public $name;

/**
* The maximum number of locks that can obtained per time window.
* The maximum number of locks that can be obtained per time window.
*
* @var int
*/
Expand Down Expand Up @@ -58,7 +58,7 @@ public function __construct($connection, $name)
}

/**
* Set the maximum number of locks that can obtained per time window.
* Set the maximum number of locks that can be obtained per time window.
*
* @param int $maxLocks
* @return $this
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/RouteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected static function makeInvokable($action)
}

/**
* Determine if the given array actions contains a serialized Closure.
* Determine if the given array actions contain a serialized Closure.
*
* @param array $action
* @return bool
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/ConfigurationUrlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ protected function parseStringsToNativeTypes($value)
}

/**
* Get all of the current drivers aliases.
* Get all of the current drivers' aliases.
*
* @return array
*/
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Support/Facades/Bus.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* @method static bool|mixed getCommandHandler($command)
* @method static mixed dispatch($command)
* @method static mixed dispatchNow($command, $handler = null)
* @method static void assertDispatched(string $command, callable|int $callback = null)
* @method static void assertDispatched(string|\Closure $command, callable|int $callback = null)
* @method static void assertDispatchedTimes(string $command, int $times = 1)
* @method static void assertNotDispatched(string $command, callable $callback = null)
* @method static void assertDispatchedAfterResponse(string $command, callable|int $callback = null)
* @method static void assertNotDispatched(string|\Closure $command, callable|int $callback = null)
* @method static void assertDispatchedAfterResponse(string|\Closure $command, callable|int $callback = null)
* @method static void assertDispatchedAfterResponseTimes(string $command, int $times = 1)
* @method static void assertNotDispatchedAfterResponse(string $command, callable $callback = null)
* @method static void assertNotDispatchedAfterResponse(string|\Closure $command, callable $callback = null)
* @method static void assertBatched(callable $callback)
*
* @see \Illuminate\Contracts\Bus\Dispatcher
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Facades/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* @method static array|null dispatch(string|object $event, mixed $payload = [], bool $halt = false)
* @method static array|null until(string|object $event, mixed $payload = [])
* @method static bool hasListeners(string $eventName)
* @method static void assertDispatched(string $event, callable|int $callback = null)
* @method static void assertDispatched(string|\Closure $event, callable|int $callback = null)
* @method static void assertDispatchedTimes(string $event, int $times = 1)
* @method static void assertNotDispatched(string $event, callable|int $callback = null)
* @method static void assertNotDispatched(string|\Closure $event, callable|int $callback = null)
* @method static void flush(string $event)
* @method static void forget(string $event)
* @method static void forgetPushed()
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Facades/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* @method static void assertNotSent(string $mailable, callable|int $callback = null)
* @method static void assertNothingQueued()
* @method static void assertNothingSent()
* @method static void assertQueued(string $mailable, callable|int $callback = null)
* @method static void assertSent(string $mailable, callable|int $callback = null)
* @method static void assertQueued(string|\Closure $mailable, callable|int $callback = null)
* @method static void assertSent(string|\Closure $mailable, callable|int $callback = null)
* @method static void raw(string $text, $callback)
* @method static void plain(string $view, array $data, $callback)
* @method static void html(string $html, $callback)
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Support/Facades/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
* @method static \Illuminate\Support\Collection sent(mixed $notifiable, string $notification, callable $callback = null)
* @method static bool hasSent(mixed $notifiable, string $notification)
* @method static mixed channel(string|null $name = null)
* @method static void assertNotSentTo(mixed $notifiable, string $notification, callable $callback = null)
* @method static void assertNotSentTo(mixed $notifiable, string|\Closure $notification, callable $callback = null)
* @method static void assertNothingSent()
* @method static void assertSentTo(mixed $notifiable, string $notification, callable $callback = null)
* @method static void assertSentTo(mixed $notifiable, string|\Closure $notification, callable $callback = null)
* @method static void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)
* @method static void assertTimesSent(int $expectedCount, string $notification)
* @method static void send(\Illuminate\Support\Collection|array|mixed $notifiables, $notification)
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Support/Facades/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
* @method static mixed pushOn(string $queue, string|object $job, mixed $data = '')
* @method static mixed pushRaw(string $payload, string $queue = null, array $options = [])
* @method static string getConnectionName()
* @method static void assertNotPushed(string $job, callable $callback = null)
* @method static void assertNotPushed(string|\Closure $job, callable $callback = null)
* @method static void assertNothingPushed()
* @method static void assertPushed(string $job, callable|int $callback = null)
* @method static void assertPushedOn(string $queue, string $job, callable|int $callback = null)
* @method static void assertPushed(string|\Closure $job, callable|int $callback = null)
* @method static void assertPushedOn(string $queue, string|\Closure $job, callable|int $callback = null)
* @method static void assertPushedWithChain(string $job, array $expectedChain = [], callable $callback = null)
* @method static void popUsing(string $workerName, callable $callback)
*
Expand Down
15 changes: 15 additions & 0 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Support;

use Illuminate\Support\Traits\Macroable;
use League\CommonMark\GithubFlavoredMarkdownConverter;
use Ramsey\Uuid\Codec\TimestampFirstCombCodec;
use Ramsey\Uuid\Generator\CombGenerator;
use Ramsey\Uuid\Uuid;
Expand Down Expand Up @@ -376,6 +377,20 @@ public static function words($value, $words = 100, $end = '...')
return rtrim($matches[0]).$end;
}

/**
* Converts GitHub flavored Markdown into HTML.
*
* @param string $string
* @param array $options
* @return string
*/
public static function markdown($string, array $options = [])
{
$converter = new GithubFlavoredMarkdownConverter($options);

return $converter->convertToHtml($string);
}

/**
* Pad both sides of a string with another.
*
Expand Down
Loading

0 comments on commit 8076d86

Please sign in to comment.