Skip to content

Commit

Permalink
increase phpstan level to 6
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik committed Mar 8, 2023
1 parent 469e67c commit 59b92bc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
level: 5
level: 6
checkMissingIterableValueType: false

paths:
- src
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Elements/AnyOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function normalize(mixed $value, Context $context): mixed
}


public function merge($value, $base): mixed
public function merge(mixed $value, mixed $base): mixed
{
if (is_array($value) && isset($value[Helpers::PreventMerging])) {
unset($value[Helpers::PreventMerging]);
Expand Down
6 changes: 3 additions & 3 deletions src/Schema/Elements/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ trait Base
private ?string $deprecated = null;


public function default($value): self
public function default(mixed $value): self
{
$this->default = $value;
return $this;
Expand Down Expand Up @@ -161,7 +161,7 @@ private function isInRange(mixed $value, array $range): bool
}


private function doFinalize(mixed $value, Context $context)
private function doFinalize(mixed $value, Context $context): mixed
{
if ($this->castTo) {
if (Nette\Utils\Validators::isBuiltinType($this->castTo)) {
Expand All @@ -183,7 +183,7 @@ private function doFinalize(mixed $value, Context $context)
Nette\Schema\Message::FailedAssertion,
['value' => $value, 'assertion' => $expected],
);
return;
return null;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Schema/Elements/Structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(array $items)
}


public function default($value): self
public function default(mixed $value): self
{
throw new Nette\InvalidStateException('Structure cannot have default value.');
}
Expand Down Expand Up @@ -110,7 +110,7 @@ public function normalize(mixed $value, Context $context): mixed
}


public function merge(mixed $value, $base): mixed
public function merge(mixed $value, mixed $base): mixed
{
if (is_array($value) && isset($value[Helpers::PreventMerging])) {
unset($value[Helpers::PreventMerging]);
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Elements/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function normalize(mixed $value, Context $context): mixed
}


public function merge(mixed $value, $base): mixed
public function merge(mixed $value, mixed $base): mixed
{
if (is_array($value) && isset($value[Helpers::PreventMerging])) {
unset($value[Helpers::PreventMerging]);
Expand Down
4 changes: 2 additions & 2 deletions src/Schema/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class Processor
private bool $skipDefaults = false;


public function skipDefaults(bool $value = true)
public function skipDefaults(bool $value = true): void
{
$this->skipDefaults = $value;
}
Expand All @@ -34,7 +34,7 @@ public function skipDefaults(bool $value = true)
* Normalizes and validates data. Result is a clean completed data.
* @throws ValidationException
*/
public function process(Schema $schema, $data): mixed
public function process(Schema $schema, mixed $data): mixed
{
$this->createContext();
$data = $schema->normalize($data, $this->context);
Expand Down

0 comments on commit 59b92bc

Please sign in to comment.