* Use WeakMap for active handle tracking
- Replaces array-based tracking with PHP 8.0 \WeakMap
- Replaces an O(N) lookup with an O(1) lookup in the MultiCurl execution loop
* Fix tests
* Clean up
* Simplify MultiCurl execution loop
- Removes legacy workarounds
- Deprecates MultiCurl::setRequestTimeAccuracy()
- Removes use of CURLM_CALL_MULTI_PERFORM ("As of cURL 7.20.0, this constant is not used")
* Rate limit fix
If $elapsed_seconds > $this->intervalSeconds the first time hasRequestQuota() is called, rateLimitReached is never set to true and the limit is not enforced
This can happen if the rate limit is set in a callback function some time after starting
I completely removed $rateLimitReached since its only use was in the removed condition check
Alternatively, it should be possible to reinitialize currentStartTime when setRateLimit is called, but I still don't really see the usefulness of resetting the timer only when the limit was reached in the previous interval
* Rename variable
* Clean up
---------
Co-authored-by: Riccardo Nava <116394015+ricnava00@users.noreply.github.com>
* Fix PHP_CodeSniffer errors
Error message:
Header blocks must be separated by a single blank line (PSR12.Files.FileHeader.SpacingAfterTagBlock)
* Fix PHP_CodeSniffer errors
Error message:
Opening brace should be on a new line (Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine)
* Fix PHP_CodeSniffer warnings
Error message:
A file should declare new symbols (classes, functions, constants, etc.)
and cause no other side effects, or it should execute logic with side
effects, but should not do both. The first symbol is defined on line 6
and the first side effect is on line 14.
(PSR1.Files.SideEffects.FoundWithSymbols)
* Increase PHPStan memory limit on local development
* Add emjois to test warnings and test errors
* Fix PHPStan static analysis errors
Error messages:
------ ------------------------------------------------------------------------------------------------------
Line src/Curl/Curl.php
------ ------------------------------------------------------------------------------------------------------
123 Cannot unset property Curl\Curl::$curlErrorCodeConstant because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
124 Cannot unset property Curl\Curl::$curlErrorCodeConstants because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
125 Cannot unset property Curl\Curl::$curlOptionCodeConstants because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
126 Cannot unset property Curl\Curl::$effectiveUrl because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
127 Cannot unset property Curl\Curl::$rfc2616 because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
128 Cannot unset property Curl\Curl::$rfc6265 because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
129 Cannot unset property Curl\Curl::$totalTime because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
564 Cannot unset property Curl\Curl::$curlErrorCodeConstant because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
565 Cannot unset property Curl\Curl::$effectiveUrl because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
566 Cannot unset property Curl\Curl::$totalTime because it might have hooks in a subclass.
🪪 unset.possiblyHookedProperty
------ ------------------------------------------------------------------------------------------------------
* 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)
* 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