Commit Graph

22 Commits

Author SHA1 Message Date
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
Zach Borboa 634ee48552 Increase PHPStan strictness (#908)
* 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
------ -------------------------------------------
2025-01-11 21:51:30 -05:00
Zach Borboa d6c8c2879b Use nullable type declaration as supported in versions >= PHP 7.1 (#882) 2024-08-20 22:09:03 -04:00
Zach Borboa b2657f5744 Fix CI: Use nullable type declaration (#859)
* Use nullable type declaration

Fixes warning:
    FILE: ./src/Curl/CaseInsensitiveArray.php
    -------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------
     45 | WARNING | Implicitly marking a parameter as nullable is deprecated since PHP 8.4. Update
        |         | the type to be explicitly nullable instead. Found implicitly nullable parameter:
        |         | $initial.
        |         | (PHPCompatibility.FunctionDeclarations.RemovedImplicitlyNullableParam.Deprecated)
    -------------------------------------------------------------------------------------------------

* Remove parameter type to fix PHP 7.0
2024-04-04 20:27:03 -04:00
Robin van der Vliet 94d8cf948f Replace isset with null coalescing operator (#800) 2023-07-06 20:41:38 -07: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
Zach Borboa a800387b6c Add temporary fix missing template params 2022-12-04 12:04:59 -08:00
Zach Borboa 067cb72854 Implement ArrayUtil::arrayRandomIndex() 2022-09-28 12:38:16 -07:00
Eirik Besteland dce71a0c2f php8.1 ReturnTypeWillChange - not use "use ReturnTypeWillChange;" 2021-11-27 23:49:35 +01:00
Eirik Besteland 3d0209d3b3 php8.1 ReturnTypeWillChange 2021-11-25 00:10:07 +01:00
Zach Borboa bb1a190071 Use strict types 2021-07-26 00:48:18 -04:00
Zach Borboa 161f9aea63 Use short array syntax 2021-03-18 01:15:52 -04:00
Zach Borboa 9a538f3a6b Reduce number of ops 2019-05-12 21:13:10 -07:00
Zach Borboa 9e4eacca2d Clean up 2019-05-10 03:00:06 -07:00
Zach Borboa 1edc13b5eb Clean up docblocks 2016-08-29 23:05:01 -07:00
Zach Borboa 39c21041a5 Clean up per PSR2 2016-08-24 00:25:38 -07:00
Zach Borboa da672822d0 Replace NULL with null 2015-11-10 22:32:05 -08:00
Zach Borboa 42ecf9c076 Clean up #264 2015-11-10 07:35:25 -08:00
Michael Mulligan 425daed8d0 Use isset() for performance. Same difference. 2015-11-04 15:14:36 -05:00
Michael Mulligan 5d978bb6e5 CaseInsensitiveArray rewrite for performance.
Storeing the Case-Insensitive/Sensitive Keys separately increases performance.  Also, fix for unset and valid, as well as the ability to initialize with a pre-existing Array.
2015-11-01 16:39:16 -05:00
Zach Borboa d69cded020 Fix #254: CaseInsensitiveArray not found. 2015-10-20 21:54:53 -07:00