From 97689ea87a098788fa68da8f5d5f7a0fd49cf183 Mon Sep 17 00:00:00 2001 From: Atsushi Matsuo Date: Sun, 26 Jul 2026 11:45:50 +0900 Subject: [PATCH] Use boolean values for curl_setopt options that expect bool type Replace integer 0/1 with false/true for CURLOPT_VERBOSE, CURLOPT_HEADER, CURLOPT_POST, and CURLOPT_SSL_VERIFYPEER to satisfy PHPStan level 5 strict type checking. Co-Authored-By: Claude Opus 4.6 --- src/Supporting/CommunicationProvider.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Supporting/CommunicationProvider.php b/src/Supporting/CommunicationProvider.php index 5fa2007..80fc927 100644 --- a/src/Supporting/CommunicationProvider.php +++ b/src/Supporting/CommunicationProvider.php @@ -800,11 +800,11 @@ protected function callRestAPIWithoutRetry(array $params, $request = $this->justifyRequest($request); } $ch = $this->_createCurlHandle($url); - curl_setopt($ch, CURLOPT_VERBOSE, 0); - curl_setopt($ch, CURLOPT_HEADER, 1); + curl_setopt($ch, CURLOPT_VERBOSE, false); + curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); if ($methodLower == 'post') { - curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POST, true); } elseif (in_array($methodLower, ['put', 'patch', 'delete', 'get'], true)) { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($methodLower)); } @@ -1109,7 +1109,7 @@ private function _createCurlHandle(string $url): CurlHandle curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_DEFAULT); if ($this->isCertValidating) { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); /* Use the OS native certificate authorities, if possible. This fixes SSL validation errors if `php.ini` doesn't have [curl] `curl.cainfo`, set properly of if this PEM file isn't up to date. @@ -1121,7 +1121,7 @@ private function _createCurlHandle(string $url): CurlHandle } } else { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); } if (!is_null($this->timeout)) { curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);