Skip to content

Commit 4fc5533

Browse files
committed
New Lint Rules applied
1 parent b5eef9b commit 4fc5533

File tree

105 files changed

+792
-616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+792
-616
lines changed

src/FeedIo/Adapter/ClientInterface.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter;
46

@@ -12,13 +14,12 @@
1214
*/
1315
interface ClientInterface
1416
{
15-
1617
/**
1718
* @param string $url
1819
* @param DateTime|null $modifiedSince
1920
* @throws \FeedIo\Adapter\NotFoundException
2021
* @throws \FeedIo\Adapter\ServerErrorException
2122
* @return \FeedIo\Adapter\ResponseInterface
2223
*/
23-
public function getResponse(string $url, DateTime $modifiedSince = null) : ResponseInterface;
24+
public function getResponse(string $url, DateTime $modifiedSince = null): ResponseInterface;
2425
}

src/FeedIo/Adapter/FileSystem/Client.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter\FileSystem;
46

@@ -12,14 +14,13 @@
1214
*/
1315
class Client implements ClientInterface
1416
{
15-
1617
/**
1718
* @param string $path
1819
* @param \DateTime $modifiedSince
1920
* @throws \FeedIo\Adapter\NotFoundException
2021
* @return \FeedIo\Adapter\ResponseInterface
2122
*/
22-
public function getResponse(string $path, DateTime $modifiedSince = null) : ResponseInterface
23+
public function getResponse(string $path, DateTime $modifiedSince = null): ResponseInterface
2324
{
2425
if (file_exists($path)) {
2526
return new Response(

src/FeedIo/Adapter/FileSystem/Response.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter\FileSystem;
46

@@ -32,23 +34,23 @@ public function getStatusCode(): int
3234
/**
3335
* @return boolean
3436
*/
35-
public function isModified() : bool
37+
public function isModified(): bool
3638
{
3739
return true;
3840
}
3941

4042
/**
4143
* @return string|null
4244
*/
43-
public function getBody() : ? string
45+
public function getBody(): ?string
4446
{
4547
return $this->fileContent;
4648
}
4749

4850
/**
4951
* @return iterable
5052
*/
51-
public function getHeaders() : iterable
53+
public function getHeaders(): iterable
5254
{
5355
return [];
5456
}
@@ -57,15 +59,15 @@ public function getHeaders() : iterable
5759
* @param string $name
5860
* @return iterable
5961
*/
60-
public function getHeader(string $name) : iterable
62+
public function getHeader(string $name): iterable
6163
{
6264
return [];
6365
}
6466

6567
/**
6668
* @return DateTime|null
6769
*/
68-
public function getLastModified() : ?DateTime
70+
public function getLastModified(): ?DateTime
6971
{
7072
return $this->lastModified;
7173
}

src/FeedIo/Adapter/Guzzle/Client.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter\Guzzle;
46

@@ -15,11 +17,10 @@
1517
*/
1618
class Client implements ClientInterface
1719
{
18-
1920
/**
2021
* Default user agent provided with the package
2122
*/
22-
const DEFAULT_USER_AGENT = 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1';
23+
public const DEFAULT_USER_AGENT = 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1';
2324

2425
public function __construct(
2526
protected GuzzleClientInterface $guzzleClient,
@@ -31,7 +32,7 @@ public function __construct(
3132
* @param string $userAgent The new user-agent
3233
* @return Client
3334
*/
34-
public function setUserAgent(string $userAgent) : Client
35+
public function setUserAgent(string $userAgent): Client
3536
{
3637
$this->userAgent = $userAgent;
3738

@@ -44,7 +45,7 @@ public function setUserAgent(string $userAgent) : Client
4445
* @return ResponseInterface
4546
* @throws \GuzzleHttp\Exception\GuzzleException
4647
*/
47-
public function getResponse(string $url, DateTime $modifiedSince = null) : ResponseInterface
48+
public function getResponse(string $url, DateTime $modifiedSince = null): ResponseInterface
4849
{
4950
if ($modifiedSince) {
5051
$headResponse = $this->request('head', $url, $modifiedSince);
@@ -86,7 +87,7 @@ protected function request(string $method, string $url, DateTime $modifiedSince
8687
* @param DateTime|null $modifiedSince
8788
* @return array
8889
*/
89-
protected function getOptions(DateTime $modifiedSince = null) : array
90+
protected function getOptions(DateTime $modifiedSince = null): array
9091
{
9192
$headers = [
9293
'Accept-Encoding' => 'gzip, deflate',

src/FeedIo/Adapter/Guzzle/Response.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter\Guzzle;
46

@@ -11,7 +13,7 @@
1113
*/
1214
class Response implements ResponseInterface
1315
{
14-
const HTTP_LAST_MODIFIED = 'Last-Modified';
16+
public const HTTP_LAST_MODIFIED = 'Last-Modified';
1517

1618
protected ?string $body = null;
1719

@@ -31,12 +33,12 @@ public function getStatusCode(): int
3133
return (int) $this->psrResponse->getStatusCode();
3234
}
3335

34-
public function isModified() : bool
36+
public function isModified(): bool
3537
{
3638
return $this->psrResponse->getStatusCode() != 304 && strlen($this->getBody()) > 0;
3739
}
3840

39-
public function getBody() : ? string
41+
public function getBody(): ?string
4042
{
4143
if (is_null($this->body)) {
4244
$this->body = $this->psrResponse->getBody()->getContents();
@@ -45,7 +47,7 @@ public function getBody() : ? string
4547
return $this->body;
4648
}
4749

48-
public function getLastModified() : ?DateTime
50+
public function getLastModified(): ?DateTime
4951
{
5052
if ($this->psrResponse->hasHeader(static::HTTP_LAST_MODIFIED)) {
5153
$lastModified = DateTime::createFromFormat(DateTime::RFC2822, $this->getHeader(static::HTTP_LAST_MODIFIED)[0]);
@@ -56,12 +58,12 @@ public function getLastModified() : ?DateTime
5658
return null;
5759
}
5860

59-
public function getHeaders() : iterable
61+
public function getHeaders(): iterable
6062
{
6163
return $this->psrResponse->getHeaders();
6264
}
6365

64-
public function getHeader(string $name) : iterable
66+
public function getHeader(string $name): iterable
6567
{
6668
return $this->psrResponse->getHeader($name);
6769
}

src/FeedIo/Adapter/NotFoundException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter;
46

src/FeedIo/Adapter/NullClient.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter;
46

@@ -9,13 +11,12 @@
911
*/
1012
class NullClient implements ClientInterface
1113
{
12-
1314
/**
1415
* @param string $url
1516
* @param DateTime|null $modifiedSince
1617
* @return \FeedIo\Adapter\ResponseInterface
1718
*/
18-
public function getResponse(string $url, DateTime $modifiedSince = null) : ResponseInterface
19+
public function getResponse(string $url, DateTime $modifiedSince = null): ResponseInterface
1920
{
2021
return new NullResponse();
2122
}

src/FeedIo/Adapter/NullResponse.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter;
46

@@ -23,31 +25,31 @@ public function getStatusCode(): int
2325
/**
2426
* @return string
2527
*/
26-
public function getBody() : ? string
28+
public function getBody(): ?string
2729
{
2830
return null;
2931
}
3032

3133
/**
3234
* @return boolean
3335
*/
34-
public function isModified() : bool
36+
public function isModified(): bool
3537
{
3638
return true;
3739
}
3840

3941
/**
4042
* @return \DateTime
4143
*/
42-
public function getLastModified() : ?\DateTime
44+
public function getLastModified(): ?\DateTime
4345
{
4446
return new \DateTime('@0');
4547
}
4648

4749
/**
4850
* @return iterable
4951
*/
50-
public function getHeaders() : iterable
52+
public function getHeaders(): iterable
5153
{
5254
return [];
5355
}
@@ -56,7 +58,7 @@ public function getHeaders() : iterable
5658
* @param string $name
5759
* @return iterable
5860
*/
59-
public function getHeader(string $name) : iterable
61+
public function getHeader(string $name): iterable
6062
{
6163
return [];
6264
}

src/FeedIo/Adapter/ResponseInterface.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter;
46

@@ -8,11 +10,10 @@
810
*/
911
interface ResponseInterface
1012
{
11-
1213
/**
1314
* @return string
1415
*/
15-
public function getBody() : ? string;
16+
public function getBody(): ?string;
1617

1718
/**
1819
* request's duration in seconds
@@ -29,12 +30,12 @@ public function getStatusCode(): int;
2930
/**
3031
* @return \DateTime
3132
*/
32-
public function getLastModified() : ?\DateTime;
33+
public function getLastModified(): ?\DateTime;
3334

3435
/**
3536
* @return iterable
3637
*/
37-
public function getHeaders() : iterable;
38+
public function getHeaders(): iterable;
3839

3940
/**
4041
* @param string $name
@@ -45,5 +46,5 @@ public function getHeader(string $name): iterable;
4546
/**
4647
* @return boolean
4748
*/
48-
public function isModified() : bool;
49+
public function isModified(): bool;
4950
}

src/FeedIo/Adapter/ServerErrorException.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace FeedIo\Adapter;
46

5-
use \Psr\Http\Message\ResponseInterface;
7+
use Psr\Http\Message\ResponseInterface;
68

79
class ServerErrorException extends HttpRequestException
810
{

0 commit comments

Comments
 (0)