Skip to content

Commit 466dc91

Browse files
committed
Require strict types
1 parent 29f1d15 commit 466dc91

File tree

104 files changed

+239
-34
lines changed

Some content is hidden

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

104 files changed

+239
-34
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
return (new PhpCsFixer\Config())
1111
->setFinder($finder)
12+
->setRiskyAllowed(true)
1213
->setRules([
1314
'@Symfony' => true,
1415
'array_syntax' => ['syntax' => 'short'],
@@ -18,5 +19,6 @@
1819
'phpdoc_order' => true,
1920
'yoda_style' => false,
2021
'no_superfluous_phpdoc_tags' => false,
22+
'declare_strict_types' => true,
2123
])
2224
;

src/Client.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Http\Discovery\Psr17FactoryDiscovery;

src/Collection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Swis\JsonApi\Client\Interfaces\DataInterface;

src/CollectionDocument.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Swis\JsonApi\Client\Interfaces\CollectionDocumentInterface;

src/Concerns/GuardsAttributes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
trait GuardsAttributes

src/Concerns/HasAttributes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
use Illuminate\Contracts\Support\Arrayable;

src/Concerns/HasId.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
trait HasId

src/Concerns/HasInitial.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
trait HasInitial

src/Concerns/HasLinks.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
use Swis\JsonApi\Client\Links;

src/Concerns/HasMeta.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
use Swis\JsonApi\Client\Meta;

src/Concerns/HasRelations.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
use Swis\JsonApi\Client\Collection;

src/Concerns/HasType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
trait HasType

src/Concerns/HidesAttributes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Concerns;
46

57
trait HidesAttributes

src/Document.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Psr\Http\Message\ResponseInterface;

src/DocumentClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Psr\Http\Client\ClientInterface as HttpClientInterface;

src/DocumentFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Swis\JsonApi\Client\Exceptions\UnsupportedDataException;

src/Error.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Swis\JsonApi\Client\Concerns\HasLinks;

src/ErrorCollection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
class ErrorCollection extends \Illuminate\Support\Collection

src/ErrorSource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
class ErrorSource

src/Exceptions/Exception.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Exceptions;
46

57
interface Exception

src/Exceptions/HydrationException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Exceptions;
46

57
use InvalidArgumentException;

src/Exceptions/MassAssignmentException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Exceptions;
46

57
class MassAssignmentException extends \RuntimeException

src/Exceptions/TypeMappingException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Exceptions;
46

57
use InvalidArgumentException;

src/Exceptions/UnsupportedDataException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Exceptions;
46

57
use InvalidArgumentException;

src/Exceptions/ValidationException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Exceptions;
46

57
class ValidationException extends \InvalidArgumentException implements Exception

src/Interfaces/ClientInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
use Psr\Http\Message\ResponseInterface;

src/Interfaces/CollectionDocumentInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
interface CollectionDocumentInterface extends DocumentInterface

src/Interfaces/DataInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
interface DataInterface

src/Interfaces/DocumentClientInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
interface DocumentClientInterface

src/Interfaces/DocumentInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
use Psr\Http\Message\ResponseInterface;

src/Interfaces/DocumentParserInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
interface DocumentParserInterface

src/Interfaces/ItemDocumentInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
interface ItemDocumentInterface extends DocumentInterface

src/Interfaces/ItemInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
use Swis\JsonApi\Client\Links;

src/Interfaces/ManyRelationInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
use Swis\JsonApi\Client\Collection;

src/Interfaces/OneRelationInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
use Swis\JsonApi\Client\Links;

src/Interfaces/RepositoryInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
interface RepositoryInterface

src/Interfaces/ResponseParserInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
use Psr\Http\Message\ResponseInterface;

src/Interfaces/TypeMapperInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
/**

src/Interfaces/TypedRelationInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Interfaces;
46

57
interface TypedRelationInterface

src/InvalidResponseDocument.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
class InvalidResponseDocument extends Document

src/Item.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use ArrayAccess;

src/ItemDocument.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Swis\JsonApi\Client\Interfaces\ItemDocumentInterface;

src/ItemHydrator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Swis\JsonApi\Client\Exceptions\HydrationException;
@@ -202,6 +204,6 @@ protected function buildItem(string $type, array $attributes): ItemInterface
202204
$item = $this->typeMapper->getMapping($type);
203205
}
204206

205-
return $this->hydrate($item, $attributes, $attributes['id']);
207+
return $this->hydrate($item, $attributes, (string) $attributes['id']);
206208
}
207209
}

src/Jsonapi.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Illuminate\Contracts\Support\Arrayable;

src/Link.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use Swis\JsonApi\Client\Concerns\HasMeta;

src/Links.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use ArrayAccess;

src/Meta.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client;
46

57
use ArrayAccess;

src/Parsers/CollectionParser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Swis\JsonApi\Client\Parsers;
46

57
use Swis\JsonApi\Client\Collection;

0 commit comments

Comments
 (0)