fix php-stan errors
This commit is contained in:
parent
643e422364
commit
dbe12a052b
3 changed files with 23 additions and 59 deletions
|
@ -45,11 +45,6 @@ parameters:
|
|||
count: 1
|
||||
path: src/Bot/Client.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast Symfony\\\\Component\\\\Validator\\\\ConstraintViolationInterface to string\\.$#"
|
||||
count: 1
|
||||
path: src/Bot/HttpClient.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Mg\\\\Bot\\\\HttpClient\\:\\:getErrors\\(\\) has parameter \\$errors with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
@ -1910,46 +1905,11 @@ parameters:
|
|||
count: 1
|
||||
path: src/Register.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Common\\\\Serializer\\:\\:normalizeNamespace\\(\\) never returns bool so it can be removed from the return typehint\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Common\\\\Serializer\\:\\:serialize\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$context of method JMS\\\\Serializer\\\\Serializer\\:\\:toArray\\(\\) expects JMS\\\\Serializer\\\\SerializationContext\\|null, JMS\\\\Serializer\\\\DeserializationContext\\|JMS\\\\Serializer\\\\SerializationContext given\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$type of method JMS\\\\Serializer\\\\Serializer\\:\\:deserialize\\(\\) expects string, bool\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$type of method JMS\\\\Serializer\\\\Serializer\\:\\:fromArray\\(\\) expects string, bool\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$context of method JMS\\\\Serializer\\\\Serializer\\:\\:fromArray\\(\\) expects JMS\\\\Serializer\\\\DeserializationContext\\|null, JMS\\\\Serializer\\\\DeserializationContext\\|JMS\\\\Serializer\\\\SerializationContext given\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#3 \\$context of method JMS\\\\Serializer\\\\Serializer\\:\\:serialize\\(\\) expects JMS\\\\Serializer\\\\SerializationContext\\|null, JMS\\\\Serializer\\\\DeserializationContext\\|JMS\\\\Serializer\\\\SerializationContext given\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#4 \\$context of method JMS\\\\Serializer\\\\Serializer\\:\\:deserialize\\(\\) expects JMS\\\\Serializer\\\\DeserializationContext\\|null, JMS\\\\Serializer\\\\DeserializationContext\\|JMS\\\\Serializer\\\\SerializationContext given\\.$#"
|
||||
count: 1
|
||||
path: src/Serializer.php
|
||||
|
||||
-
|
||||
message: "#^Method RetailCrm\\\\Common\\\\Url\\:\\:buildGetParameters\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
|
||||
count: 1
|
||||
|
|
|
@ -232,7 +232,7 @@ class HttpClient
|
|||
$message = '';
|
||||
|
||||
foreach ($errors as $error) {
|
||||
$message .= (string)$error;
|
||||
$message .= $error->getMessage();
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException($message);
|
||||
|
|
|
@ -40,14 +40,16 @@ class Serializer
|
|||
$serializer = SerializerBuilder::create()->build();
|
||||
$context = self::getContext(false);
|
||||
|
||||
switch ($serialize) {
|
||||
case self::S_ARRAY:
|
||||
$serialized = $serializer->toArray($request, $context);
|
||||
break;
|
||||
case self::S_JSON:
|
||||
default:
|
||||
$serialized = $serializer->serialize($request, $serialize, $context);
|
||||
break;
|
||||
if ($context instanceof SerializationContext) {
|
||||
switch ($serialize) {
|
||||
case self::S_ARRAY:
|
||||
$serialized = $serializer->toArray($request, $context);
|
||||
break;
|
||||
case self::S_JSON:
|
||||
default:
|
||||
$serialized = $serializer->serialize($request, $serialize, $context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $serialized;
|
||||
|
@ -68,15 +70,17 @@ class Serializer
|
|||
$serializer = SerializerBuilder::create()->build();
|
||||
$context = self::getContext(true);
|
||||
|
||||
switch ($from) {
|
||||
case self::S_ARRAY:
|
||||
$deserialized = $serializer
|
||||
->fromArray(array_filter($data), self::normalizeNamespace($entityType), $context);
|
||||
break;
|
||||
case self::S_JSON:
|
||||
$deserialized = $serializer
|
||||
->deserialize($data, self::normalizeNamespace($entityType), $from, $context);
|
||||
break;
|
||||
if ($context instanceof DeserializationContext) {
|
||||
switch ($from) {
|
||||
case self::S_ARRAY:
|
||||
$deserialized = $serializer
|
||||
->fromArray(array_filter($data), self::normalizeNamespace($entityType), $context);
|
||||
break;
|
||||
case self::S_JSON:
|
||||
$deserialized = $serializer
|
||||
->deserialize($data, self::normalizeNamespace($entityType), $from, $context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $deserialized instanceof ModelInterface ? $deserialized : new ErrorOnlyResponse();
|
||||
|
@ -103,7 +107,7 @@ class Serializer
|
|||
/**
|
||||
* @param string $namespace
|
||||
*
|
||||
* @return bool|string
|
||||
* @return string
|
||||
*/
|
||||
private static function normalizeNamespace(string $namespace)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue