* 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
* Enable color
* Increase PHPStan strictness
* Fix static analysis error
------ --------------------------------------------------
Line src/Curl/MultiCurl.php
------ --------------------------------------------------
593 Variable $interval_seconds might not be defined.
🪪 variable.undefined
------ --------------------------------------------------
* Increase PHPStan strictness
* Fix static analysis errors
------ -----------------------------------------------------------------
Line scripts/bump_major_version.php
------ -----------------------------------------------------------------
8 Binary operation "+=" between string and 1 results in an error.
🪪 assignOp.invalid
------ -----------------------------------------------------------------
------ -----------------------------------------------------------------
Line scripts/bump_minor_version.php
------ -----------------------------------------------------------------
8 Binary operation "+=" between string and 1 results in an error.
🪪 assignOp.invalid
------ -----------------------------------------------------------------
------ -----------------------------------------------------------------
Line scripts/bump_patch_version.php
------ -----------------------------------------------------------------
8 Binary operation "+=" between string and 1 results in an error.
🪪 assignOp.invalid
------ -----------------------------------------------------------------
* Fix static analysis errors
------ --------------------------------------------------------------------------------------------------------------------
Line src/Curl/CaseInsensitiveArray.php
------ --------------------------------------------------------------------------------------------------------------------
132 PHPDoc tag @param has invalid value (void): Unexpected token "\n * ", expected variable at offset 42 on line 4
🪪 phpDoc.parseError
145 PHPDoc tag @param has invalid value (void): Unexpected token "\n * ", expected variable at offset 44 on line 4
🪪 phpDoc.parseError
158 PHPDoc tag @param has invalid value (void): Unexpected token "\n * ", expected variable at offset 41 on line 4
🪪 phpDoc.parseError
171 PHPDoc tag @param has invalid value (void): Unexpected token "\n * ", expected variable at offset 40 on line 4
🪪 phpDoc.parseError
197 PHPDoc tag @param has invalid value (void): Unexpected token "\n * ", expected variable at offset 43 on line 4
🪪 phpDoc.parseError
------ --------------------------------------------------------------------------------------------------------------------
* Fix static analysis errors
------ -----------------------------------------------------------------------------------
Line src/Curl/MultiCurl.php
------ -----------------------------------------------------------------------------------
937 Comparison operation "<" between float and (array|float|int) results in an error.
🪪 smaller.invalid
941 Comparison operation "<" between float and (array|float|int) results in an error.
🪪 smaller.invalid
------ -----------------------------------------------------------------------------------
* Increase PHPStan strictness
* Fix static analysis errors
------ -------------------------------------------
Line src/Curl/Decoder.php
------ -------------------------------------------
22 Offset '0' does not exist on list<mixed>.
🪪 offsetAccess.notFound
41 Offset '0' does not exist on list<mixed>.
🪪 offsetAccess.notFound
------ -------------------------------------------
* Run ci static analysis checks using scripts
* Clean up
* Move phpunit run to dedicated script
* Use run.sh and remove ci.sh
* Rename test scripts to be prefixed with "run_"
* Move static analysis runs to test script
* Clean up