Skip to content

Commit c152a97

Browse files
committed
Merge branch '9.x'
2 parents d7cdf5c + 8cf394e commit c152a97

File tree

14 files changed

+230
-56
lines changed

14 files changed

+230
-56
lines changed

.github/workflows/facades.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: facades
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- '*.x'
8+
9+
jobs:
10+
update:
11+
runs-on: ubuntu-22.04
12+
13+
strategy:
14+
fail-fast: true
15+
16+
name: Facade DocBlocks
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: 8.1
26+
tools: composer:v2
27+
coverage: none
28+
29+
- name: Install dependencies
30+
uses: nick-fields/retry@v2
31+
with:
32+
timeout_minutes: 5
33+
max_attempts: 5
34+
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
35+
36+
- name: Update facade docblocks
37+
run: php -f bin/facades.php
38+
39+
- name: Commit facade docblocks
40+
uses: stefanzweifel/git-auto-commit-action@v4
41+
with:
42+
commit_message: Update facade docblocks
43+
file_pattern: src/

.github/workflows/static-analysis.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,3 @@ jobs:
3838

3939
- name: Execute type checking
4040
run: vendor/bin/phpstan --configuration="phpstan.${{ matrix.directory }}.neon.dist"
41-
42-
facades:
43-
runs-on: ubuntu-22.04
44-
45-
strategy:
46-
fail-fast: true
47-
48-
name: Facade DocBlocks
49-
50-
if: ${{ github.repository_owner == 'laravel' && github.event_name == 'push' }}
51-
52-
steps:
53-
- name: Checkout code
54-
uses: actions/checkout@v3
55-
56-
- name: Setup PHP
57-
uses: shivammathur/setup-php@v2
58-
with:
59-
php-version: 8.1
60-
tools: composer:v2
61-
coverage: none
62-
63-
- name: Install dependencies
64-
uses: nick-fields/retry@v2
65-
with:
66-
timeout_minutes: 5
67-
max_attempts: 5
68-
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
69-
70-
- name: Update facade docblocks
71-
run: php -f bin/facades.php
72-
73-
- name: Commit facade docblocks
74-
uses: stefanzweifel/git-auto-commit-action@v4
75-
with:
76-
commit_message: Update facade docblocks
77-
file_pattern: src/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ composer.lock
55
Thumbs.db
66
/phpunit.xml
77
/.idea
8+
/.fleet
89
/.vscode
910
.phpunit.result.cache

src/Illuminate/Collections/Arr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public static function query($array)
615615
*
616616
* @param array $array
617617
* @param int|null $number
618-
* @param bool|false $preserveKeys
618+
* @param bool $preserveKeys
619619
* @return mixed
620620
*
621621
* @throws \InvalidArgumentException

src/Illuminate/Foundation/Console/ServeCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class ServeCommand extends Command
5757
public static $passthroughVariables = [
5858
'APP_ENV',
5959
'LARAVEL_SAIL',
60+
'PATH',
6061
'PHP_CLI_SERVER_WORKERS',
6162
'PHP_IDE_CONFIG',
6263
'SYSTEMROOT',

src/Illuminate/Foundation/Vite.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,10 @@ public function __invoke($entrypoints, $buildDirectory = null)
338338
}
339339
}
340340

341-
[$stylesheets, $scripts] = $tags->partition(fn ($tag) => str_starts_with($tag, '<link'));
341+
[$stylesheets, $scripts] = $tags->unique()->partition(fn ($tag) => str_starts_with($tag, '<link'));
342342

343-
$preloads = $preloads->sortByDesc(fn ($args) => $this->isCssPath($args[1]))
343+
$preloads = $preloads->unique()
344+
->sortByDesc(fn ($args) => $this->isCssPath($args[1]))
344345
->map(fn ($args) => $this->makePreloadTagForChunk(...$args));
345346

346347
return new HtmlString($preloads->join('').$stylesheets->join('').$scripts->join(''));

