Skip to content

Commit

Permalink
Support customized local configuration files for PHPStan and PHPUnit …
Browse files Browse the repository at this point in the history
…(#502)

* Support customized local configuration files for PHPStan and PHPUnit

* Optimize

* Fix return type declarations in Kafka and Log facades

* Refactor array and collection mixins

* Update type hint for process method in TaskHandleListener

* Update CacheInterface and Cache class

* Refactor ParameterParser class by removing unused code

* Refactor Etcd and Nacos drivers, and fix EnvWriter return statement

* Fix type hinting in exception handling functions

* Fix column value retrieval in FastPaginate.php

* Refactor validation rules in ValidationAspect.php

* Update helper functions and fix deprecated functions

* Refactor log writer to use null coalescing operator for default values

* Fix code formatting and remove unused code

* Update variable type in ResponseSequence class and fix factory function in Functions.php

* Fix code inconsistencies and improve code readability

* Update phpstan.neon.dist to include phpstan-baseline.neon

This commit updates the phpstan.neon.dist file to include the phpstan-baseline.neon file. The previous include statement for vendor/phpstan/phpstan-deprecation-rules/rules.neon has been commented out. This change ensures that the phpstan-baseline.neon file is included in the analysis performed by vendor/bin/phpstan.

* Update PHPStan configuration file

* Fix isInstanceCall method logic

* Refactor access log message formatting

---------

Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
  • Loading branch information
huangdijia and huangdijia committed Dec 20, 2023
1 parent c0af930 commit 58d2190
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/ArrMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,10 @@ public static function sortDesc()

/**
* Recursively sort an array by keys and values in descending order.
*
* @return array
*/
public function sortRecursiveDesc()
{
return fn ($array, $options = SORT_REGULAR) => $this->sortRecursive($array, $options, true);
return fn ($array, $options = SORT_REGULAR) => $this->sortRecursive($array); // , $options, true
}

public function undot()
Expand Down
6 changes: 3 additions & 3 deletions src/CollectionMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function sortKeysUsing()

public function undot()
{
return fn () => new Collection(Arr::undot($this->all()));
return fn () => new Collection(Arr::undot($this->all())); /* @phpstan-ignore-line */
}

public function value()
Expand All @@ -198,11 +198,11 @@ public function whenNotEmpty()

public function unlessEmpty()
{
return fn (callable $callback, callable $default = null) => $this->whenNotEmpty($callback, $default);
return fn (callable $callback, callable $default = null) => $this->whenNotEmpty($callback, $default); /* @phpstan-ignore-line */
}

public function unlessNotEmpty()
{
return fn (callable $callback, callable $default = null) => $this->whenEmpty($callback, $default);
return fn (callable $callback, callable $default = null) => $this->whenEmpty($callback, $default); /* @phpstan-ignore-line */
}
}
10 changes: 5 additions & 5 deletions src/RequestMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function filled()
$keys = is_array($key) ? $key : func_get_args();

foreach ($keys as $value) {
if ($this->isEmptyString($value)) {
if ($this->isEmptyString($value)) { /* @phpstan-ignore-line */
return false;
}
}
Expand Down Expand Up @@ -221,7 +221,7 @@ public function isNotFilled()
$keys = is_array($key) ? $key : func_get_args();

foreach ($keys as $value) {
if (! $this->isEmptyString($value)) {
if (! $this->isEmptyString($value)) { /* @phpstan-ignore-line */
return false;
}
}
Expand All @@ -247,7 +247,7 @@ public function merge()

public function mergeIfMissing()
{
return fn (array $input) => $this->merge(
return fn (array $input) => $this->merge( /* @phpstan-ignore-line */
collect($input)
->filter(fn ($value, $key) => $this->missing($key))
->toArray()
Expand Down Expand Up @@ -301,9 +301,9 @@ public function string()
public function wantsJson()
{
return function () {
$acceptable = explode(',', $this->header('ACCEPT') ?? '');
$acceptable = explode(',', $this->header('ACCEPT'));

return Str::contains(strtolower($acceptable[0]) ?? '', ['/json', '+json']);
return Str::contains(strtolower($acceptable[0]), ['/json', '+json']);
};
}

Expand Down

0 comments on commit 58d2190

Please sign in to comment.