Skip to content

Commit 34f6d23

Browse files
Fix php8 deprecations (#51)
* Fix php8 deprecations * Fix dynamic property depreactions * Update version in readme
1 parent 88db9e0 commit 34f6d23

File tree

8 files changed

+21
-7
lines changed

8 files changed

+21
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ConvertAPI helps in converting various file formats. Creating PDF and Images fro
99

1010
## Requirements
1111

12-
PHP 5.4.0 and later.
12+
PHP 8.1.0 and later.
1313

1414
## Installation
1515

examples/conversions_chaining.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
$cost = $jpgResult->getConversionCost();
1919
$count = count($jpgResult->getFiles());
2020

21-
echo "Conversions done. Cost: ${cost}. Total files created: ${count}\n";
21+
echo "Conversions done. Cost: {$cost}. Total files created: {$count}\n";
2222

2323
$zipResult = ConvertApi::convert('zip', ['Files' => $jpgResult->getFiles()], 'any');
2424

2525
$cost = $zipResult->getConversionCost();
2626
$count = count($zipResult->getFiles());
2727

28-
echo "Conversions done. Cost: ${cost}. Total files created: ${count}\n";
28+
echo "Conversions done. Cost: {$cost}. Total files created: {$count}\n";
2929

3030
$savedFiles = $zipResult->saveFiles($dir);
3131

lib/ConvertApi/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function upload($file_or_resource, $fileName)
4444

4545
if (!$fp)
4646
{
47-
throw new Error\File("Unable to open file ${file_or_resource}");
47+
throw new Error\File("Unable to open file {$file_or_resource}");
4848
}
4949

5050
curl_setopt($ch, CURLOPT_POST, true);
@@ -72,7 +72,7 @@ public function download($url, $path)
7272

7373
if (!$fp)
7474
{
75-
throw new Error\File("Unable to open file ${path}");
75+
throw new Error\File("Unable to open file {$path}");
7676
}
7777

7878
curl_setopt($ch, CURLOPT_FILE, $fp);
@@ -193,7 +193,7 @@ private function buildFormData($params)
193193
if (is_array($val))
194194
{
195195
foreach ($val as $k => $v)
196-
$data["${key}[${k}]"] = $v;
196+
$data["{$key}[{$k}]"] = $v;
197197
}
198198
elseif (is_bool($val))
199199
$data[$key] = $val ? 'true' : 'false';

lib/ConvertApi/FileUpload.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
class FileUpload
66
{
7+
public $filePath;
8+
private string $_fileName;
9+
private array $_result;
10+
711
function __construct($filePath, $fileName = null)
812
{
913
$this->filePath = $filePath;

lib/ConvertApi/FormatDetector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
class FormatDetector
66
{
7+
private $resource;
8+
79
function __construct($resource)
810
{
911
$this->resource = $resource;

lib/ConvertApi/Result.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
class Result
66
{
7-
private $files;
7+
private array $files;
8+
public array $response;
89

910
function __construct($response)
1011
{

lib/ConvertApi/ResultFile.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
class ResultFile
66
{
7+
public array $fileInfo;
8+
79
function __construct($fileInfo)
810
{
911
$this->fileInfo = $fileInfo;

lib/ConvertApi/Task.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ class Task
66
{
77
const DEFAULT_URL_FORMAT = 'url';
88

9+
private ?string $fromFormat;
10+
private ?string $toFormat;
11+
private array $params;
12+
private ?int $conversionTimeout;
13+
914
function __construct($fromFormat, $toFormat, $params, $conversionTimeout = null)
1015
{
1116
$this->fromFormat = $fromFormat;

0 commit comments

Comments
 (0)