From 48e3d9d68922d9098ee7168b5b90250bf53b824c Mon Sep 17 00:00:00 2001 From: Deeka Wong Date: Wed, 20 Dec 2023 12:21:16 +0800 Subject: [PATCH] Support customized local configuration files for PHPStan and PHPUnit (#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> --- src/Driver/Etcd.php | 4 +--- src/Driver/Nacos.php | 3 +-- src/Writer/EnvWriter.php | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Driver/Etcd.php b/src/Driver/Etcd.php index dd3299e..5d0cb24 100644 --- a/src/Driver/Etcd.php +++ b/src/Driver/Etcd.php @@ -13,9 +13,7 @@ use Hyperf\Collection\Arr; use Hyperf\Contract\ConfigInterface; -use Hyperf\Contract\StdoutLoggerInterface; use Hyperf\Etcd\V3\KV; -use Psr\Container\ContainerInterface; use function Hyperf\Collection\collect; use function Hyperf\Support\make; @@ -24,7 +22,7 @@ class Etcd implements DriverInterface { private KV $client; - public function __construct(private ContainerInterface $container, private ConfigInterface $config, private StdoutLoggerInterface $logger) + public function __construct(private ConfigInterface $config) { $this->client = make(EtcdClient::class, [ 'uri' => (string) $this->config->get('confd.drivers.etcd.client.uri', ''), diff --git a/src/Driver/Nacos.php b/src/Driver/Nacos.php index 51f7918..bba7078 100644 --- a/src/Driver/Nacos.php +++ b/src/Driver/Nacos.php @@ -19,7 +19,6 @@ use Hyperf\Nacos\Application; use Hyperf\Nacos\Config; use InvalidArgumentException; -use Psr\Container\ContainerInterface; use function Hyperf\Collection\collect; use function Hyperf\Support\make; @@ -28,7 +27,7 @@ class Nacos implements DriverInterface { private Application $client; - public function __construct(private ContainerInterface $container, private ConfigInterface $config, private StdoutLoggerInterface $logger) + public function __construct(private ConfigInterface $config, private StdoutLoggerInterface $logger) { $config = $this->config->get('confd.drivers.nacos.client') ?: $this->config->get('nacos', []); diff --git a/src/Writer/EnvWriter.php b/src/Writer/EnvWriter.php index 31bd64f..1307828 100644 --- a/src/Writer/EnvWriter.php +++ b/src/Writer/EnvWriter.php @@ -181,7 +181,7 @@ public function write(bool $force = false): bool return true; } - return file_put_contents($this->path, $this->content, LOCK_EX) !== false ?? true; + return file_put_contents($this->path, $this->content, LOCK_EX) !== false; } /**