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
@@ -3,23 +3,30 @@
|
||||
namespace Box\Spout\Common\Entity;
|
||||
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
class RowTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|Style
|
||||
* @return Style&MockObject
|
||||
*/
|
||||
private function getStyleMock()
|
||||
{
|
||||
return $this->createMock(Style::class);
|
||||
/** @var Style&MockObject $styleMock */
|
||||
$styleMock = $this->createMock(Style::class);
|
||||
|
||||
return $styleMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|Cell
|
||||
* @return Cell&MockObject
|
||||
*/
|
||||
private function getCellMock()
|
||||
{
|
||||
return $this->createMock(Cell::class);
|
||||
/** @var Cell&MockObject $cellMock */
|
||||
$cellMock = $this->createMock(Cell::class);
|
||||
|
||||
return $cellMock;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -113,7 +113,7 @@ class BorderTest extends TestCase
|
||||
$border->addPart($borderPart);
|
||||
$this->assertCount(1, $border->getParts());
|
||||
|
||||
/** @var $part BorderPart */
|
||||
/** @var BorderPart $part */
|
||||
$part = $border->getParts()[$allowedName];
|
||||
|
||||
$this->assertEquals($allowedStyle, $part->getStyle());
|
||||
|
||||
@@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase;
|
||||
class ColorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
* @return array<array>
|
||||
*/
|
||||
public function dataProviderForTestRGB()
|
||||
{
|
||||
@@ -54,7 +54,7 @@ class ColorTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @return array<array>
|
||||
*/
|
||||
public function dataProviderForTestRGBAInvalidColorComponents()
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,10 +14,13 @@ class OptionsManagerTest extends TestCase
|
||||
*/
|
||||
protected $optionsManager;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp() : void
|
||||
{
|
||||
$this->optionsManager = new class() extends OptionsManagerAbstract {
|
||||
protected function getSupportedOptions()
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getSupportedOptions() : array
|
||||
{
|
||||
return [
|
||||
'foo',
|
||||
|
||||
Reference in new issue
Block a user