Commit Graph

469 Commits

Author SHA1 Message Date
Zach Borboa 4cf4635e25 Increase psalm strictness (#925)
* Fix PossiblyUndefinedArrayOffset

ERROR: PossiblyUndefinedArrayOffset - ../src/Curl/Curl.php:1890:28 -
Possibly undefined array key (see https://psalm.dev/167)
                list($key, $value) = explode(':', $raw_headers[$i], 2);

* Fix PossiblyUndefinedArrayOffset

ERROR: PossiblyUndefinedArrayOffset - ../src/Curl/Curl.php:1034:28 -
Possibly undefined array key (see https://psalm.dev/167)
                list($key, $value) = explode(':', $header, 2);

* Fix PossiblyUndefinedArrayOffset

ERROR: PossiblyUndefinedArrayOffset - ../src/Curl/MultiCurl.php:465:28 -
Possibly undefined array key (see https://psalm.dev/167)
                list($key, $value) = explode(':', $header, 2);

* Fix PossiblyInvalidOperand

ERROR: PossiblyInvalidOperand - ../src/Curl/Curl.php:1407:69 - Cannot
concatenate with a int<0, max>|string (see https://psalm.dev/163)
                    echo 'Response content length (calculated): ' . $response_calculated_length . "\n";

* Fix PossiblyInvalidArgument

ERROR: PossiblyInvalidArgument - ../src/Curl/BaseCurl.php:408:34 -
Argument 2 of define expects array<array-key, mixed>|null|scalar, but
possibly different type false|resource provided (see
https://psalm.dev/092)
                define('STDERR', fopen('php://stderr', 'wb'));

* Fix ArgumentTypeCoercion

ERROR: ArgumentTypeCoercion - ../src/Curl/MultiCurl.php:956:16 -
Argument 1 of usleep expects int<0, max>, but parent type int provided
(see https://psalm.dev/193)
        usleep((int) $sleep_seconds * 1000000);

* Fix PossiblyFalseArgument

ERROR: PossiblyFalseArgument - ../src/Curl/MultiCurl.php:131:50 -
Argument 2 of file_put_contents cannot be false, possibly
array<array-key, string>|resource|string value expected (see
https://psalm.dev/104)
                    file_put_contents($filename, stream_get_contents($fh));

* Fix PossiblyFalseArgument

ERROR: PossiblyFalseArgument - ../src/Curl/Curl.php:437:49 - Argument 2
of stream_copy_to_stream cannot be false, possibly resource value
expected (see https://psalm.dev/104)
                stream_copy_to_stream($tmpfile, $fh);

ERROR: PossiblyFalseArgument - ../src/Curl/Curl.php:438:24 - Argument 1
of fclose cannot be false, possibly resource value expected (see
https://psalm.dev/104)
                fclose($fh);

* Fix PossiblyFalseArgument

ERROR: PossiblyFalseArgument - ../src/Curl/Curl.php:463:49 - Argument 2
of stream_copy_to_stream cannot be false, possibly resource value
expected (see https://psalm.dev/104)
            stream_copy_to_stream($file_handle, $main_file_handle);

ERROR: PossiblyFalseArgument - ../src/Curl/Curl.php:468:16 - Argument 1
of fclose cannot be false, possibly resource value expected (see
https://psalm.dev/104)
        fclose($main_file_handle);

* Fix PossiblyFalseArgument

ERROR: PossiblyFalseArgument - ../src/Curl/Curl.php:1891:36 - Argument 1
of count cannot be false, possibly Countable|array<array-key, mixed>
value expected (see https://psalm.dev/104)
        $raw_headers_count = count($raw_headers);

ERROR: PossiblyInvalidArrayAccess - ../src/Curl/Curl.php:1893:24 -
Cannot access array value on non-array variable $raw_headers of type
false (see https://psalm.dev/109)
            if (strpos($raw_headers[$i], ':') !== false) {

* Fix PossiblyInvalidArgument

ERROR: PossiblyInvalidArgument - ../src/Curl/Curl.php:1868:30 - Argument
2 of define expects array<array-key, mixed>|null|scalar, but possibly
different type false|resource provided (see https://psalm.dev/092)
            define('STDOUT', fopen('php://stdout', 'w'));

* Update psalm baseline
2025-02-19 21:40:56 -05:00
github-actions[bot] 4d126ef1d1 Bump version: 11.0.2 → 11.0.3 2025-02-19 18:04:26 +00:00
Zach Borboa 056de7d13d Use default for Psalm ensureOverrideAttribute (#923)
* Use default for Psalm ensureOverrideAttribute

* Fix missing Override attributes

Error: ../src/Curl/CaseInsensitiveArray.php:66:5:
MissingOverrideAttribute: Method Curl\CaseInsensitiveArray::offsetset
should have the "Override" attribute (see https://psalm.dev/358)
2025-02-18 21:49:22 -05:00
github-actions[bot] 214cfe01db Bump version: 11.0.1 → 11.0.2 2025-02-18 18:03:57 +00:00
Zach Borboa fd902b4b7c Fix CI (PHPUnit) (#918)
* Add shims for PHPUnit

* Fix PHPUnit error: undefined method returnValue()

1) CurlTest\PHPCurlClassTest::testMock
Error: Call to undefined method CurlTest\PHPCurlClassTest::returnValue()

* Fix PHPUnit risky test by restoring error handler before exception thrown

There was 1 risky test:

1) CurlTest\PHPCurlClassTest::testRequiredOptionCurlOptReturnTransferEmitsWarningPHPUnit10Plus
Test code or tested code did not remove its own error handlers

* Fix psalm errors

* Add attributes for version constraint

* Temporarily pin psalm to fix ci
2025-02-17 18:24:42 -05:00
github-actions[bot] c8a7bc92f2 Bump version: 11.0.0 → 11.0.1 2025-01-13 18:04:13 +00:00
Zach Borboa bd793d1287 Increase Psalm strictness (#909)
* Increase Psalm strictness

* Fix static analysis errors

ERROR: RedundantCast - ../src/Curl/CaseInsensitiveArray.php:91:16 - Redundant cast to bool (see https://psalm.dev/262)
        return (bool) array_key_exists(strtolower($offset), $this->data);

ERROR: RedundantCast - ../src/Curl/CaseInsensitiveArray.php:138:16 - Redundant cast to int<0, max> (see https://psalm.dev/262)
        return (int) count($this->data);

ERROR: RedundantCast - ../src/Curl/CaseInsensitiveArray.php:187:16 - Redundant cast to bool (see https://psalm.dev/262)
        return (bool) (key($this->data) !== null);

ERROR: ForbiddenCode - ../src/Curl/Curl.php:1765:13 - Unsafe var_dump (see https://psalm.dev/002)
            var_dump($value);

ERROR: ForbiddenCode - ../src/Curl/Curl.php:1770:13 - Unsafe var_dump (see https://psalm.dev/002)
            var_dump($value);

ERROR: InvalidOperand - ../src/Curl/Curl.php:1816:35 - Cannot concatenate with a value-of<TArray> (see https://psalm.dev/058)
                return $k . '=' . $v;
2025-01-11 23:11:26 -05:00
github-actions[bot] db6f650c47 Bump version: 10.0.1 → 11.0.0 2024-08-22 18:03:48 +00:00
github-actions[bot] 3fbd244703 Bump version: 10.0.0 → 10.0.1 2024-08-21 18:03:41 +00:00
github-actions[bot] f08eb12db8 Bump version: 9.19.2 → 10.0.0 2024-08-20 18:03:54 +00:00
Zach Borboa 63bddcd230 Drop support for PHP 7.0 (#880) 2024-08-17 09:15:46 -04:00
github-actions[bot] c41efeb4ea Bump version: 9.19.1 → 9.19.2 2024-04-09 18:03:13 +00:00
github-actions[bot] 680afbcfd9 Bump version: 9.19.0 → 9.19.1 2024-02-27 18:03:38 +00:00
github-actions[bot] 8e9cd0caff Bump version: 9.18.2 → 9.19.0 2024-01-18 18:03:34 +00:00
Zach Borboa 5097545a05 Allow displaying curl option value without specifying value 2024-01-18 09:05:46 -05:00
Zach Borboa 93c5a18302 Fix PHP CS Fixer validation
Error occurred with a newer version of PHP CS Fixer being installed
(3.42.0 → 3.43.1).
2023-12-29 21:50:09 -05:00
Zach Borboa 69034d052f Wrap option string values in quotes when displaying diagnostic output 2023-10-21 06:05:18 -07:00
Zach Borboa 89ff44d667 Clean up 2023-09-22 17:14:30 -07:00
github-actions[bot] 2b8a93b37d Bump version: 9.18.1 → 9.18.2 2023-09-11 18:08:28 +00:00
Zach Borboa 4624486d56 Fix use of mb_strpos() causing error when polyfill is used
Error message:
    Uncaught ErrorException: iconv_strpos(): Detected an illegal character in input string in
    /var/www/site/vendor/symfony/polyfill-mbstring/Mbstring.php:536
2023-09-09 11:52:42 -07:00
github-actions[bot] e4e6664854 Bump version: 9.18.0 → 9.18.1 2023-08-29 18:02:47 +00:00
Zach Borboa a6e6110051 Update checks for decoding gzip-encoded responses 2023-08-29 07:01:18 -07:00
github-actions[bot] c5260b162b Bump version: 9.17.4 → 9.18.0 2023-08-28 18:02:58 +00:00
Zach Borboa 11bd600918 Rename ::setError() to ::afterSend() 2023-08-25 06:39:12 -07:00
Zach Borboa 5e5d284a9b Implement Curl::setError() and MultiCurl::setError() 2023-08-22 20:20:47 -07:00
github-actions[bot] d5542274ac Bump version: 9.17.3 → 9.17.4 2023-07-10 18:03:00 +00:00
Robin van der Vliet 94d8cf948f Replace isset with null coalescing operator (#800) 2023-07-06 20:41:38 -07:00
github-actions[bot] 96bb2ef69b Bump version: 9.17.2 → 9.17.3 2023-07-04 18:03:02 +00:00
Zach Borboa cd924d10c3 Update PHP_CodeSniffer ruleset: PSR2 → PSR12 2023-06-30 01:23:37 -07:00
Zach Borboa 9bd4776b73 Apply additional coding standards 2023-06-30 00:37:30 -07:00
github-actions[bot] 60055da5b5 Bump version: 9.17.1 → 9.17.2 2023-06-27 01:06:30 +00:00
Zach Borboa 2f532ab2b8 Merge branch 'master' into use-short-array-syntax 2023-06-26 02:57:15 -07:00
Zach Borboa 128a0c1ea2 Add PHP-CS-Fixer to check for unused imports 2023-06-24 19:33:48 -07:00
Robin van der Vliet c45f8e22de Use short array syntax 2023-06-23 19:50:18 +02:00
Robin van der Vliet c9ad23cf5c Increase uniqueness of Curl::id
Replace `uniqid` by `random_bytes` (#792)
2023-06-22 15:38:16 -07:00
github-actions[bot] 5672725591 Bump version: 9.17.0 → 9.17.1 2023-06-14 18:02:50 +00:00
Zach Borboa 945c8c9aad Merge pull request #791 from zachborboa/master
Improve and add tests for Curl::fastDownload()
2023-06-13 18:48:50 -07:00
github-actions[bot] 505c09484d Bump version: 9.16.1 → 9.17.0 2023-06-13 18:02:54 +00:00
Zach Borboa 76e74fdc44 Improve and add tests for Curl::fastDownload() 2023-06-13 02:52:59 -07:00
Zach Borboa 2bb2f32087 Make method to display curl option value public 2023-06-12 20:27:16 -07:00
github-actions[bot] 8223f13fce Bump version: 9.16.0 → 9.16.1 2023-06-12 18:02:52 +00:00
Zach Borboa 42a2062d6f Differentiate between internal options and user-set options 2023-06-11 19:52:58 -07:00
Zach Borboa 4c4bc8952a Create method to display a curl option value 2023-06-03 05:14:35 -07:00
github-actions[bot] 100a7f406d Bump version: 9.15.1 → 9.16.0 2023-05-25 18:02:49 +00:00
Zach Borboa 493d69de2c Merge pull request #783 from zachborboa/master
Graduate Curl::fastDownload()
2023-05-24 15:12:17 -07:00
github-actions[bot] aa1872beda Bump version: 9.15.0 → 9.15.1 2023-05-24 18:02:49 +00:00
Zach Borboa c37bb58a48 Make function public 2023-05-23 20:35:36 -07:00
Zach Borboa 2a409363f3 Clean up 2023-05-23 20:34:21 -07:00
Zach Borboa 645c1a4859 Merge pull request #782 from zachborboa/master
Fix PHP CodeSniffer errors
2023-05-23 18:17:39 -07:00
Zach Borboa ecba1623e7 Fix PHP CodeSniffer errors
FILE: ./src/Curl/Curl.php
----------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------------------------------------------------------------------
 1688 | WARNING | Method name "_getCurlErrorCodeConstants" should not be prefixed with an underscore to indicate visibility
      |         | (PSR2.Methods.MethodDeclaration.Underscore)
 1707 | WARNING | Method name "_getCurlErrorCodeConstant" should not be prefixed with an underscore to indicate visibility
      |         | (PSR2.Methods.MethodDeclaration.Underscore)
 1721 | WARNING | Method name "_getCurlOptionCodeConstants" should not be prefixed with an underscore to indicate visibility
      |         | (PSR2.Methods.MethodDeclaration.Underscore)
 1745 | WARNING | Method name "_getEffectiveUrl" should not be prefixed with an underscore to indicate visibility
      |         | (PSR2.Methods.MethodDeclaration.Underscore)
 1755 | WARNING | Method name "_getRfc2616" should not be prefixed with an underscore to indicate visibility
      |         | (PSR2.Methods.MethodDeclaration.Underscore)
 1765 | WARNING | Method name "_getRfc6265" should not be prefixed with an underscore to indicate visibility
      |         | (PSR2.Methods.MethodDeclaration.Underscore)
 1775 | WARNING | Method name "_getTotalTime" should not be prefixed with an underscore to indicate visibility
      |         | (PSR2.Methods.MethodDeclaration.Underscore)
----------------------------------------------------------------------------------------------------------------------------------
2023-05-23 17:49:52 -07:00