PHPStan Level 4
This commit is contained in:
1 parent
ea0a67d283
commit
695a3deb72
23 files changed
+32
-43
No files matched your search
@@ -88,10 +88,10 @@ class StyleMerger
|
||||
if (!$style->hasSetCellAlignment() && $baseStyle->shouldApplyCellAlignment()) {
|
||||
$styleToUpdate->setCellAlignment($baseStyle->getCellAlignment());
|
||||
}
|
||||
if (!$style->getBorder() && $baseStyle->shouldApplyBorder()) {
|
||||
if ($style->getBorder() === null && $baseStyle->shouldApplyBorder()) {
|
||||
$styleToUpdate->setBorder($baseStyle->getBorder());
|
||||
}
|
||||
if (!$style->getFormat() && $baseStyle->shouldApplyFormat()) {
|
||||
if ($style->getFormat() === null && $baseStyle->shouldApplyFormat()) {
|
||||
$styleToUpdate->setFormat($baseStyle->getFormat());
|
||||
}
|
||||
if (!$style->shouldApplyBackgroundColor() && $baseStyle->shouldApplyBackgroundColor()) {
|
||||
|
||||
@@ -23,7 +23,7 @@ use Box\Spout\Writer\Exception\WriterException;
|
||||
*/
|
||||
abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
{
|
||||
/** @var Workbook The workbook to manage */
|
||||
/** @var Workbook|null The workbook to manage */
|
||||
protected $workbook;
|
||||
|
||||
/** @var OptionsManagerInterface */
|
||||
@@ -92,7 +92,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
|
||||
abstract protected function getWorksheetFilePath(Sheet $sheet);
|
||||
|
||||
/**
|
||||
* @return Workbook
|
||||
* @return Workbook|null
|
||||
*/
|
||||
public function getWorkbook()
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ use Box\Spout\Writer\Exception\WriterException;
|
||||
interface WorkbookManagerInterface
|
||||
{
|
||||
/**
|
||||
* @return Workbook
|
||||
* @return Workbook|null
|
||||
*/
|
||||
public function getWorkbook();
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ abstract class WriterAbstract implements WriterInterface
|
||||
*/
|
||||
protected function throwIfFilePointerIsNotAvailable()
|
||||
{
|
||||
if (!$this->filePointer) {
|
||||
if (!is_resource($this->filePointer)) {
|
||||
throw new IOException('File pointer has not be opened');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Sheet;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Manager\WorkbookManagerInterface;
|
||||
use Box\Spout\Writer\Exception\SheetNotFoundException;
|
||||
use Box\Spout\Writer\Exception\WriterAlreadyOpenedException;
|
||||
@@ -25,7 +24,7 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
||||
/** @var ManagerFactoryInterface */
|
||||
private $managerFactory;
|
||||
|
||||
/** @var WorkbookManagerInterface */
|
||||
/** @var WorkbookManagerInterface|null */
|
||||
private $workbookManager;
|
||||
|
||||
/**
|
||||
@@ -66,7 +65,7 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
||||
*/
|
||||
protected function openWriter()
|
||||
{
|
||||
if (!$this->workbookManager) {
|
||||
if ($this->workbookManager === null) {
|
||||
$this->workbookManager = $this->managerFactory->createWorkbookManager($this->optionsManager);
|
||||
$this->workbookManager->addNewSheetAndMakeItCurrent();
|
||||
}
|
||||
@@ -85,7 +84,6 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
||||
$externalSheets = [];
|
||||
$worksheets = $this->workbookManager->getWorksheets();
|
||||
|
||||
/** @var Worksheet $worksheet */
|
||||
foreach ($worksheets as $worksheet) {
|
||||
$externalSheets[] = $worksheet->getExternalSheet();
|
||||
}
|
||||
@@ -143,7 +141,7 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
||||
*/
|
||||
protected function throwIfWorkbookIsNotAvailable()
|
||||
{
|
||||
if (!$this->workbookManager->getWorkbook()) {
|
||||
if ($this->workbookManager->getWorkbook() === null) {
|
||||
throw new WriterNotOpenedException('The writer must be opened before performing this action.');
|
||||
}
|
||||
}
|
||||
@@ -162,7 +160,7 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
||||
*/
|
||||
protected function closeWriter()
|
||||
{
|
||||
if ($this->workbookManager) {
|
||||
if ($this->workbookManager !== null) {
|
||||
$this->workbookManager->close($this->filePointer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +91,7 @@ class ManagerFactory implements ManagerFactoryInterface
|
||||
$styleMerger,
|
||||
$sharedStringsManager,
|
||||
$stringsEscaper,
|
||||
$stringsHelper,
|
||||
$this->entityFactory
|
||||
$stringsHelper
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ EOD;
|
||||
*/
|
||||
protected function throwIfSharedStringsFilePointerIsNotAvailable()
|
||||
{
|
||||
if (!$this->sharedStringsFilePointer) {
|
||||
if (!is_resource($this->sharedStringsFilePointer)) {
|
||||
throw new IOException('Unable to open shared strings file for writing.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ use Box\Spout\Common\Exception\IOException;
|
||||
use Box\Spout\Common\Helper\Escaper\XLSX as XLSXEscaper;
|
||||
use Box\Spout\Common\Helper\StringHelper;
|
||||
use Box\Spout\Common\Manager\OptionsManagerInterface;
|
||||
use Box\Spout\Writer\Common\Creator\InternalEntityFactory;
|
||||
use Box\Spout\Writer\Common\Entity\Options;
|
||||
use Box\Spout\Writer\Common\Entity\Worksheet;
|
||||
use Box\Spout\Writer\Common\Helper\CellHelper;
|
||||
@@ -60,9 +59,6 @@ EOD;
|
||||
/** @var StringHelper String helper */
|
||||
private $stringHelper;
|
||||
|
||||
/** @var InternalEntityFactory Factory to create entities */
|
||||
private $entityFactory;
|
||||
|
||||
/**
|
||||
* WorksheetManager constructor.
|
||||
*
|
||||
@@ -73,7 +69,6 @@ EOD;
|
||||
* @param SharedStringsManager $sharedStringsManager
|
||||
* @param XLSXEscaper $stringsEscaper
|
||||
* @param StringHelper $stringHelper
|
||||
* @param InternalEntityFactory $entityFactory
|
||||
*/
|
||||
public function __construct(
|
||||
OptionsManagerInterface $optionsManager,
|
||||
@@ -82,8 +77,7 @@ EOD;
|
||||
StyleMerger $styleMerger,
|
||||
SharedStringsManager $sharedStringsManager,
|
||||
XLSXEscaper $stringsEscaper,
|
||||
StringHelper $stringHelper,
|
||||
InternalEntityFactory $entityFactory
|
||||
StringHelper $stringHelper
|
||||
) {
|
||||
$this->shouldUseInlineStrings = $optionsManager->getOption(Options::SHOULD_USE_INLINE_STRINGS);
|
||||
$this->rowManager = $rowManager;
|
||||
@@ -92,7 +86,6 @@ EOD;
|
||||
$this->sharedStringsManager = $sharedStringsManager;
|
||||
$this->stringsEscaper = $stringsEscaper;
|
||||
$this->stringHelper = $stringHelper;
|
||||
$this->entityFactory = $entityFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user