src/Illuminate/Http/Client/PendingRequest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ public function dd()
669669
*
670670
* @param string $url
671671
* @param array|string|null $query
672-
* @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
672+
* @return \Illuminate\Http\Client\Response
673673
*/
674674
public function get(string $url, $query = null)
675675
{
@@ -683,7 +683,7 @@ public function get(string $url, $query = null)
683683
*
684684
* @param string $url
685685
* @param array|string|null $query
686-
* @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
686+
* @return \Illuminate\Http\Client\Response
687687
*/
688688
public function head(string $url, $query = null)
689689
{
@@ -697,7 +697,7 @@ public function head(string $url, $query = null)
697697
*
698698
* @param string $url
699699
* @param array $data
700-
* @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
700+
* @return \Illuminate\Http\Client\Response
701701
*/
702702
public function post(string $url, $data = [])
703703
{
@@ -711,7 +711,7 @@ public function post(string $url, $data = [])
711711
*
712712
* @param string $url
713713
* @param array $data
714-
* @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
714+
* @return \Illuminate\Http\Client\Response
715715
*/
716716
public function patch($url, $data = [])
717717
{
@@ -725,7 +725,7 @@ public function patch($url, $data = [])
725725
*
726726
* @param string $url
727727
* @param array $data
728-
* @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
728+
* @return \Illuminate\Http\Client\Response
729729
*/
730730
public function put($url, $data = [])
731731
{
@@ -739,7 +739,7 @@ public function put($url, $data = [])
739739
*
740740
* @param string $url
741741
* @param array $data
742-
* @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
742+
* @return \Illuminate\Http\Client\Response
743743
*/
744744
public function delete($url, $data = [])
745745
{
@@ -773,7 +773,7 @@ public function pool(callable $callback)
773773
* @param string $method
774774
* @param string $url
775775
* @param array $options
776-
* @return \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface
776+
* @return \Illuminate\Http\Client\Response
777777
*
778778
* @throws \Exception
779779
*/

src/Illuminate/Http/Resources/ConditionallyLoadsAttributes.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,29 @@ protected function attributes($attributes)
157157
);
158158
}
159159

160+
/**
161+
* Retrieve an attribute if it exists on the resource.
162+
*
163+
* @param string $attribute
164+
* @param mixed $value
165+
* @param mixed $default
166+
* @return \Illuminate\Http\Resources\MissingValue|mixed
167+
*/
168+
public function whenHas($attribute, $value = null, $default = null)
169+
{
170+
if (func_num_args() < 3) {
171+
$default = new MissingValue;
172+
}
173+
174+
if (! array_key_exists($attribute, $this->resource->getAttributes())) {
175+
return value($default);
176+
}
177+
178+
return func_num_args() === 1
179+
? $this->resource->{$attribute}
180+
: value($value, $this->resource->{$attribute});
181+
}
182+
160183
/**
161184
* Retrieve a model attribute if it is null.
162185
*
@@ -242,7 +265,7 @@ protected function whenLoaded($relationship, $value = null, $default = null)
242265
public function whenCounted($relationship, $value = null, $default = null)
243266
{
244267
if (func_num_args() < 3) {
245-
$default = new MissingValue();
268+
$default = new MissingValue;
246269
}
247270

248271
$attribute = (string) Str::of($relationship)->snake()->finish('_count');

src/Illuminate/Support/Facades/Http.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
* @method static \Illuminate\Http\Client\PendingRequest throwUnless(bool $condition)
5454
* @method static \Illuminate\Http\Client\PendingRequest dump()
5555
* @method static \Illuminate\Http\Client\PendingRequest dd()
56-
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface get(string $url, array|string|null $query = null)
57-
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface head(string $url, array|string|null $query = null)
58-
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface post(string $url, array $data = [])
59-
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface patch(string $url, array $data = [])
60-
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface put(string $url, array $data = [])
61-
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface delete(string $url, array $data = [])
56+
* @method static \Illuminate\Http\Client\Response get(string $url, array|string|null $query = null)
57+
* @method static \Illuminate\Http\Client\Response head(string $url, array|string|null $query = null)
58+
* @method static \Illuminate\Http\Client\Response post(string $url, array $data = [])
59+
* @method static \Illuminate\Http\Client\Response patch(string $url, array $data = [])
60+
* @method static \Illuminate\Http\Client\Response put(string $url, array $data = [])
61+
* @method static \Illuminate\Http\Client\Response delete(string $url, array $data = [])
6262
* @method static array pool(callable $callback)
63-
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface send(string $method, string $url, array $options = [])
63+
* @method static \Illuminate\Http\Client\Response send(string $method, string $url, array $options = [])
6464
* @method static \GuzzleHttp\Client buildClient()
6565
* @method static \GuzzleHttp\Client createClient(\GuzzleHttp\HandlerStack $handlerStack)
6666
* @method static \GuzzleHttp\HandlerStack buildHandlerStack()

src/Illuminate/Validation/Concerns/ValidatesAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ public function validateDecimal($attribute, $value, $parameters)
572572

573573
$matches = [];
574574

575-
preg_match('/^\d*.(\d*)$/', $value, $matches);
575+
preg_match('/^[+-]?\d*.(\d*)$/', $value, $matches);
576576

577577
$decimals = strlen(end($matches));
578578

0 commit comments

Comments
 (0)