Add phpstan until level 7
This commit is contained in:
1 parent
ab973cab34
commit
bfb7c2c68f
114 files changed
+527
-319
No files matched your search
@@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
|
||||
class CellTypeHelperTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function testIsEmpty()
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class CellTypeHelperTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function testIsNonEmptyString()
|
||||
{
|
||||
@@ -44,7 +44,7 @@ class CellTypeHelperTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function testIsNumeric()
|
||||
{
|
||||
@@ -66,7 +66,7 @@ class CellTypeHelperTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function testIsBoolean()
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Box\Spout\Common\Helper;
|
||||
|
||||
use Box\Spout\Common\Exception\EncodingConversionException;
|
||||
use Box\Spout\TestUsingResource;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
@@ -14,7 +15,7 @@ class EncodingHelperTest extends TestCase
|
||||
use TestUsingResource;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array<array>
|
||||
*/
|
||||
public function dataProviderForTestGetBytesOffsetToSkipBOM()
|
||||
{
|
||||
@@ -38,6 +39,7 @@ class EncodingHelperTest extends TestCase
|
||||
public function testGetBytesOffsetToSkipBOM($fileName, $encoding, $expectedBytesOffset)
|
||||
{
|
||||
$resourcePath = $this->getResourcePath($fileName);
|
||||
/** @var resource $filePointer */
|
||||
$filePointer = fopen($resourcePath, 'r');
|
||||
|
||||
$encodingHelper = new EncodingHelper(new GlobalFunctionsHelper());
|
||||
@@ -47,7 +49,7 @@ class EncodingHelperTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array<array>
|
||||
*/
|
||||
public function dataProviderForIconvOrMbstringUsage()
|
||||
{
|
||||
@@ -73,7 +75,7 @@ class EncodingHelperTest extends TestCase
|
||||
$helperStub->method('iconv')->willReturn(false);
|
||||
$helperStub->method('mb_convert_encoding')->willReturn(false);
|
||||
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->setConstructorArgs([$helperStub])
|
||||
->setMethods(['canUseIconv', 'canUseMbString'])
|
||||
@@ -91,7 +93,7 @@ class EncodingHelperTest extends TestCase
|
||||
{
|
||||
$this->expectException(EncodingConversionException::class);
|
||||
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['canUseIconv', 'canUseMbString'])
|
||||
@@ -110,7 +112,7 @@ class EncodingHelperTest extends TestCase
|
||||
*/
|
||||
public function testAttemptConversionToUTF8ShouldReturnReencodedString($shouldUseIconv)
|
||||
{
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->setConstructorArgs([new GlobalFunctionsHelper()])
|
||||
->setMethods(['canUseIconv', 'canUseMbString'])
|
||||
@@ -118,6 +120,7 @@ class EncodingHelperTest extends TestCase
|
||||
$encodingHelperStub->method('canUseIconv')->willReturn($shouldUseIconv);
|
||||
$encodingHelperStub->method('canUseMbString')->willReturn(true);
|
||||
|
||||
/** @var string $encodedString */
|
||||
$encodedString = iconv(EncodingHelper::ENCODING_UTF8, EncodingHelper::ENCODING_UTF16_LE, 'input');
|
||||
$decodedString = $encodingHelperStub->attemptConversionToUTF8($encodedString, EncodingHelper::ENCODING_UTF16_LE);
|
||||
|
||||
@@ -129,7 +132,7 @@ class EncodingHelperTest extends TestCase
|
||||
*/
|
||||
public function testAttemptConversionToUTF8ShouldBeNoopWhenTargetIsUTF8()
|
||||
{
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['canUseIconv'])
|
||||
@@ -156,7 +159,7 @@ class EncodingHelperTest extends TestCase
|
||||
$helperStub->method('iconv')->willReturn(false);
|
||||
$helperStub->method('mb_convert_encoding')->willReturn(false);
|
||||
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->setConstructorArgs([$helperStub])
|
||||
->setMethods(['canUseIconv', 'canUseMbString'])
|
||||
@@ -174,7 +177,7 @@ class EncodingHelperTest extends TestCase
|
||||
{
|
||||
$this->expectException(EncodingConversionException::class);
|
||||
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['canUseIconv', 'canUseMbString'])
|
||||
@@ -193,7 +196,7 @@ class EncodingHelperTest extends TestCase
|
||||
*/
|
||||
public function testAttemptConversionFromUTF8ShouldReturnReencodedString($shouldUseIconv)
|
||||
{
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->setConstructorArgs([new GlobalFunctionsHelper()])
|
||||
->setMethods(['canUseIconv', 'canUseMbString'])
|
||||
@@ -212,7 +215,7 @@ class EncodingHelperTest extends TestCase
|
||||
*/
|
||||
public function testAttemptConversionFromUTF8ShouldBeNoopWhenTargetIsUTF8()
|
||||
{
|
||||
/** @var EncodingHelper $encodingHelperStub */
|
||||
/** @var EncodingHelper&MockObject $encodingHelperStub */
|
||||
$encodingHelperStub = $this->getMockBuilder('\Box\Spout\Common\Helper\EncodingHelper')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(['canUseIconv'])
|
||||
|
||||
@@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase;
|
||||
class ODSTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
* @return array<array>
|
||||
*/
|
||||
public function dataProviderForTestEscape()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase;
|
||||
class XLSXTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
* @return array<array>
|
||||
*/
|
||||
public function dataProviderForTestEscape()
|
||||
{
|
||||
@@ -46,7 +46,7 @@ class XLSXTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array<array>
|
||||
*/
|
||||
public function dataProviderForTestUnescape()
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class FileSystemHelperTest extends TestCase
|
||||
{
|
||||
/** @var \Box\Spout\Writer\XLSX\Helper\FileSystemHelper */
|
||||
/** @var FileSystemHelper */
|
||||
protected $fileSystemHelper;
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user