1
0
mirror of synced 2024-11-21 19:36:02 +03:00

Update php version (#20)

This commit is contained in:
tishmaria90 2021-12-13 10:48:18 +03:00 committed by GitHub
parent c6a44ea2b3
commit 98563e2e60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 3839 additions and 1559 deletions

View File

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
php-version: ['7.1', '7.2', '7.3'] php-version: ['7.2', '7.3', '7.4', '8.0']
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.php-version }} - name: Setup PHP ${{ matrix.php-version }}

View File

@ -12,21 +12,22 @@
} }
], ],
"require": { "require": {
"php": ">=7.1", "php": ">=7.2.5",
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*",
"jms/serializer": "1.14.*", "jms/serializer": "3.*",
"symfony/validator": "4.3.*", "symfony/validator": "5.4.*",
"doctrine/annotations": "1.12.*", "doctrine/annotations": "1.13.*",
"doctrine/cache": "1.11.*", "doctrine/cache": "1.11.*",
"guzzlehttp/guzzle": "6.*" "guzzlehttp/guzzle": "6.*",
"symfony/intl": "^5.4"
}, },
"require-dev": { "require-dev": {
"phpmd/phpmd": "2.*", "phpmd/phpmd": "2.*",
"squizlabs/php_codesniffer": "3.4.*", "squizlabs/php_codesniffer": "3.4.*",
"symfony/dotenv": "4.3.*", "symfony/dotenv": "5.4.*",
"phpunit/phpunit": "7.*", "phpunit/phpunit": "8.5.*",
"phpstan/phpstan": "0.11.*" "phpstan/phpstan": "0.12.*"
}, },
"support": { "support": {
"email": "support@retailcrm.pro" "email": "support@retailcrm.pro"

3408
composer.lock generated

File diff suppressed because it is too large Load Diff

1917
phpstan-baseline.neon Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
includes:
- phpstan-baseline.neon
parameters: parameters:
autoload_files:
- %currentWorkingDirectory%/vendor/autoload.php
level: 7 level: 7
paths: paths:
- %currentWorkingDirectory%/src - %currentWorkingDirectory%/src

View File

@ -232,7 +232,7 @@ class HttpClient
$message = ''; $message = '';
foreach ($errors as $error) { foreach ($errors as $error) {
$message .= (string)$error; $message .= $error->getMessage();
} }
throw new InvalidArgumentException($message); throw new InvalidArgumentException($message);

View File

@ -233,7 +233,7 @@ class Channel implements ModelInterface
/** /**
* @param string $name * @param string $name
*/ */
public function setName(string $name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
} }

View File

@ -40,14 +40,16 @@ class Serializer
$serializer = SerializerBuilder::create()->build(); $serializer = SerializerBuilder::create()->build();
$context = self::getContext(false); $context = self::getContext(false);
switch ($serialize) { if ($context instanceof SerializationContext) {
case self::S_ARRAY: switch ($serialize) {
$serialized = $serializer->toArray($request, $context); case self::S_ARRAY:
break; $serialized = $serializer->toArray($request, $context);
case self::S_JSON: break;
default: case self::S_JSON:
$serialized = $serializer->serialize($request, $serialize, $context); default:
break; $serialized = $serializer->serialize($request, $serialize, $context);
break;
}
} }
return $serialized; return $serialized;
@ -68,15 +70,17 @@ class Serializer
$serializer = SerializerBuilder::create()->build(); $serializer = SerializerBuilder::create()->build();
$context = self::getContext(true); $context = self::getContext(true);
switch ($from) { if ($context instanceof DeserializationContext) {
case self::S_ARRAY: switch ($from) {
$deserialized = $serializer case self::S_ARRAY:
->fromArray(array_filter($data), self::normalizeNamespace($entityType), $context); $deserialized = $serializer
break; ->fromArray(array_filter($data), self::normalizeNamespace($entityType), $context);
case self::S_JSON: break;
$deserialized = $serializer case self::S_JSON:
->deserialize($data, self::normalizeNamespace($entityType), $from, $context); $deserialized = $serializer
break; ->deserialize($data, self::normalizeNamespace($entityType), $from, $context);
break;
}
} }
return $deserialized instanceof ModelInterface ? $deserialized : new ErrorOnlyResponse(); return $deserialized instanceof ModelInterface ? $deserialized : new ErrorOnlyResponse();
@ -93,9 +97,9 @@ class Serializer
$context = new DeserializationContext(); $context = new DeserializationContext();
} else { } else {
$context = new SerializationContext(); $context = new SerializationContext();
}
$context->setSerializeNull(false); $context->setSerializeNull(false);
}
return $context; return $context;
} }
@ -103,7 +107,7 @@ class Serializer
/** /**
* @param string $namespace * @param string $namespace
* *
* @return bool|string * @return string
*/ */
private static function normalizeNamespace(string $namespace) private static function normalizeNamespace(string $namespace)
{ {

View File

@ -14,6 +14,7 @@ use Symfony\Component\Dotenv\Dotenv;
$dotenv = new Dotenv(); $dotenv = new Dotenv();
try { try {
$dotenv->usePutenv(true);
$dotenv->load(__DIR__ . '/../.env'); $dotenv->load(__DIR__ . '/../.env');
} catch (Exception $exception) { } catch (Exception $exception) {
echo "WARNING: Can't load .env file. Using default environment."; echo "WARNING: Can't load .env file. Using default environment.";