Skip to content

Commit 5cf6f18

Browse files
committed
Lint fixes based on phpstan report
1 parent 8f52331 commit 5cf6f18

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

src/Handler/ChunksInRequestUploadHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function isFirstChunk()
125125
/**
126126
* Checks if the chunk is last.
127127
*
128-
* @return int
128+
* @return bool
129129
*/
130130
public function isLastChunk()
131131
{

src/Handler/ContentRangeUploadHandler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,21 @@ class ContentRangeUploadHandler extends AbstractHandler
3636
/**
3737
* Current chunk start bytes.
3838
*
39-
* @var int
39+
* @var float
4040
*/
4141
protected $bytesStart = 0;
4242

4343
/**
4444
* Current chunk bytes end.
4545
*
46-
* @var int
46+
* @var float
4747
*/
4848
protected $bytesEnd = 0;
4949

5050
/**
5151
* The files total bytes.
5252
*
53-
* @var int
53+
* @var float
5454
*/
5555
protected $bytesTotal = 0;
5656

@@ -153,7 +153,7 @@ public function isFirstChunk()
153153
/**
154154
* Returns the chunks count.
155155
*
156-
* @return int
156+
* @return bool
157157
*/
158158
public function isLastChunk()
159159
{
@@ -172,23 +172,23 @@ public function isChunkedUpload()
172172
}
173173

174174
/**
175-
* @return int returns the starting bytes for current request
175+
* @return float returns the starting bytes for current request
176176
*/
177177
public function getBytesStart()
178178
{
179179
return $this->bytesStart;
180180
}
181181

182182
/**
183-
* @return int returns the ending bytes for current request
183+
* @return float returns the ending bytes for current request
184184
*/
185185
public function getBytesEnd()
186186
{
187187
return $this->bytesEnd;
188188
}
189189

190190
/**
191-
* @return int returns the total bytes for the file
191+
* @return float returns the total bytes for the file
192192
*/
193193
public function getBytesTotal()
194194
{

src/Handler/HandlerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class HandlerFactory
3737
*/
3838
public static function classFromRequest(Request $request, $fallbackClass = null)
3939
{
40-
/** @var AbstractHandler $handlerClass */
40+
/** @var AbstractHandler|string $handlerClass */
4141
foreach (static::$handlers as $handlerClass) {
4242
if ($handlerClass::canBeUsedForRequest($request)) {
4343
return $handlerClass;

src/Handler/SingleUploadHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Pion\Laravel\ChunkUpload\Handler;
44

5-
use Pion\Laravel\ChunkUpload\Config\AbstractConfig;
65
use Pion\Laravel\ChunkUpload\Save\SingleSave;
76
use Pion\Laravel\ChunkUpload\Storage\ChunkStorage;
87

@@ -16,7 +15,7 @@ class SingleUploadHandler extends AbstractHandler
1615
/**
1716
* Returns the chunks ave instance for saving.
1817
*
19-
* @param ChunkStorage $chunkStorage the chunk storage
18+
* @param ChunkStorage $chunkStorage the chunk storage
2019
*
2120
* @return SingleSave
2221
*/
@@ -32,7 +31,7 @@ public function startSaving($chunkStorage)
3231
*/
3332
public function getChunkFileName()
3433
{
35-
return null; // never used
34+
return ''; // never used
3635
}
3736

3837
/**

src/Receiver/FileReceiver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class FileReceiver
2525
protected $file;
2626

2727
/**
28-
* The handler that detects what upload proccess is beeing used.
28+
* The handler that detects what upload process is being used.
2929
*
3030
* @var AbstractHandler
3131
*/
@@ -93,7 +93,7 @@ public function isUploaded()
9393
*/
9494
public function receive()
9595
{
96-
if (false === is_object($this->handler)) {
96+
if (false == is_object($this->handler)) {
9797
return false;
9898
}
9999

src/Save/ChunkSave.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Pion\Laravel\ChunkUpload\Save;
44

5+
use Illuminate\Contracts\Filesystem\Filesystem as FilesystemContract;
56
use Illuminate\Http\UploadedFile;
67
use Pion\Laravel\ChunkUpload\Config\AbstractConfig;
78
use Pion\Laravel\ChunkUpload\Exceptions\ChunkSaveException;
@@ -155,7 +156,7 @@ protected function handleChunk()
155156
$file = $this->getChunkFilePath();
156157

157158
$this->handleChunkFile($file)
158-
->tryToBuildFullFileFromChunks();
159+
->tryToBuildFullFileFromChunks();
159160
}
160161

161162
/**
@@ -248,7 +249,7 @@ public function chunkStorage()
248249
/**
249250
* Returns the disk adapter for the chunk.
250251
*
251-
* @return \Illuminate\Filesystem\FilesystemAdapter
252+
* @return FilesystemContract
252253
*/
253254
public function chunkDisk()
254255
{

src/Save/ParallelSave.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Pion\Laravel\ChunkUpload\Save;
44

55
use Illuminate\Http\UploadedFile;
6+
use Illuminate\Support\Collection;
67
use Illuminate\Support\Str;
78
use Pion\Laravel\ChunkUpload\ChunkFile;
89
use Pion\Laravel\ChunkUpload\Config\AbstractConfig;
@@ -35,10 +36,10 @@ class ParallelSave extends ChunkSave
3536
/**
3637
* ParallelSave constructor.
3738
*
38-
* @param UploadedFile $file the uploaded file (chunk file)
39-
* @param AbstractHandler|HandleParallelUploadTrait $handler the handler that detected the correct save method
40-
* @param ChunkStorage $chunkStorage the chunk storage
41-
* @param AbstractConfig $config the config manager
39+
* @param UploadedFile $file the uploaded file (chunk file)
40+
* @param AbstractHandler $handler the handler that detected the correct save method
41+
* @param ChunkStorage $chunkStorage the chunk storage
42+
* @param AbstractConfig $config the config manager
4243
*
4344
* @throws ChunkSaveException
4445
*/
@@ -87,7 +88,7 @@ protected function handleChunkFile($file)
8788
/**
8889
* Searches for all chunk files.
8990
*
90-
* @return \Illuminate\Support\Collection
91+
* @return Collection
9192
*/
9293
protected function getSavedChunksFiles()
9394
{

src/Storage/ChunkStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function config()
187187
}
188188

189189
/**
190-
* @return \Illuminate\Filesystem\FilesystemAdapter
190+
* @return FilesystemContract
191191
*/
192192
public function disk()
193193
{

0 commit comments

Comments
 (0)