diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 836fcde1..00b55790 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -14,7 +14,6 @@ '@PHP71Migration:risky' => true, 'no_alias_functions' => true, 'void_return' => false, - 'phpdoc_to_param_type' => true, '@PHPUnit84Migration:risky' => true, ]) ->setRiskyAllowed(true) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba12fb78..d097fdad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -146,7 +146,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Provide access to HTTP status code by @Alkarex in [#674](https://github.com/simplepie/simplepie/pull/674) * Fix wrong type hint by @Alkarex in [#678](https://github.com/simplepie/simplepie/pull/678) * Force HTTPS for selected domains by @Alkarex in [#676](https://github.com/simplepie/simplepie/pull/676) -* Prevent cache polution by @Alkarex in [#675](https://github.com/simplepie/simplepie/pull/675) +* Prevent cache pollution by @Alkarex in [#675](https://github.com/simplepie/simplepie/pull/675) * Fix typo in comment by @Alkarex in [#680](https://github.com/simplepie/simplepie/pull/680) * Remove HTTP credentials in HTTP Referer by @Alkarex in [#681](https://github.com/simplepie/simplepie/pull/681) * CI: switch to GH Actions by @jrfnl in [#688](https://github.com/simplepie/simplepie/pull/688) @@ -301,7 +301,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed a PHP notice that occurs when a date starts with `(`. [#348](https://github.com/simplepie/simplepie/pull/348) * Fixed uninitialized string offeset PHP notices. [#353](https://github.com/simplepie/simplepie/pull/353) * Fixed call to non-existent property in Memcache. [#311](https://github.com/simplepie/simplepie/pull/311) -* Fixed a bug where MySQL statements were not being passed thorugh `prepare()`. [#348](https://github.com/simplepie/simplepie/pull/348) +* Fixed a bug where MySQL statements were not being passed through `prepare()`. [#348](https://github.com/simplepie/simplepie/pull/348) * Fixed an instance where an error message in `SimplePie` was not being triggered correctly. [#348](https://github.com/simplepie/simplepie/pull/348) * Fixed a bug with Russian feeds. [#348](https://github.com/simplepie/simplepie/pull/348) * Fixed an issue with memory leaks. [#287](https://github.com/simplepie/simplepie/pull/287) diff --git a/phpstan.neon b/phpstan.neon index 3959db03..5450a9ac 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -23,7 +23,7 @@ parameters: - '(Constructor of class SimplePie\\Enclosure has an unused parameter \$javascript\.)' # Testing legacy dynamic property usage. - - '(Access to an undefined property SimplePie.IRI::\$nonexistant_prop\.)' + - '(Access to an undefined property SimplePie.IRI::\$nonexistent_prop\.)' - message: '(^Strict comparison using === between string and false will always evaluate to false\.$)' diff --git a/src/Cache/CallableNameFilter.php b/src/Cache/CallableNameFilter.php index 2cfb13f4..6a128a3d 100644 --- a/src/Cache/CallableNameFilter.php +++ b/src/Cache/CallableNameFilter.php @@ -39,7 +39,7 @@ public function __construct(callable $callable) * and encodings or longer lengths, but MUST support at least that * minimum. * - * @param string $name The name for the cache will be most likly an url with query string + * @param string $name The name for the cache will be most likely an url with query string * * @return string the new cache name */ diff --git a/src/Cache/NameFilter.php b/src/Cache/NameFilter.php index af94255b..9babb41f 100644 --- a/src/Cache/NameFilter.php +++ b/src/Cache/NameFilter.php @@ -29,7 +29,7 @@ interface NameFilter * and encodings or longer lengths, but MUST support at least that * minimum. * - * @param string $name The name for the cache will be most likly an url with query string + * @param string $name The name for the cache will be most likely an url with query string * * @return string the new cache name */ diff --git a/src/HTTP/Parser.php b/src/HTTP/Parser.php index 60a19ca1..4612bdb0 100644 --- a/src/HTTP/Parser.php +++ b/src/HTTP/Parser.php @@ -110,14 +110,14 @@ class Parser protected $position = 0; /** - * Name of the hedaer currently being parsed + * Name of the header currently being parsed * * @var string */ protected $name = ''; /** - * Value of the hedaer currently being parsed + * Value of the header currently being parsed * * @var string */ diff --git a/src/Misc.php b/src/Misc.php index 950e3f9b..b5569510 100644 --- a/src/Misc.php +++ b/src/Misc.php @@ -292,13 +292,13 @@ public static function change_encoding(string $data, string $input, string $outp // We fail to fail on non US-ASCII bytes if ($input === 'US-ASCII') { - static $non_ascii_octects = ''; - if (!$non_ascii_octects) { + static $non_ascii_octets = ''; + if (!$non_ascii_octets) { for ($i = 0x80; $i <= 0xFF; $i++) { - $non_ascii_octects .= chr($i); + $non_ascii_octets .= chr($i); } } - $data = substr($data, 0, strcspn($data, $non_ascii_octects)); + $data = substr($data, 0, strcspn($data, $non_ascii_octets)); } // This is first, as behaviour of this is completely predictable diff --git a/src/Parser.php b/src/Parser.php index b7c5a29d..c5f4ac57 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -144,6 +144,8 @@ public function parse(string &$data, string $encoding, string $url = '') //Parse by chunks not to use too much memory do { $stream_data = fread($stream, 1048576); + // NB: At some point between PHP 7.3 and 7.4, the signature for `fread()` has changed + // from returning `string` to returning `string|false`, hence the falsy check: if (!xml_parse($xml, $stream_data == false ? '' : $stream_data, feof($stream))) { $this->error_code = xml_get_error_code($xml); $this->error_string = xml_error_string($this->error_code); diff --git a/src/SimplePie.php b/src/SimplePie.php index e8f5223d..78114b9e 100644 --- a/src/SimplePie.php +++ b/src/SimplePie.php @@ -1474,7 +1474,7 @@ public function remove_div(bool $enable = true) } /** - * @param string[]|string|false $tags Set a list of tags to strip, or set emtpy string to use default tags or false, to strip nothing. + * @param string[]|string|false $tags Set a list of tags to strip, or set empty string to use default tags or false, to strip nothing. * @return void */ public function strip_htmltags($tags = '', ?bool $encode = null) @@ -3416,7 +3416,7 @@ public static function merge_items(array $urls, int $start = 0, int $end = 0, in if ($arg instanceof SimplePie) { $items = array_merge($items, $arg->get_items(0, $limit)); - // @phpstan-ignore-next-line Enforce PHPDoc type. + // @phpstan-ignore-next-line Enforce PHPDoc type. } else { trigger_error('Arguments must be SimplePie objects', E_USER_WARNING); } diff --git a/tests/EncodingTest.php b/tests/EncodingTest.php index 5278425a..eefc4f45 100644 --- a/tests/EncodingTest.php +++ b/tests/EncodingTest.php @@ -147,7 +147,7 @@ public function test_convert_UTF16(string $input, string $expected, string $enco $this->assertSameBin2Hex($expected, SimplePie_Misc::change_encoding($input, $encoding, 'UTF-16')); } - public function test_nonexistant(): void + public function test_nonexistent(): void { $this->assertFalse(SimplePie_Misc::change_encoding('', 'TESTENC', 'UTF-8')); } diff --git a/tests/IRITest.php b/tests/IRITest.php index e39c2adb..a7409a54 100644 --- a/tests/IRITest.php +++ b/tests/IRITest.php @@ -446,16 +446,16 @@ public function testWriteAliased(): void $this->assertSame('test', $iri->fragment); } - public function testNonexistantProperty(): void + public function testNonexistentProperty(): void { $iri = new SimplePie_IRI(); - $this->assertFalse(isset($iri->nonexistant_prop)); + $this->assertFalse(isset($iri->nonexistent_prop)); // PHPUnit 10 compatible way to test trigger_error(). set_error_handler( function ($errno, $errstr): bool { $this->assertSame( - 'Undefined property: SimplePie\IRI::nonexistant_prop', + 'Undefined property: SimplePie\IRI::nonexistent_prop', $errstr ); @@ -465,7 +465,7 @@ function ($errno, $errstr): bool { E_USER_NOTICE ); - $should_fail = $iri->nonexistant_prop; + $should_fail = $iri->nonexistent_prop; } public function testBlankHost(): void diff --git a/tests/Integration/CachingTest.php b/tests/Integration/CachingTest.php index c302e31d..35041006 100644 --- a/tests/Integration/CachingTest.php +++ b/tests/Integration/CachingTest.php @@ -85,7 +85,7 @@ public function testInitWithDifferentCacheStateCallsCacheCorrectly( $writtenData = $data; - // Ignore internally setted '__cache_expiration_time' + // Ignore internally set '__cache_expiration_time' if (array_key_exists('__cache_expiration_time', $writtenData)) { unset($writtenData['__cache_expiration_time']); } diff --git a/tests/Unit/CategoryTest.php b/tests/Unit/CategoryTest.php index 044fac69..183b310b 100644 --- a/tests/Unit/CategoryTest.php +++ b/tests/Unit/CategoryTest.php @@ -27,7 +27,7 @@ public function testClassExists(): void /** * @return array */ - public static function getFeedCategoryLableDataProvider(): array + public static function getFeedCategoryLabelDataProvider(): array { return [ 'Test Atom 0.3 DC 1.0 Subject' => [ @@ -377,7 +377,7 @@ public static function getFeedCategoryLableDataProvider(): array } /** - * @dataProvider getFeedCategoryLableDataProvider + * @dataProvider getFeedCategoryLabelDataProvider */ public function test_get_label_from_feed_category(string $data, string $expected): void { @@ -395,7 +395,7 @@ public function test_get_label_from_feed_category(string $data, string $expected /** * @return array */ - public static function getItemCategoryLableDataProvider(): array + public static function getItemCategoryLabelDataProvider(): array { return [ 'Test Atom 0.3 DC 1.0 Subject' => [ @@ -805,7 +805,7 @@ public static function getItemCategoryLableDataProvider(): array } /** - * @dataProvider getItemCategoryLableDataProvider + * @dataProvider getItemCategoryLabelDataProvider */ public function test_get_label_from_item_category(string $data, string $expected): void { diff --git a/tests/Unit/IRITest.php b/tests/Unit/IRITest.php index 3e3e78ca..296e83a5 100644 --- a/tests/Unit/IRITest.php +++ b/tests/Unit/IRITest.php @@ -456,16 +456,16 @@ public function testWriteAliased(): void $this->assertSame('test', $iri->fragment); } - public function testNonexistantProperty(): void + public function testNonexistentProperty(): void { $iri = new IRI(); - $this->assertFalse(isset($iri->nonexistant_prop)); + $this->assertFalse(isset($iri->nonexistent_prop)); // PHPUnit 10 compatible way to test trigger_error(). set_error_handler( function ($errno, $errstr): bool { $this->assertSame( - 'Undefined property: SimplePie\IRI::nonexistant_prop', + 'Undefined property: SimplePie\IRI::nonexistent_prop', $errstr ); @@ -475,7 +475,7 @@ function ($errno, $errstr): bool { E_USER_NOTICE ); - $should_fail = $iri->nonexistant_prop; + $should_fail = $iri->nonexistent_prop; } public function testBlankHost(): void diff --git a/tests/Unit/MiscTest.php b/tests/Unit/MiscTest.php index 782aadcc..5a88447a 100644 --- a/tests/Unit/MiscTest.php +++ b/tests/Unit/MiscTest.php @@ -177,7 +177,7 @@ public function test_convert_UTF16(string $input, string $expected, string $enco $this->assertSameBin2Hex($expected, Misc::change_encoding($input, $encoding, 'UTF-16')); } - public function test_nonexistant(): void + public function test_nonexistent(): void { $this->assertFalse(Misc::change_encoding('', 'TESTENC', 'UTF-8')); }