Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply PHP 7.4 syntax and typed property #58

Merged
merged 4 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Reader/Http/LaminasHttpClientDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

class LaminasHttpClientDecorator implements HeaderAwareClientInterface
{
/** @var LaminasHttpClient */
private $client;
private LaminasHttpClient $client;

public function __construct(LaminasHttpClient $client)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Reader/Http/Psr7ResponseDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
*/
class Psr7ResponseDecorator implements HeaderAwareResponseInterface
{
/** @var Psr7ResponseInterface */
private $decoratedResponse;
private Psr7ResponseInterface $decoratedResponse;

public function __construct(Psr7ResponseInterface $response)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Reader/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Reader/StandaloneExtensionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class StandaloneExtensionManager implements ExtensionManagerInterface
{
/** @var array<string, class-string> */
private $extensions = [
private array $extensions = [
'Atom\Entry' => Extension\Atom\Entry::class,
'Atom\Feed' => Extension\Atom\Feed::class,
'Content\Entry' => Extension\Content\Entry::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Writer/StandaloneExtensionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class StandaloneExtensionManager implements ExtensionManagerInterface
{
/** @var array<string, class-string> */
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,
Expand Down
2 changes: 1 addition & 1 deletion test/PubSubHubbub/Subscriber/CallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]),
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Entry/AtomStandaloneEntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use stdClass;

use function array_values;
use function dirname;
use function file_get_contents;

/**
Expand All @@ -32,7 +31,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 = [
[
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Entry/AtomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use stdClass;

use function array_values;
use function dirname;
use function file_get_contents;

/**
Expand All @@ -31,7 +30,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',
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Entry/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -28,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';
}

/**
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Entry/RssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use function array_values;
use function assert;
use function dirname;
use function file_get_contents;

/**
Expand All @@ -34,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 = [
[
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Feed/AtomSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use PHPUnit\Framework\TestCase;

use function array_values;
use function dirname;
use function file_get_contents;

/**
Expand All @@ -34,7 +33,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',
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Feed/AtomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use PHPUnit\Framework\TestCase;

use function array_values;
use function dirname;
use function file_get_contents;

/**
Expand All @@ -33,7 +32,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 = [
[
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Feed/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -27,7 +26,7 @@ class CommonTest extends TestCase
protected function setUp(): void
{
Reader\Reader::reset();
$this->feedSamplePath = dirname(__FILE__) . '/_files/Common';
$this->feedSamplePath = __DIR__ . '/_files/Common';
}

/**
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Feed/RssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

use function array_values;
use function assert;
use function dirname;
use function file_get_contents;

/**
Expand All @@ -33,7 +32,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 = [
[
Expand Down
13 changes: 6 additions & 7 deletions test/Reader/Integration/GooglePlayPodcastRss2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use PHPUnit\Framework\TestCase;
use stdClass;

use function dirname;
use function file_get_contents;
use function str_replace;

Expand All @@ -20,7 +19,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';
}

/**
Expand Down Expand Up @@ -294,7 +293,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)
);
Expand All @@ -311,7 +310,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)
);
Expand All @@ -320,7 +319,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)
);
Expand Down Expand Up @@ -348,7 +347,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)
);
Expand All @@ -358,7 +357,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)
);
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Integration/HOnlineComAtom10Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Laminas\Feed\Reader;
use PHPUnit\Framework\TestCase;

use function dirname;
use function file_get_contents;

/**
Expand All @@ -22,7 +21,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
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Integration/LautDeRdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Laminas\Feed\Reader;
use PHPUnit\Framework\TestCase;

use function dirname;
use function file_get_contents;

/**
Expand All @@ -22,7 +21,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';
}

/**
Expand Down
3 changes: 1 addition & 2 deletions test/Reader/Integration/PodcastIndexRss2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use PHPUnit\Framework\TestCase;
use stdClass;

use function dirname;
use function file_get_contents;

/**
Expand All @@ -23,7 +22,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';
}

/**
Expand Down
18 changes: 8 additions & 10 deletions test/Reader/Integration/PodcastRss2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,7 +28,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';
}

/**
Expand Down Expand Up @@ -251,9 +250,8 @@ 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();

Expand Down Expand Up @@ -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)
);
Expand All @@ -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)
);
Expand All @@ -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)
);
Expand Down Expand Up @@ -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)
);
Expand All @@ -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)
);
Expand Down
Loading