From e425278f7db30cec0e570bc9fdc67737172594bf Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 19 Jul 2022 15:29:28 +0700 Subject: [PATCH 1/4] Apply PHP 7.4 syntax and typed property Signed-off-by: Abdul Malik Ikhsan --- src/PubSubHubbub/AbstractCallback.php | 2 +- .../Http/LaminasHttpClientDecorator.php | 3 +- src/Reader/Http/Psr7ResponseDecorator.php | 3 +- src/Reader/Http/Response.php | 9 +-- src/Reader/StandaloneExtensionManager.php | 2 +- src/Writer/StandaloneExtensionManager.php | 2 +- test/PubSubHubbub/Subscriber/CallbackTest.php | 2 +- test/Reader/Entry/AtomStandaloneEntryTest.php | 2 +- test/Reader/Entry/AtomTest.php | 2 +- test/Reader/Entry/CommonTest.php | 2 +- test/Reader/Entry/RssTest.php | 2 +- test/Reader/Feed/AtomSourceTest.php | 2 +- test/Reader/Feed/AtomTest.php | 2 +- test/Reader/Feed/CommonTest.php | 2 +- test/Reader/Feed/RssTest.php | 2 +- .../Integration/GooglePlayPodcastRss2Test.php | 12 ++-- .../Integration/HOnlineComAtom10Test.php | 2 +- test/Reader/Integration/LautDeRdfTest.php | 2 +- .../Integration/PodcastIndexRss2Test.php | 2 +- test/Reader/Integration/PodcastRss2Test.php | 16 +++--- .../Integration/WordpressAtom10Test.php | 2 +- .../Integration/WordpressRss2DcAtomTest.php | 2 +- test/Reader/ReaderTest.php | 8 +-- .../Reader/StandaloneExtensionManagerTest.php | 3 +- .../TestAsset/CustomExtensionManager.php | 2 +- test/Writer/DeletedTest.php | 12 ++-- test/Writer/EntryTest.php | 26 ++++----- test/Writer/Extension/ITunes/EntryTest.php | 12 +--- test/Writer/Extension/ITunes/FeedTest.php | 12 +--- test/Writer/FeedTest.php | 56 +++++++++---------- test/Writer/Renderer/Entry/AtomTest.php | 10 ++-- test/Writer/Renderer/Entry/RssTest.php | 8 +-- test/Writer/Renderer/Feed/AtomTest.php | 6 +- test/Writer/Renderer/Feed/RssTest.php | 12 ++-- .../Writer/StandaloneExtensionManagerTest.php | 3 +- .../TestAsset/CustomExtensionManager.php | 2 +- 36 files changed, 114 insertions(+), 135 deletions(-) diff --git a/src/PubSubHubbub/AbstractCallback.php b/src/PubSubHubbub/AbstractCallback.php index 9b2b868c..3528a890 100644 --- a/src/PubSubHubbub/AbstractCallback.php +++ b/src/PubSubHubbub/AbstractCallback.php @@ -299,7 +299,7 @@ protected function _getHeader($header) return $_SERVER[$temp]; } if (function_exists('apache_request_headers')) { - $headers = apache_request_headers(); + $headers = getallheaders(); if (! empty($headers[$header])) { return $headers[$header]; } diff --git a/src/Reader/Http/LaminasHttpClientDecorator.php b/src/Reader/Http/LaminasHttpClientDecorator.php index ac38f4fa..e197cd29 100644 --- a/src/Reader/Http/LaminasHttpClientDecorator.php +++ b/src/Reader/Http/LaminasHttpClientDecorator.php @@ -19,8 +19,7 @@ class LaminasHttpClientDecorator implements HeaderAwareClientInterface { - /** @var LaminasHttpClient */ - private $client; + private LaminasHttpClient $client; public function __construct(LaminasHttpClient $client) { diff --git a/src/Reader/Http/Psr7ResponseDecorator.php b/src/Reader/Http/Psr7ResponseDecorator.php index 32f9ec7d..ffc4a20a 100644 --- a/src/Reader/Http/Psr7ResponseDecorator.php +++ b/src/Reader/Http/Psr7ResponseDecorator.php @@ -11,8 +11,7 @@ */ class Psr7ResponseDecorator implements HeaderAwareResponseInterface { - /** @var Psr7ResponseInterface */ - private $decoratedResponse; + private Psr7ResponseInterface $decoratedResponse; public function __construct(Psr7ResponseInterface $response) { diff --git a/src/Reader/Http/Response.php b/src/Reader/Http/Response.php index 7ed473d5..67bbba64 100644 --- a/src/Reader/Http/Response.php +++ b/src/Reader/Http/Response.php @@ -19,14 +19,11 @@ class Response implements HeaderAwareResponseInterface { - /** @var string */ - private $body; + private string $body; - /** @var array */ - private $headers; + private array $headers; - /** @var int */ - private $statusCode; + private int $statusCode; /** * @param int $statusCode diff --git a/src/Reader/StandaloneExtensionManager.php b/src/Reader/StandaloneExtensionManager.php index a37316b1..d07d26ac 100644 --- a/src/Reader/StandaloneExtensionManager.php +++ b/src/Reader/StandaloneExtensionManager.php @@ -18,7 +18,7 @@ class StandaloneExtensionManager implements ExtensionManagerInterface { /** @var array */ - private $extensions = [ + private array $extensions = [ 'Atom\Entry' => Extension\Atom\Entry::class, 'Atom\Feed' => Extension\Atom\Feed::class, 'Content\Entry' => Extension\Content\Entry::class, diff --git a/src/Writer/StandaloneExtensionManager.php b/src/Writer/StandaloneExtensionManager.php index 87809130..e248e185 100644 --- a/src/Writer/StandaloneExtensionManager.php +++ b/src/Writer/StandaloneExtensionManager.php @@ -15,7 +15,7 @@ class StandaloneExtensionManager implements ExtensionManagerInterface { /** @var array */ - private $extensions = [ + private array $extensions = [ 'Atom\Renderer\Feed' => Extension\Atom\Renderer\Feed::class, 'Content\Renderer\Entry' => Extension\Content\Renderer\Entry::class, 'DublinCore\Renderer\Entry' => Extension\DublinCore\Renderer\Entry::class, diff --git a/test/PubSubHubbub/Subscriber/CallbackTest.php b/test/PubSubHubbub/Subscriber/CallbackTest.php index 8a86b80f..0352e9e1 100644 --- a/test/PubSubHubbub/Subscriber/CallbackTest.php +++ b/test/PubSubHubbub/Subscriber/CallbackTest.php @@ -369,7 +369,7 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge(): 'id' => 'verifytokenkey', 'verify_token' => hash('sha256', 'cba'), 'created_time' => $t->getTimestamp(), - 'lease_seconds' => 1234567, + 'lease_seconds' => 1_234_567, 'subscription_state' => 'verified', 'expiration_time' => $t->add(new DateInterval('PT1234567S'))->format('Y-m-d H:i:s'), ]), diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index e399405c..9f634966 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -32,7 +32,7 @@ class AtomStandaloneEntryTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/AtomStandaloneEntry'; + $this->feedSamplePath = __DIR__ . '/_files/AtomStandaloneEntry'; $this->expectedCats = [ [ diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index a2a1d887..93608265 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -31,7 +31,7 @@ class AtomTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/Atom'; + $this->feedSamplePath = __DIR__ . '/_files/Atom'; $this->expectedCats = [ [ 'term' => 'topic1', diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index d697d1ab..80cb94bc 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -28,7 +28,7 @@ class CommonTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/Common'; + $this->feedSamplePath = __DIR__ . '/_files/Common'; } /** diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 525bf1ed..4e5c5839 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -34,7 +34,7 @@ class RssTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/Rss'; + $this->feedSamplePath = __DIR__ . '/_files/Rss'; $this->expectedCats = [ [ diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 28b4a874..6a2562b2 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -34,7 +34,7 @@ class AtomSourceTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/AtomSource'; + $this->feedSamplePath = __DIR__ . '/_files/AtomSource'; $this->expectedCats = [ [ 'term' => 'topic1', diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index eb54d942..67cfb1ac 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -33,7 +33,7 @@ class AtomTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/Atom'; + $this->feedSamplePath = __DIR__ . '/_files/Atom'; $this->expectedCats = [ [ diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 07e94f07..811b6ad4 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -27,7 +27,7 @@ class CommonTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/Common'; + $this->feedSamplePath = __DIR__ . '/_files/Common'; } /** diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 5373d73c..317bdbe1 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -33,7 +33,7 @@ class RssTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/Rss'; + $this->feedSamplePath = __DIR__ . '/_files/Rss'; $this->expectedCats = [ [ diff --git a/test/Reader/Integration/GooglePlayPodcastRss2Test.php b/test/Reader/Integration/GooglePlayPodcastRss2Test.php index b81c3052..4f0836dc 100644 --- a/test/Reader/Integration/GooglePlayPodcastRss2Test.php +++ b/test/Reader/Integration/GooglePlayPodcastRss2Test.php @@ -20,7 +20,7 @@ class GooglePlayPodcastRss2Test extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/google-podcast.xml'; + $this->feedSamplePath = __DIR__ . '/_files/google-podcast.xml'; } /** @@ -294,7 +294,7 @@ public function testCanRetrievePodcastType(): void public function testPodcastTypeIsEpisodicWhenNoTagPresent(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/google-podcast-no-type.xml'; + $feedSamplePath = __DIR__ . '/_files/google-podcast-no-type.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -311,7 +311,7 @@ public function testIsNotCompleteByDefault(): void public function testIsCompleteReturnsTrueWhenTagValueIsYes(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/google-podcast-complete.xml'; + $feedSamplePath = __DIR__ . '/_files/google-podcast-complete.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -320,7 +320,7 @@ public function testIsCompleteReturnsTrueWhenTagValueIsYes(): void public function testIsCompleteReturnsFalseWhenTagValueIsSomethingOtherThanYes(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/google-podcast-incomplete.xml'; + $feedSamplePath = __DIR__ . '/_files/google-podcast-incomplete.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -348,7 +348,7 @@ public function testGetEpisodeTypeReturnsFullIfNoTagPresent(): void public function testGetEpisodeReturnsValueWhenTagPresent(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/google-podcast-episode.xml'; + $feedSamplePath = __DIR__ . '/_files/google-podcast-episode.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -358,7 +358,7 @@ public function testGetEpisodeReturnsValueWhenTagPresent(): void public function testGetEpisodeTypeReturnsValueWhenTagPresent(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/google-podcast-episode.xml'; + $feedSamplePath = __DIR__ . '/_files/google-podcast-episode.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); diff --git a/test/Reader/Integration/HOnlineComAtom10Test.php b/test/Reader/Integration/HOnlineComAtom10Test.php index 8a160a72..ad174cb0 100644 --- a/test/Reader/Integration/HOnlineComAtom10Test.php +++ b/test/Reader/Integration/HOnlineComAtom10Test.php @@ -22,7 +22,7 @@ class HOnlineComAtom10Test extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/h-online.com-atom10.xml'; + $this->feedSamplePath = __DIR__ . '/_files/h-online.com-atom10.xml'; } public function testGetsTitle(): void diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index ed24b8dc..4406de28 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -22,7 +22,7 @@ class LautDeRdfTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/laut.de-rdf.xml'; + $this->feedSamplePath = __DIR__ . '/_files/laut.de-rdf.xml'; } /** diff --git a/test/Reader/Integration/PodcastIndexRss2Test.php b/test/Reader/Integration/PodcastIndexRss2Test.php index 92c6588c..127b5925 100644 --- a/test/Reader/Integration/PodcastIndexRss2Test.php +++ b/test/Reader/Integration/PodcastIndexRss2Test.php @@ -23,7 +23,7 @@ class PodcastIndexRss2Test extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/podcastindex.xml'; + $this->feedSamplePath = __DIR__ . '/_files/podcastindex.xml'; } /** diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index 833688f5..f22ffeef 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -29,7 +29,7 @@ class PodcastRss2Test extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/podcast.xml'; + $this->feedSamplePath = __DIR__ . '/_files/podcast.xml'; } /** @@ -251,9 +251,7 @@ public function testGetsKeywords(): void $expected = str_replace("\r\n", "\n", $expected); /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static function (int $errno, string $errstr): bool { - return (bool) preg_match('/itunes:keywords/', $errstr); - }, E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); $keywords = $entry->getKeywords(); restore_error_handler(); @@ -307,7 +305,7 @@ public function testCanRetrievePodcastType(): void public function testPodcastTypeIsEpisodicWhenNoTagPresent(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/podcast-no-type.xml'; + $feedSamplePath = __DIR__ . '/_files/podcast-no-type.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -324,7 +322,7 @@ public function testIsNotCompleteByDefault(): void public function testIsCompleteReturnsTrueWhenTagValueIsYes(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/podcast-complete.xml'; + $feedSamplePath = __DIR__ . '/_files/podcast-complete.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -333,7 +331,7 @@ public function testIsCompleteReturnsTrueWhenTagValueIsYes(): void public function testIsCompleteReturnsFalseWhenTagValueIsSomethingOtherThanYes(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/podcast-incomplete.xml'; + $feedSamplePath = __DIR__ . '/_files/podcast-incomplete.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -361,7 +359,7 @@ public function testGetEpisodeTypeReturnsFullIfNoTagPresent(): void public function testGetEpisodeReturnsValueWhenTagPresent(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/podcast-episode.xml'; + $feedSamplePath = __DIR__ . '/_files/podcast-episode.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); @@ -371,7 +369,7 @@ public function testGetEpisodeReturnsValueWhenTagPresent(): void public function testGetEpisodeTypeReturnsValueWhenTagPresent(): void { - $feedSamplePath = dirname(__FILE__) . '/_files/podcast-episode.xml'; + $feedSamplePath = __DIR__ . '/_files/podcast-episode.xml'; $feed = Reader\Reader::importString( file_get_contents($feedSamplePath) ); diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 86ed3bd3..94748571 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -23,7 +23,7 @@ class WordpressAtom10Test extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/wordpress-atom10.xml'; + $this->feedSamplePath = __DIR__ . '/_files/wordpress-atom10.xml'; } public function testGetsTitle(): void diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 4ac40af3..15daed8c 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -22,7 +22,7 @@ class WordpressRss2DcAtomTest extends TestCase protected function setUp(): void { Reader\Reader::reset(); - $this->feedSamplePath = dirname(__FILE__) . '/_files/wordpress-rss2-dc-atom.xml'; + $this->feedSamplePath = __DIR__ . '/_files/wordpress-rss2-dc-atom.xml'; } /** diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index 9b7a1be2..129747f2 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -41,7 +41,7 @@ class ReaderTest extends TestCase protected function setUp(): void { - $this->feedSamplePath = dirname(__FILE__) . '/_files'; + $this->feedSamplePath = __DIR__ . '/_files'; } protected function tearDown(): void @@ -153,7 +153,7 @@ public function testDetectsTypeFromStringOrToRemindPaddyAboutForgettingATestWhic public function testGetEncoding(): void { $feed = Reader\Reader::importString( - file_get_contents(dirname(__FILE__) . '/Entry/_files/Atom/title/plain/atom10.xml') + file_get_contents(__DIR__ . '/Entry/_files/Atom/title/plain/atom10.xml') ); $this->assertEquals('utf-8', $feed->getEncoding()); @@ -163,7 +163,7 @@ public function testGetEncoding(): void public function testImportsFile(): void { $feed = Reader\Reader::importFile( - dirname(__FILE__) . '/Entry/_files/Atom/title/plain/atom10.xml' + __DIR__ . '/Entry/_files/Atom/title/plain/atom10.xml' ); $this->assertInstanceOf(FeedInterface::class, $feed); } @@ -378,7 +378,7 @@ public function testReaderEmitsNoticeDuringFeedImportWhenGooglePlayPodcastExtens $notices->messages[] = $errstr; }, E_USER_NOTICE); Reader\Reader::importFile( - dirname(__FILE__) . '/Entry/_files/Atom/title/plain/atom10.xml' + __DIR__ . '/Entry/_files/Atom/title/plain/atom10.xml' ); restore_error_handler(); diff --git a/test/Reader/StandaloneExtensionManagerTest.php b/test/Reader/StandaloneExtensionManagerTest.php index 7efae4b1..e6b2b2ea 100644 --- a/test/Reader/StandaloneExtensionManagerTest.php +++ b/test/Reader/StandaloneExtensionManagerTest.php @@ -12,8 +12,7 @@ class StandaloneExtensionManagerTest extends TestCase { - /** @var StandaloneExtensionManager */ - private $extensions; + private \Laminas\Feed\Reader\StandaloneExtensionManager $extensions; protected function setUp(): void { diff --git a/test/Reader/TestAsset/CustomExtensionManager.php b/test/Reader/TestAsset/CustomExtensionManager.php index a2fcabd3..bde660c1 100644 --- a/test/Reader/TestAsset/CustomExtensionManager.php +++ b/test/Reader/TestAsset/CustomExtensionManager.php @@ -15,7 +15,7 @@ final class CustomExtensionManager implements ExtensionManagerInterface { /** @var array */ - private $extensions = [ + private array $extensions = [ 'Atom\Entry' => Extension\Atom\Entry::class, 'Atom\Feed' => Extension\Atom\Feed::class, 'Content\Entry' => Extension\Content\Entry::class, diff --git a/test/Writer/DeletedTest.php b/test/Writer/DeletedTest.php index 16278c84..36a817df 100644 --- a/test/Writer/DeletedTest.php +++ b/test/Writer/DeletedTest.php @@ -48,8 +48,8 @@ public function testSetWhenDefaultsToCurrentTime(): void public function testSetWhenUsesGivenUnixTimestamp(): void { $entry = new Writer\Deleted(); - $entry->setWhen(1234567890); - $myDate = new DateTime('@' . 1234567890); + $entry->setWhen(1_234_567_890); + $myDate = new DateTime('@' . 1_234_567_890); $this->assertEquals($myDate, $entry->getWhen()); } @@ -59,8 +59,8 @@ public function testSetWhenUsesGivenUnixTimestamp(): void public function testSetWhenUsesGivenUnixTimestampWhenItIsLessThanTenDigits(): void { $entry = new Writer\Deleted(); - $entry->setWhen(123456789); - $myDate = new DateTime('@' . 123456789); + $entry->setWhen(123_456_789); + $myDate = new DateTime('@' . 123_456_789); $this->assertEquals($myDate, $entry->getWhen()); } @@ -77,7 +77,7 @@ public function testSetWhenUsesGivenUnixTimestampWhenItIsAVerySmallInteger(): vo public function testSetWhenUsesDateTimeObject(): void { - $myDate = new DateTime('@' . 1234567890); + $myDate = new DateTime('@' . 1_234_567_890); $entry = new Writer\Deleted(); $entry->setWhen($myDate); $this->assertEquals($myDate, $entry->getWhen()); @@ -85,7 +85,7 @@ public function testSetWhenUsesDateTimeObject(): void public function testSetWhenUsesDateTimeImmutableObject(): void { - $myDate = new DateTimeImmutable('@' . 1234567890); + $myDate = new DateTimeImmutable('@' . 1_234_567_890); $entry = new Writer\Deleted(); $entry->setWhen($myDate); $this->assertEquals($myDate, $entry->getWhen()); diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index a7384817..281e1976 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -33,7 +33,7 @@ class EntryTest extends TestCase protected function setUp(): void { - $this->feedSamplePath = dirname(__FILE__) . '/_files'; + $this->feedSamplePath = __DIR__ . '/_files'; Writer\Writer::reset(); } @@ -225,8 +225,8 @@ public function testSetDateCreatedDefaultsToCurrentTime(): void public function testSetDateCreatedUsesGivenUnixTimestamp(): void { $entry = new Writer\Entry(); - $entry->setDateCreated(1234567890); - $myDate = new DateTime('@' . 1234567890); + $entry->setDateCreated(1_234_567_890); + $myDate = new DateTime('@' . 1_234_567_890); $this->assertEquals($myDate, $entry->getDateCreated()); } @@ -236,8 +236,8 @@ public function testSetDateCreatedUsesGivenUnixTimestamp(): void public function testSetDateCreatedUsesGivenUnixTimestampWhenItIsLessThanTenDigits(): void { $entry = new Writer\Entry(); - $entry->setDateCreated(123456789); - $myDate = new DateTime('@' . 123456789); + $entry->setDateCreated(123_456_789); + $myDate = new DateTime('@' . 123_456_789); $this->assertEquals($myDate, $entry->getDateCreated()); } @@ -254,7 +254,7 @@ public function testSetDateCreatedUsesGivenUnixTimestampWhenItIsAVerySmallIntege public function testSetDateCreatedUsesDateTimeObject(): void { - $myDate = new DateTime('@' . 1234567890); + $myDate = new DateTime('@' . 1_234_567_890); $entry = new Writer\Entry(); $entry->setDateCreated($myDate); $this->assertEquals($myDate, $entry->getDateCreated()); @@ -262,7 +262,7 @@ public function testSetDateCreatedUsesDateTimeObject(): void public function testSetDateCreatedUsesDateTimeImmutableObject(): void { - $myDate = new DateTimeImmutable('@' . 1234567890); + $myDate = new DateTimeImmutable('@' . 1_234_567_890); $entry = new Writer\Entry(); $entry->setDateCreated($myDate); $this->assertEquals($myDate, $entry->getDateCreated()); @@ -279,8 +279,8 @@ public function testSetDateModifiedDefaultsToCurrentTime(): void public function testSetDateModifiedUsesGivenUnixTimestamp(): void { $entry = new Writer\Entry(); - $entry->setDateModified(1234567890); - $myDate = new DateTime('@' . 1234567890); + $entry->setDateModified(1_234_567_890); + $myDate = new DateTime('@' . 1_234_567_890); $this->assertEquals($myDate, $entry->getDateModified()); } @@ -290,8 +290,8 @@ public function testSetDateModifiedUsesGivenUnixTimestamp(): void public function testSetDateModifiedUsesGivenUnixTimestampWhenItIsLessThanTenDigits(): void { $entry = new Writer\Entry(); - $entry->setDateModified(123456789); - $myDate = new DateTime('@' . 123456789); + $entry->setDateModified(123_456_789); + $myDate = new DateTime('@' . 123_456_789); $this->assertEquals($myDate, $entry->getDateModified()); } @@ -308,7 +308,7 @@ public function testSetDateModifiedUsesGivenUnixTimestampWhenItIsAVerySmallInteg public function testSetDateModifiedUsesDateTimeObject(): void { - $myDate = new DateTime('@' . 1234567890); + $myDate = new DateTime('@' . 1_234_567_890); $entry = new Writer\Entry(); $entry->setDateModified($myDate); $this->assertEquals($myDate, $entry->getDateModified()); @@ -316,7 +316,7 @@ public function testSetDateModifiedUsesDateTimeObject(): void public function testSetDateModifiedUsesDateTimeImmutableObject(): void { - $myDate = new DateTimeImmutable('@' . 1234567890); + $myDate = new DateTimeImmutable('@' . 1_234_567_890); $entry = new Writer\Entry(); $entry->setDateModified($myDate); $this->assertEquals($myDate, $entry->getDateModified()); diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 7161bdc2..1c5d22ad 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -166,9 +166,7 @@ public function testSetKeywords(): void $words = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12']; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static function (int $errno, string $errstr): bool { - return (bool) preg_match('/itunes:keywords/', $errstr); - }, E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); $entry->setItunesKeywords($words); restore_error_handler(); @@ -181,9 +179,7 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded(): void $words = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13']; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static function (int $errno, string $errstr): bool { - return (bool) preg_match('/itunes:keywords/', $errstr); - }, E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class); @@ -202,9 +198,7 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static function (int $errno, string $errstr): bool { - return (bool) preg_match('/itunes:keywords/', $errstr); - }, E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class); diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index bd6bb081..9128bea3 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -232,9 +232,7 @@ public function testSetKeywords(): void ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static function (int $errno, string $errstr): bool { - return (bool) preg_match('/itunes:keywords/', $errstr); - }, E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); $feed->setItunesKeywords($words); restore_error_handler(); @@ -261,9 +259,7 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded(): void ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static function (int $errno, string $errstr): bool { - return (bool) preg_match('/itunes:keywords/', $errstr); - }, E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class); @@ -282,9 +278,7 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static function (int $errno, string $errstr): bool { - return (bool) preg_match('/itunes:keywords/', $errstr); - }, E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class); diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 35b5b138..16ad03ee 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -33,7 +33,7 @@ class FeedTest extends TestCase protected function setUp(): void { - $this->feedSamplePath = dirname(__FILE__) . '/Writer/_files'; + $this->feedSamplePath = __DIR__ . '/Writer/_files'; Writer\Writer::reset(); } @@ -160,8 +160,8 @@ public function testSetDateCreatedDefaultsToCurrentTime(): void public function testSetDateCreatedUsesGivenUnixTimestamp(): void { $writer = new Writer\Feed(); - $writer->setDateCreated(1234567890); - $myDate = new DateTime('@' . 1234567890); + $writer->setDateCreated(1_234_567_890); + $myDate = new DateTime('@' . 1_234_567_890); $this->assertEquals($myDate, $writer->getDateCreated()); } @@ -171,8 +171,8 @@ public function testSetDateCreatedUsesGivenUnixTimestamp(): void public function testSetDateCreatedUsesGivenUnixTimestampThatIsLessThanTenDigits(): void { $writer = new Writer\Feed(); - $writer->setDateCreated(123456789); - $myDate = new DateTime('@' . 123456789); + $writer->setDateCreated(123_456_789); + $myDate = new DateTime('@' . 123_456_789); $this->assertEquals($myDate, $writer->getDateCreated()); } @@ -189,7 +189,7 @@ public function testSetDateCreatedUsesGivenUnixTimestampThatIsAVerySmallInteger( public function testSetDateCreatedUsesDateTimeObject(): void { - $myDate = new DateTime('@' . 1234567890); + $myDate = new DateTime('@' . 1_234_567_890); $writer = new Writer\Feed(); $writer->setDateCreated($myDate); $this->assertEquals($myDate, $writer->getDateCreated()); @@ -197,7 +197,7 @@ public function testSetDateCreatedUsesDateTimeObject(): void public function testSetDateCreatedUsesDateTimeImmutableObject(): void { - $myDate = new DateTimeImmutable('@' . 1234567890); + $myDate = new DateTimeImmutable('@' . 1_234_567_890); $writer = new Writer\Feed(); $writer->setDateCreated($myDate); $this->assertEquals($myDate, $writer->getDateCreated()); @@ -214,8 +214,8 @@ public function testSetDateModifiedDefaultsToCurrentTime(): void public function testSetDateModifiedUsesGivenUnixTimestamp(): void { $writer = new Writer\Feed(); - $writer->setDateModified(1234567890); - $myDate = new DateTime('@' . 1234567890); + $writer->setDateModified(1_234_567_890); + $myDate = new DateTime('@' . 1_234_567_890); $this->assertEquals($myDate, $writer->getDateModified()); } @@ -225,8 +225,8 @@ public function testSetDateModifiedUsesGivenUnixTimestamp(): void public function testSetDateModifiedUsesGivenUnixTimestampThatIsLessThanTenDigits(): void { $writer = new Writer\Feed(); - $writer->setDateModified(123456789); - $myDate = new DateTime('@' . 123456789); + $writer->setDateModified(123_456_789); + $myDate = new DateTime('@' . 123_456_789); $this->assertEquals($myDate, $writer->getDateModified()); } @@ -243,7 +243,7 @@ public function testSetDateModifiedUsesGivenUnixTimestampThatIsAVerySmallInteger public function testSetDateModifiedUsesDateTimeObject(): void { - $myDate = new DateTime('@' . 1234567890); + $myDate = new DateTime('@' . 1_234_567_890); $writer = new Writer\Feed(); $writer->setDateModified($myDate); $this->assertEquals($myDate, $writer->getDateModified()); @@ -251,7 +251,7 @@ public function testSetDateModifiedUsesDateTimeObject(): void public function testSetDateModifiedUsesDateTimeImmutableObject(): void { - $myDate = new DateTimeImmutable('@' . 1234567890); + $myDate = new DateTimeImmutable('@' . 1_234_567_890); $writer = new Writer\Feed(); $writer->setDateModified($myDate); $this->assertEquals($myDate, $writer->getDateModified()); @@ -296,8 +296,8 @@ public function testSetLastBuildDateDefaultsToCurrentTime(): void public function testSetLastBuildDateUsesGivenUnixTimestamp(): void { $writer = new Writer\Feed(); - $writer->setLastBuildDate(1234567890); - $myDate = new DateTime('@' . 1234567890); + $writer->setLastBuildDate(1_234_567_890); + $myDate = new DateTime('@' . 1_234_567_890); $this->assertEquals($myDate, $writer->getLastBuildDate()); } @@ -307,8 +307,8 @@ public function testSetLastBuildDateUsesGivenUnixTimestamp(): void public function testSetLastBuildDateUsesGivenUnixTimestampThatIsLessThanTenDigits(): void { $writer = new Writer\Feed(); - $writer->setLastBuildDate(123456789); - $myDate = new DateTime('@' . 123456789); + $writer->setLastBuildDate(123_456_789); + $myDate = new DateTime('@' . 123_456_789); $this->assertEquals($myDate, $writer->getLastBuildDate()); } @@ -325,7 +325,7 @@ public function testSetLastBuildDateUsesGivenUnixTimestampThatIsAVerySmallIntege public function testSetLastBuildDateUsesDateTimeObject(): void { - $myDate = new DateTime('@' . 1234567890); + $myDate = new DateTime('@' . 1_234_567_890); $writer = new Writer\Feed(); $writer->setLastBuildDate($myDate); $this->assertEquals($myDate, $writer->getLastBuildDate()); @@ -333,7 +333,7 @@ public function testSetLastBuildDateUsesDateTimeObject(): void public function testSetLastBuildDateUsesDateTimeImmutableObject(): void { - $myDate = new DateTimeImmutable('@' . 1234567890); + $myDate = new DateTimeImmutable('@' . 1_234_567_890); $writer = new Writer\Feed(); $writer->setLastBuildDate($myDate); $this->assertEquals($myDate, $writer->getLastBuildDate()); @@ -905,13 +905,13 @@ public function testAddsAndOrdersEntriesByDateIfRequested(): void { $writer = new Writer\Feed(); $entry = $writer->createEntry(); - $entry->setDateCreated(1234567890); + $entry->setDateCreated(1_234_567_890); $entry2 = $writer->createEntry(); - $entry2->setDateCreated(1230000000); + $entry2->setDateCreated(1_230_000_000); $writer->addEntry($entry); $writer->addEntry($entry2); $writer->orderByDate(); - $this->assertEquals(1230000000, $writer->getEntry(1)->getDateCreated()->getTimestamp()); + $this->assertEquals(1_230_000_000, $writer->getEntry(1)->getDateCreated()->getTimestamp()); } /** @@ -921,13 +921,13 @@ public function testAddsAndOrdersEntriesByModifiedDate(): void { $writer = new Writer\Feed(); $entry = $writer->createEntry(); - $entry->setDateModified(1234567890); + $entry->setDateModified(1_234_567_890); $entry2 = $writer->createEntry(); - $entry2->setDateModified(1230000000); + $entry2->setDateModified(1_230_000_000); $writer->addEntry($entry); $writer->addEntry($entry2); $writer->orderByDate(); - $this->assertEquals(1230000000, $writer->getEntry(1)->getDateModified()->getTimestamp()); + $this->assertEquals(1_230_000_000, $writer->getEntry(1)->getDateModified()->getTimestamp()); } /** @@ -960,11 +960,11 @@ public function testRemoveEntry(): void { $writer = new Writer\Feed(); $entry = $writer->createEntry(); - $entry->setDateCreated(1234567890); + $entry->setDateCreated(1_234_567_890); $entry2 = $writer->createEntry(); - $entry2->setDateCreated(1230000000); + $entry2->setDateCreated(1_230_000_000); $entry3 = $writer->createEntry(); - $entry3->setDateCreated(1239999999); + $entry3->setDateCreated(1_239_999_999); $writer->addEntry($entry); $writer->addEntry($entry2); diff --git a/test/Writer/Renderer/Entry/AtomTest.php b/test/Writer/Renderer/Entry/AtomTest.php index b474992c..015884af 100644 --- a/test/Writer/Renderer/Entry/AtomTest.php +++ b/test/Writer/Renderer/Entry/AtomTest.php @@ -39,7 +39,7 @@ protected function setUp(): void $this->validWriter->setType('atom'); $this->validWriter->setTitle('This is a test feed.'); $this->validWriter->setDescription('This is a test description.'); - $this->validWriter->setDateModified(1234567890); + $this->validWriter->setDateModified(1_234_567_890); $this->validWriter->setLink('http://www.example.com'); $this->validWriter->setFeedLink('http://www.example.com/atom', 'atom'); $this->validWriter->addAuthor([ @@ -51,8 +51,8 @@ protected function setUp(): void $this->validEntry = $this->validWriter->createEntry(); $this->validEntry->setTitle('This is a test entry.'); $this->validEntry->setDescription('This is a test entry description.'); - $this->validEntry->setDateModified(1234567890); - $this->validEntry->setDateCreated(1234567000); + $this->validEntry->setDateModified(1_234_567_890); + $this->validEntry->setDateCreated(1_234_567_000); $this->validEntry->setLink('http://www.example.com/1'); $this->validEntry->addAuthor([ 'name' => 'Jane', @@ -146,7 +146,7 @@ public function testEntryUpdatedDateHasBeenSet(): void $renderer = new Renderer\Feed\Atom($this->validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->getTimestamp()); + $this->assertEquals(1_234_567_890, $entry->getDateModified()->getTimestamp()); } public function testFeedUpdatedDateIfMissingThrowsException(): void @@ -163,7 +163,7 @@ public function testEntryPublishedDateHasBeenSet(): void $renderer = new Renderer\Feed\Atom($this->validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->getTimestamp()); + $this->assertEquals(1_234_567_000, $entry->getDateCreated()->getTimestamp()); } public function testEntryIncludesLinkToHtmlVersionOfFeed(): void diff --git a/test/Writer/Renderer/Entry/RssTest.php b/test/Writer/Renderer/Entry/RssTest.php index 986adc4a..f18d8db0 100644 --- a/test/Writer/Renderer/Entry/RssTest.php +++ b/test/Writer/Renderer/Entry/RssTest.php @@ -153,20 +153,20 @@ public function testEntryContentCharDataEncoding(): void public function testEntryUpdatedDateHasBeenSet(): void { - $this->validEntry->setDateModified(1234567890); + $this->validEntry->setDateModified(1_234_567_890); $renderer = new Renderer\Feed\Rss($this->validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567890, $entry->getDateModified()->getTimestamp()); + $this->assertEquals(1_234_567_890, $entry->getDateModified()->getTimestamp()); } public function testEntryPublishedDateHasBeenSet(): void { - $this->validEntry->setDateCreated(1234567000); + $this->validEntry->setDateCreated(1_234_567_000); $renderer = new Renderer\Feed\Rss($this->validWriter); $feed = Reader\Reader::importString($renderer->render()->saveXml()); $entry = $feed->current(); - $this->assertEquals(1234567000, $entry->getDateCreated()->getTimestamp()); + $this->assertEquals(1_234_567_000, $entry->getDateCreated()->getTimestamp()); } public function testEntryIncludesLinkToHtmlVersionOfFeed(): void diff --git a/test/Writer/Renderer/Feed/AtomTest.php b/test/Writer/Renderer/Feed/AtomTest.php index 2da68103..7eb98852 100644 --- a/test/Writer/Renderer/Feed/AtomTest.php +++ b/test/Writer/Renderer/Feed/AtomTest.php @@ -36,7 +36,7 @@ protected function setUp(): void $this->validWriter = new Writer\Feed(); $this->validWriter->setTitle('This is a test feed.'); $this->validWriter->setDescription('This is a test description.'); - $this->validWriter->setDateModified(1234567890); + $this->validWriter->setDateModified(1_234_567_890); $this->validWriter->setLink('http://www.example.com'); $this->validWriter->setFeedLink('http://www.example.com/atom', 'atom'); $this->validWriter->addAuthor([ @@ -85,7 +85,7 @@ public function testFeedEncodingHasBeenSet(): void public function testDateModifiedHasTheCorrectFormat(): void { $date = new DateTime(); - $date->setTimestamp(1071336602); + $date->setTimestamp(1_071_336_602); $date->setTimezone(new DateTimeZone('GMT')); $this->validWriter->setDateModified($date); $atomFeed = new Renderer\Feed\Atom($this->validWriter); @@ -168,7 +168,7 @@ public function testFeedUpdatedDateHasBeenSet(): void $atomFeed = new Renderer\Feed\Atom($this->validWriter); $atomFeed->render(); $feed = Reader\Reader::importString($atomFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->getTimestamp()); + $this->assertEquals(1_234_567_890, $feed->getDateModified()->getTimestamp()); } public function testFeedUpdatedDateIfMissingThrowsException(): void diff --git a/test/Writer/Renderer/Feed/RssTest.php b/test/Writer/Renderer/Feed/RssTest.php index 2025aa5f..7c4a52d1 100644 --- a/test/Writer/Renderer/Feed/RssTest.php +++ b/test/Writer/Renderer/Feed/RssTest.php @@ -140,11 +140,11 @@ public function testFeedDescriptionCharDataEncoding(): void public function testFeedUpdatedDateHasBeenSet(): void { - $this->validWriter->setDateModified(1234567890); + $this->validWriter->setDateModified(1_234_567_890); $rssFeed = new Renderer\Feed\Rss($this->validWriter); $rssFeed->render(); $feed = Reader\Reader::importString($rssFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getDateModified()->getTimestamp()); + $this->assertEquals(1_234_567_890, $feed->getDateModified()->getTimestamp()); } /** @@ -159,11 +159,11 @@ public function testFeedUpdatedDateIfMissingThrowsNoException(): void public function testFeedLastBuildDateHasBeenSet(): void { - $this->validWriter->setLastBuildDate(1234567890); + $this->validWriter->setLastBuildDate(1_234_567_890); $rssFeed = new Renderer\Feed\Rss($this->validWriter); $rssFeed->render(); $feed = Reader\Reader::importString($rssFeed->saveXml()); - $this->assertEquals(1234567890, $feed->getLastBuildDate()->getTimestamp()); + $this->assertEquals(1_234_567_890, $feed->getLastBuildDate()->getTimestamp()); } public function testFeedGeneratorHasBeenSet(): void @@ -605,11 +605,11 @@ public function testImageThrowsExceptionIfOptionalWidthGreaterThan144(): void public function testFeedSetDateCreated(): void { - $this->validWriter->setDateCreated(1234567890); + $this->validWriter->setDateCreated(1_234_567_890); $rssFeed = new Renderer\Feed\Rss($this->validWriter); $rssFeed->render(); $feed = Reader\Reader::importString($rssFeed->saveXml()); - $myDate = new DateTime('@' . 1234567890); + $myDate = new DateTime('@' . 1_234_567_890); $this->assertEquals($myDate, $feed->getDateCreated()); } diff --git a/test/Writer/StandaloneExtensionManagerTest.php b/test/Writer/StandaloneExtensionManagerTest.php index 7254e3c1..57ee0663 100644 --- a/test/Writer/StandaloneExtensionManagerTest.php +++ b/test/Writer/StandaloneExtensionManagerTest.php @@ -12,8 +12,7 @@ class StandaloneExtensionManagerTest extends TestCase { - /** @var StandaloneExtensionManager */ - private $extensions; + private \Laminas\Feed\Writer\StandaloneExtensionManager $extensions; protected function setUp(): void { diff --git a/test/Writer/TestAsset/CustomExtensionManager.php b/test/Writer/TestAsset/CustomExtensionManager.php index 13907956..e06a1481 100644 --- a/test/Writer/TestAsset/CustomExtensionManager.php +++ b/test/Writer/TestAsset/CustomExtensionManager.php @@ -14,7 +14,7 @@ class CustomExtensionManager implements ExtensionManagerInterface { /** @var array */ - private $extensions = [ + private array $extensions = [ 'Atom\Renderer\Feed' => Extension\Atom\Renderer\Feed::class, 'Content\Renderer\Entry' => Extension\Content\Renderer\Entry::class, 'DublinCore\Renderer\Entry' => Extension\DublinCore\Renderer\Entry::class, From 69c474f075331fb6e9a5b57687a11b011b140dca Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 19 Jul 2022 15:35:05 +0700 Subject: [PATCH 2/4] cs fix Signed-off-by: Abdul Malik Ikhsan --- test/Reader/Entry/AtomStandaloneEntryTest.php | 1 - test/Reader/Entry/AtomTest.php | 1 - test/Reader/Entry/CommonTest.php | 1 - test/Reader/Entry/RssTest.php | 1 - test/Reader/Feed/AtomSourceTest.php | 1 - test/Reader/Feed/AtomTest.php | 1 - test/Reader/Feed/CommonTest.php | 1 - test/Reader/Feed/RssTest.php | 1 - test/Reader/Integration/GooglePlayPodcastRss2Test.php | 1 - test/Reader/Integration/HOnlineComAtom10Test.php | 1 - test/Reader/Integration/LautDeRdfTest.php | 1 - test/Reader/Integration/PodcastIndexRss2Test.php | 1 - test/Reader/Integration/PodcastRss2Test.php | 1 - test/Reader/Integration/WordpressAtom10Test.php | 1 - test/Reader/Integration/WordpressRss2DcAtomTest.php | 1 - test/Reader/ReaderTest.php | 1 - test/Reader/StandaloneExtensionManagerTest.php | 2 +- test/Writer/EntryTest.php | 1 - test/Writer/FeedTest.php | 1 - test/Writer/StandaloneExtensionManagerTest.php | 2 +- 20 files changed, 2 insertions(+), 20 deletions(-) diff --git a/test/Reader/Entry/AtomStandaloneEntryTest.php b/test/Reader/Entry/AtomStandaloneEntryTest.php index 9f634966..4edd9c12 100644 --- a/test/Reader/Entry/AtomStandaloneEntryTest.php +++ b/test/Reader/Entry/AtomStandaloneEntryTest.php @@ -11,7 +11,6 @@ use stdClass; use function array_values; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Entry/AtomTest.php b/test/Reader/Entry/AtomTest.php index 93608265..40a4f0a2 100644 --- a/test/Reader/Entry/AtomTest.php +++ b/test/Reader/Entry/AtomTest.php @@ -10,7 +10,6 @@ use stdClass; use function array_values; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Entry/CommonTest.php b/test/Reader/Entry/CommonTest.php index 80cb94bc..80a5482b 100644 --- a/test/Reader/Entry/CommonTest.php +++ b/test/Reader/Entry/CommonTest.php @@ -12,7 +12,6 @@ use Laminas\Feed\Reader\Extension\Atom\Entry; use PHPUnit\Framework\TestCase; -use function dirname; use function file_get_contents; use function str_replace; diff --git a/test/Reader/Entry/RssTest.php b/test/Reader/Entry/RssTest.php index 4e5c5839..e217da28 100644 --- a/test/Reader/Entry/RssTest.php +++ b/test/Reader/Entry/RssTest.php @@ -10,7 +10,6 @@ use function array_values; use function assert; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Feed/AtomSourceTest.php b/test/Reader/Feed/AtomSourceTest.php index 6a2562b2..d4d83558 100644 --- a/test/Reader/Feed/AtomSourceTest.php +++ b/test/Reader/Feed/AtomSourceTest.php @@ -10,7 +10,6 @@ use PHPUnit\Framework\TestCase; use function array_values; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Feed/AtomTest.php b/test/Reader/Feed/AtomTest.php index 67cfb1ac..45e5a595 100644 --- a/test/Reader/Feed/AtomTest.php +++ b/test/Reader/Feed/AtomTest.php @@ -9,7 +9,6 @@ use PHPUnit\Framework\TestCase; use function array_values; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Feed/CommonTest.php b/test/Reader/Feed/CommonTest.php index 811b6ad4..3b397e7c 100644 --- a/test/Reader/Feed/CommonTest.php +++ b/test/Reader/Feed/CommonTest.php @@ -11,7 +11,6 @@ use Laminas\Feed\Reader\Extension\Atom\Feed; use PHPUnit\Framework\TestCase; -use function dirname; use function file_get_contents; use function str_replace; diff --git a/test/Reader/Feed/RssTest.php b/test/Reader/Feed/RssTest.php index 317bdbe1..fdf35723 100644 --- a/test/Reader/Feed/RssTest.php +++ b/test/Reader/Feed/RssTest.php @@ -9,7 +9,6 @@ use function array_values; use function assert; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Integration/GooglePlayPodcastRss2Test.php b/test/Reader/Integration/GooglePlayPodcastRss2Test.php index 4f0836dc..8b3efc58 100644 --- a/test/Reader/Integration/GooglePlayPodcastRss2Test.php +++ b/test/Reader/Integration/GooglePlayPodcastRss2Test.php @@ -8,7 +8,6 @@ use PHPUnit\Framework\TestCase; use stdClass; -use function dirname; use function file_get_contents; use function str_replace; diff --git a/test/Reader/Integration/HOnlineComAtom10Test.php b/test/Reader/Integration/HOnlineComAtom10Test.php index ad174cb0..dff65995 100644 --- a/test/Reader/Integration/HOnlineComAtom10Test.php +++ b/test/Reader/Integration/HOnlineComAtom10Test.php @@ -7,7 +7,6 @@ use Laminas\Feed\Reader; use PHPUnit\Framework\TestCase; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Integration/LautDeRdfTest.php b/test/Reader/Integration/LautDeRdfTest.php index 4406de28..a8473e63 100644 --- a/test/Reader/Integration/LautDeRdfTest.php +++ b/test/Reader/Integration/LautDeRdfTest.php @@ -7,7 +7,6 @@ use Laminas\Feed\Reader; use PHPUnit\Framework\TestCase; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Integration/PodcastIndexRss2Test.php b/test/Reader/Integration/PodcastIndexRss2Test.php index 127b5925..9314be2a 100644 --- a/test/Reader/Integration/PodcastIndexRss2Test.php +++ b/test/Reader/Integration/PodcastIndexRss2Test.php @@ -8,7 +8,6 @@ use PHPUnit\Framework\TestCase; use stdClass; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index f22ffeef..e3e3d9c5 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -8,7 +8,6 @@ use PHPUnit\Framework\TestCase; use stdClass; -use function dirname; use function file_get_contents; use function preg_match; use function restore_error_handler; diff --git a/test/Reader/Integration/WordpressAtom10Test.php b/test/Reader/Integration/WordpressAtom10Test.php index 94748571..eb77c321 100644 --- a/test/Reader/Integration/WordpressAtom10Test.php +++ b/test/Reader/Integration/WordpressAtom10Test.php @@ -7,7 +7,6 @@ use Laminas\Feed\Reader; use PHPUnit\Framework\TestCase; -use function dirname; use function file_get_contents; use function str_replace; diff --git a/test/Reader/Integration/WordpressRss2DcAtomTest.php b/test/Reader/Integration/WordpressRss2DcAtomTest.php index 15daed8c..6a804f0c 100644 --- a/test/Reader/Integration/WordpressRss2DcAtomTest.php +++ b/test/Reader/Integration/WordpressRss2DcAtomTest.php @@ -7,7 +7,6 @@ use Laminas\Feed\Reader; use PHPUnit\Framework\TestCase; -use function dirname; use function file_get_contents; /** diff --git a/test/Reader/ReaderTest.php b/test/Reader/ReaderTest.php index 129747f2..c344b80d 100644 --- a/test/Reader/ReaderTest.php +++ b/test/Reader/ReaderTest.php @@ -20,7 +20,6 @@ use stdClass; use function array_reduce; -use function dirname; use function file_get_contents; use function getenv; use function restore_error_handler; diff --git a/test/Reader/StandaloneExtensionManagerTest.php b/test/Reader/StandaloneExtensionManagerTest.php index e6b2b2ea..1c442674 100644 --- a/test/Reader/StandaloneExtensionManagerTest.php +++ b/test/Reader/StandaloneExtensionManagerTest.php @@ -12,7 +12,7 @@ class StandaloneExtensionManagerTest extends TestCase { - private \Laminas\Feed\Reader\StandaloneExtensionManager $extensions; + private StandaloneExtensionManager $extensions; protected function setUp(): void { diff --git a/test/Writer/EntryTest.php b/test/Writer/EntryTest.php index 281e1976..25d20a1f 100644 --- a/test/Writer/EntryTest.php +++ b/test/Writer/EntryTest.php @@ -14,7 +14,6 @@ use stdClass; use function array_reduce; -use function dirname; use function restore_error_handler; use function set_error_handler; use function strstr; diff --git a/test/Writer/FeedTest.php b/test/Writer/FeedTest.php index 16ad03ee..5ff3c8ad 100644 --- a/test/Writer/FeedTest.php +++ b/test/Writer/FeedTest.php @@ -14,7 +14,6 @@ use PHPUnit\Framework\TestCase; use function array_reduce; -use function dirname; use function restore_error_handler; use function set_error_handler; use function str_replace; diff --git a/test/Writer/StandaloneExtensionManagerTest.php b/test/Writer/StandaloneExtensionManagerTest.php index 57ee0663..9b2c6c3e 100644 --- a/test/Writer/StandaloneExtensionManagerTest.php +++ b/test/Writer/StandaloneExtensionManagerTest.php @@ -12,7 +12,7 @@ class StandaloneExtensionManagerTest extends TestCase { - private \Laminas\Feed\Writer\StandaloneExtensionManager $extensions; + private StandaloneExtensionManager $extensions; protected function setUp(): void { From 0eb8e74c1c38501d55d47ee3cd5cd09bc68b244a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 19 Jul 2022 15:36:40 +0700 Subject: [PATCH 3/4] rollback apache_request_headers Signed-off-by: Abdul Malik Ikhsan --- src/PubSubHubbub/AbstractCallback.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PubSubHubbub/AbstractCallback.php b/src/PubSubHubbub/AbstractCallback.php index 3528a890..9b2b868c 100644 --- a/src/PubSubHubbub/AbstractCallback.php +++ b/src/PubSubHubbub/AbstractCallback.php @@ -299,7 +299,7 @@ protected function _getHeader($header) return $_SERVER[$temp]; } if (function_exists('apache_request_headers')) { - $headers = getallheaders(); + $headers = apache_request_headers(); if (! empty($headers[$header])) { return $headers[$header]; } From b511c6d1ed49983ca459f2e34745cd4a2d9f2c0f Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Tue, 19 Jul 2022 15:39:28 +0700 Subject: [PATCH 4/4] cs fix Signed-off-by: Abdul Malik Ikhsan --- test/Reader/Integration/PodcastRss2Test.php | 3 ++- test/Writer/Extension/ITunes/EntryTest.php | 9 ++++++--- test/Writer/Extension/ITunes/FeedTest.php | 9 ++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/test/Reader/Integration/PodcastRss2Test.php b/test/Reader/Integration/PodcastRss2Test.php index e3e3d9c5..6b6cd579 100644 --- a/test/Reader/Integration/PodcastRss2Test.php +++ b/test/Reader/Integration/PodcastRss2Test.php @@ -250,7 +250,8 @@ public function testGetsKeywords(): void $expected = str_replace("\r\n", "\n", $expected); /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => + (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); $keywords = $entry->getKeywords(); restore_error_handler(); diff --git a/test/Writer/Extension/ITunes/EntryTest.php b/test/Writer/Extension/ITunes/EntryTest.php index 1c5d22ad..b0b55b48 100644 --- a/test/Writer/Extension/ITunes/EntryTest.php +++ b/test/Writer/Extension/ITunes/EntryTest.php @@ -166,7 +166,8 @@ public function testSetKeywords(): void $words = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12']; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => + (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); $entry->setItunesKeywords($words); restore_error_handler(); @@ -179,7 +180,8 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded(): void $words = ['a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10', 'a11', 'a12', 'a13']; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => + (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class); @@ -198,7 +200,8 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => + (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class); diff --git a/test/Writer/Extension/ITunes/FeedTest.php b/test/Writer/Extension/ITunes/FeedTest.php index 9128bea3..cd7fa647 100644 --- a/test/Writer/Extension/ITunes/FeedTest.php +++ b/test/Writer/Extension/ITunes/FeedTest.php @@ -232,7 +232,8 @@ public function testSetKeywords(): void ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => + (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); $feed->setItunesKeywords($words); restore_error_handler(); @@ -259,7 +260,8 @@ public function testSetKeywordsThrowsExceptionIfMaxKeywordsExceeded(): void ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => + (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class); @@ -278,7 +280,8 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL ]; /** @psalm-suppress UnusedClosureParam */ - set_error_handler(static fn(int $errno, string $errstr): bool => (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); + set_error_handler(static fn(int $errno, string $errstr): bool => + (bool) preg_match('/itunes:keywords/', $errstr), E_USER_DEPRECATED); try { $this->expectException(ExceptionInterface::class);