[PHPOffice] Extract package to standalone project (#575)

This commit is contained in:
Tomas Votruba 2021-08-02 17:47:23 +02:00 committed by GitHub
parent 89511623cd
commit 66e21558ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 5 additions and 3619 deletions

View File

@ -28,6 +28,7 @@ jobs:
- rectorphp/rector-laravel
- rectorphp/rector-nette
- rectorphp/rector-cakephp
- rectorphp/rector-phpoffice
- sabbelasichon/typo3-rector
steps:

View File

@ -29,6 +29,7 @@
"rector/rector-nette": "^0.11.16",
"rector/rector-phpunit": "^0.11.6",
"rector/rector-symfony": "^0.11.12",
"rector/rector-phpoffice": "^0.11.2",
"sebastian/diff": "^4.0.4",
"ssch/typo3-rector": "^0.11.22",
"symfony/console": "5.3.x-dev",

View File

@ -1,315 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\ChangeConditionalGetConditionRector;
use Rector\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector;
use Rector\PHPOffice\Rector\MethodCall\ChangeConditionalSetConditionRector;
use Rector\PHPOffice\Rector\MethodCall\ChangeDuplicateStyleArrayToApplyFromArrayRector;
use Rector\PHPOffice\Rector\MethodCall\GetDefaultStyleToGetParentRector;
use Rector\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector;
use Rector\PHPOffice\Rector\MethodCall\RemoveSetTempDirOnExcelWriterRector;
use Rector\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector;
use Rector\PHPOffice\Rector\StaticCall\CellStaticToCoordinateRector;
use Rector\PHPOffice\Rector\StaticCall\ChangeChartRendererRector;
use Rector\PHPOffice\Rector\StaticCall\ChangeDataTypeForValueRector;
use Rector\PHPOffice\Rector\StaticCall\ChangeIOFactoryArgumentRector;
use Rector\PHPOffice\Rector\StaticCall\ChangePdfWriterRector;
use Rector\PHPOffice\Rector\StaticCall\ChangeSearchLocationToRegisterReaderRector;
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\Rector\StaticCall\RenameStaticMethodRector;
use Rector\Renaming\ValueObject\MethodCallRename;
use Rector\Renaming\ValueObject\RenameStaticMethod;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\SymfonyPhpConfig\ValueObjectInliner;
# see https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md
# inspired https://github.com/PHPOffice/PhpSpreadsheet/blob/87f71e1930b497b36e3b9b1522117dfa87096d2b/src/PhpSpreadsheet/Helper/Migrator.php
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeIOFactoryArgumentRector::class);
$services->set(ChangeSearchLocationToRegisterReaderRector::class);
$services->set(CellStaticToCoordinateRector::class);
$services->set(ChangeDataTypeForValueRector::class);
$services->set(ChangePdfWriterRector::class);
$services->set(ChangeChartRendererRector::class);
$services->set(AddRemovedDefaultValuesRector::class);
$services->set(ChangeConditionalReturnedCellRector::class);
$services->set(ChangeConditionalGetConditionRector::class);
$services->set(ChangeConditionalSetConditionRector::class);
$services->set(RemoveSetTempDirOnExcelWriterRector::class);
$services->set(ChangeDuplicateStyleArrayToApplyFromArrayRector::class);
$services->set(GetDefaultStyleToGetParentRector::class);
$services->set(IncreaseColumnIndexRector::class);
# beware! this can be run only once, since its circular change
$services->set(RenameMethodRector::class)
->call('configure', [[
RenameMethodRector::METHOD_CALL_RENAMES => ValueObjectInliner::inline([
// https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#worksheetsetsharedstyle
new MethodCallRename('PHPExcel_Worksheet', 'setSharedStyle', 'duplicateStyle'),
// https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#worksheetgetselectedcell
new MethodCallRename('PHPExcel_Worksheet', 'getSelectedCell', 'getSelectedCells'),
// https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#cell-caching
new MethodCallRename('PHPExcel_Worksheet', 'getCellCacheController', 'getCellCollection'),
new MethodCallRename('PHPExcel_Worksheet', 'getCellCollection', 'getCoordinates'),
]),
]]);
$configuration = [
new RenameStaticMethod('PHPExcel_Shared_Date', 'ExcelToPHP', 'PHPExcel_Shared_Date', 'excelToTimestamp'),
new RenameStaticMethod(
'PHPExcel_Shared_Date',
'ExcelToPHPObject',
'PHPExcel_Shared_Date',
'excelToDateTimeObject'
),
new RenameStaticMethod(
'PHPExcel_Shared_Date',
'FormattedPHPToExcel',
'PHPExcel_Shared_Date',
'formattedPHPToExcel'
),
new RenameStaticMethod(
'PHPExcel_Calculation_DateTime',
'DAYOFWEEK',
'PHPExcel_Calculation_DateTime',
'WEEKDAY'
),
new RenameStaticMethod(
'PHPExcel_Calculation_DateTime',
'WEEKOFYEAR',
'PHPExcel_Calculation_DateTime',
'WEEKNUCM'
),
new RenameStaticMethod(
'PHPExcel_Calculation_DateTime',
'SECONDOFMINUTE',
'PHPExcel_Calculation_DateTime',
'SECOND'
),
new RenameStaticMethod(
'PHPExcel_Calculation_DateTime',
'MINUTEOFHOUR',
'PHPExcel_Calculation_DateTime',
'MINUTE'
),
];
$services->set(RenameStaticMethodRector::class)
->call('configure', [[
RenameStaticMethodRector::OLD_TO_NEW_METHODS_BY_CLASSES => ValueObjectInliner::inline($configuration),
]]);
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'PHPExcel' => 'PhpOffice\PhpSpreadsheet\Spreadsheet',
'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip' => 'PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip',
'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer' => 'PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer\SpContainer',
'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE' => 'PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE',
'PHPExcel_Shared_Escher_DgContainer_SpgrContainer' => 'PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer',
'PHPExcel_Shared_Escher_DggContainer_BstoreContainer' => 'PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer',
'PHPExcel_Shared_OLE_PPS_File' => 'PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\File',
'PHPExcel_Shared_OLE_PPS_Root' => 'PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\Root',
'PHPExcel_Worksheet_AutoFilter_Column_Rule' => 'PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule',
'PHPExcel_Writer_OpenDocument_Cell_Comment' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\Cell\Comment',
'PHPExcel_Calculation_Token_Stack' => 'PhpOffice\PhpSpreadsheet\Calculation\Token\Stack',
'PHPExcel_Chart_Renderer_jpgraph' => 'PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph',
'PHPExcel_Reader_Excel5_Escher' => 'PhpOffice\PhpSpreadsheet\Reader\Xls\Escher',
'PHPExcel_Reader_Excel5_MD5' => 'PhpOffice\PhpSpreadsheet\Reader\Xls\MD5',
'PHPExcel_Reader_Excel5_RC4' => 'PhpOffice\PhpSpreadsheet\Reader\Xls\RC4',
'PHPExcel_Reader_Excel2007_Chart' => 'PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart',
'PHPExcel_Reader_Excel2007_Theme' => 'PhpOffice\PhpSpreadsheet\Reader\Xlsx\Theme',
'PHPExcel_Shared_Escher_DgContainer' => 'PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer',
'PHPExcel_Shared_Escher_DggContainer' => 'PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer',
'CholeskyDecomposition' => 'PhpOffice\PhpSpreadsheet\Shared\JAMA\CholeskyDecomposition',
'EigenvalueDecomposition' => 'PhpOffice\PhpSpreadsheet\Shared\JAMA\EigenvalueDecomposition',
'PHPExcel_Shared_JAMA_LUDecomposition' => 'PhpOffice\PhpSpreadsheet\Shared\JAMA\LUDecomposition',
'PHPExcel_Shared_JAMA_Matrix' => 'PhpOffice\PhpSpreadsheet\Shared\JAMA\Matrix',
'QRDecomposition' => 'PhpOffice\PhpSpreadsheet\Shared\JAMA\QRDecomposition',
'PHPExcel_Shared_JAMA_QRDecomposition' => 'PhpOffice\PhpSpreadsheet\Shared\JAMA\QRDecomposition',
'SingularValueDecomposition' => 'PhpOffice\PhpSpreadsheet\Shared\JAMA\SingularValueDecomposition',
'PHPExcel_Shared_OLE_ChainedBlockStream' => 'PhpOffice\PhpSpreadsheet\Shared\OLE\ChainedBlockStream',
'PHPExcel_Shared_OLE_PPS' => 'PhpOffice\PhpSpreadsheet\Shared\OLE\PPS',
'PHPExcel_Best_Fit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\BestFit',
'PHPExcel_Exponential_Best_Fit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\ExponentialBestFit',
'PHPExcel_Linear_Best_Fit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\LinearBestFit',
'PHPExcel_Logarithmic_Best_Fit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\LogarithmicBestFit',
'polynomialBestFit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\PolynomialBestFit',
'PHPExcel_Polynomial_Best_Fit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\PolynomialBestFit',
'powerBestFit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\PowerBestFit',
'PHPExcel_Power_Best_Fit' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\PowerBestFit',
'trendClass' => 'PhpOffice\PhpSpreadsheet\Shared\Trend\Trend',
'PHPExcel_Worksheet_AutoFilter_Column' => 'PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column',
'PHPExcel_Worksheet_Drawing_Shadow' => 'PhpOffice\PhpSpreadsheet\Worksheet\Drawing\Shadow',
'PHPExcel_Writer_OpenDocument_Content' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\Content',
'PHPExcel_Writer_OpenDocument_Meta' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\Meta',
'PHPExcel_Writer_OpenDocument_MetaInf' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\MetaInf',
'PHPExcel_Writer_OpenDocument_Mimetype' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\Mimetype',
'PHPExcel_Writer_OpenDocument_Settings' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\Settings',
'PHPExcel_Writer_OpenDocument_Styles' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\Styles',
'PHPExcel_Writer_OpenDocument_Thumbnails' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\Thumbnails',
'PHPExcel_Writer_OpenDocument_WriterPart' => 'PhpOffice\PhpSpreadsheet\Writer\Ods\WriterPart',
'PHPExcel_Writer_PDF_Core' => 'PhpOffice\PhpSpreadsheet\Writer\Pdf',
'PHPExcel_Writer_PDF_DomPDF' => 'PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf',
'PHPExcel_Writer_PDF_mPDF' => 'PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf',
'PHPExcel_Writer_PDF_tcPDF' => 'PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf',
'PHPExcel_Writer_Excel5_BIFFwriter' => 'PhpOffice\PhpSpreadsheet\Writer\Xls\BIFFwriter',
'PHPExcel_Writer_Excel5_Escher' => 'PhpOffice\PhpSpreadsheet\Writer\Xls\Escher',
'PHPExcel_Writer_Excel5_Font' => 'PhpOffice\PhpSpreadsheet\Writer\Xls\Font',
'PHPExcel_Writer_Excel5_Parser' => 'PhpOffice\PhpSpreadsheet\Writer\Xls\Parser',
'PHPExcel_Writer_Excel5_Workbook' => 'PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook',
'PHPExcel_Writer_Excel5_Worksheet' => 'PhpOffice\PhpSpreadsheet\Writer\Xls\Worksheet',
'PHPExcel_Writer_Excel5_Xf' => 'PhpOffice\PhpSpreadsheet\Writer\Xls\Xf',
'PHPExcel_Writer_Excel2007_Chart' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart',
'PHPExcel_Writer_Excel2007_Comments' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments',
'PHPExcel_Writer_Excel2007_ContentTypes' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\ContentTypes',
'PHPExcel_Writer_Excel2007_DocProps' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps',
'PHPExcel_Writer_Excel2007_Drawing' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing',
'PHPExcel_Writer_Excel2007_Rels' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels',
'PHPExcel_Writer_Excel2007_RelsRibbon' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsRibbon',
'PHPExcel_Writer_Excel2007_RelsVBA' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA',
'PHPExcel_Writer_Excel2007_StringTable' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable',
'PHPExcel_Writer_Excel2007_Style' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style',
'PHPExcel_Writer_Excel2007_Theme' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme',
'PHPExcel_Writer_Excel2007_Workbook' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook',
'PHPExcel_Writer_Excel2007_Worksheet' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet',
'PHPExcel_Writer_Excel2007_WriterPart' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart',
'PHPExcel_CachedObjectStorage_CacheBase' => 'PhpOffice\PhpSpreadsheet\Collection\Cells',
'PHPExcel_CalcEngine_CyclicReferenceStack' => 'PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack',
'PHPExcel_CalcEngine_Logger' => 'PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger',
'PHPExcel_Calculation_Functions' => 'PhpOffice\PhpSpreadsheet\Calculation\Functions',
'PHPExcel_Calculation_Function' => 'PhpOffice\PhpSpreadsheet\Calculation\Category',
'PHPExcel_Calculation_Database' => 'PhpOffice\PhpSpreadsheet\Calculation\Database',
'PHPExcel_Calculation_DateTime' => 'PhpOffice\PhpSpreadsheet\Calculation\DateTime',
'PHPExcel_Calculation_Engineering' => 'PhpOffice\PhpSpreadsheet\Calculation\Engineering',
'PHPExcel_Calculation_Exception' => 'PhpOffice\PhpSpreadsheet\Calculation\Exception',
'PHPExcel_Calculation_ExceptionHandler' => 'PhpOffice\PhpSpreadsheet\Calculation\ExceptionHandler',
'PHPExcel_Calculation_Financial' => 'PhpOffice\PhpSpreadsheet\Calculation\Financial',
'PHPExcel_Calculation_FormulaParser' => 'PhpOffice\PhpSpreadsheet\Calculation\FormulaParser',
'PHPExcel_Calculation_FormulaToken' => 'PhpOffice\PhpSpreadsheet\Calculation\FormulaToken',
'PHPExcel_Calculation_Logical' => 'PhpOffice\PhpSpreadsheet\Calculation\Logical',
'PHPExcel_Calculation_LookupRef' => 'PhpOffice\PhpSpreadsheet\Calculation\LookupRef',
'PHPExcel_Calculation_MathTrig' => 'PhpOffice\PhpSpreadsheet\Calculation\MathTrig',
'PHPExcel_Calculation_Statistical' => 'PhpOffice\PhpSpreadsheet\Calculation\Statistical',
'PHPExcel_Calculation_TextData' => 'PhpOffice\PhpSpreadsheet\Calculation\TextData',
'PHPExcel_Cell_AdvancedValueBinder' => 'PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder',
'PHPExcel_Cell_DataType' => 'PhpOffice\PhpSpreadsheet\Cell\DataType',
'PHPExcel_Cell_DataValidation' => 'PhpOffice\PhpSpreadsheet\Cell\DataValidation',
'PHPExcel_Cell_DefaultValueBinder' => 'PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder',
'PHPExcel_Cell_Hyperlink' => 'PhpOffice\PhpSpreadsheet\Cell\Hyperlink',
'PHPExcel_Cell_IValueBinder' => 'PhpOffice\PhpSpreadsheet\Cell\IValueBinder',
'PHPExcel_Chart_Axis' => 'PhpOffice\PhpSpreadsheet\Chart\Axis',
'PHPExcel_Chart_DataSeries' => 'PhpOffice\PhpSpreadsheet\Chart\DataSeries',
'PHPExcel_Chart_DataSeriesValues' => 'PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues',
'PHPExcel_Chart_Exception' => 'PhpOffice\PhpSpreadsheet\Chart\Exception',
'PHPExcel_Chart_GridLines' => 'PhpOffice\PhpSpreadsheet\Chart\GridLines',
'PHPExcel_Chart_Layout' => 'PhpOffice\PhpSpreadsheet\Chart\Layout',
'PHPExcel_Chart_Legend' => 'PhpOffice\PhpSpreadsheet\Chart\Legend',
'PHPExcel_Chart_PlotArea' => 'PhpOffice\PhpSpreadsheet\Chart\PlotArea',
'PHPExcel_Properties' => 'PhpOffice\PhpSpreadsheet\Chart\Properties',
'PHPExcel_Chart_Title' => 'PhpOffice\PhpSpreadsheet\Chart\Title',
'PHPExcel_DocumentProperties' => 'PhpOffice\PhpSpreadsheet\Document\Properties',
'PHPExcel_DocumentSecurity' => 'PhpOffice\PhpSpreadsheet\Document\Security',
'PHPExcel_Helper_HTML' => 'PhpOffice\PhpSpreadsheet\Helper\Html',
'PHPExcel_Reader_Abstract' => 'PhpOffice\PhpSpreadsheet\Reader\BaseReader',
'PHPExcel_Reader_CSV' => 'PhpOffice\PhpSpreadsheet\Reader\Csv',
'PHPExcel_Reader_DefaultReadFilter' => 'PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter',
'PHPExcel_Reader_Excel2003XML' => 'PhpOffice\PhpSpreadsheet\Reader\Xml',
'PHPExcel_Reader_Exception' => 'PhpOffice\PhpSpreadsheet\Reader\Exception',
'PHPExcel_Reader_Gnumeric' => 'PhpOffice\PhpSpreadsheet\Reader\Gnumeric',
'PHPExcel_Reader_HTML' => 'PhpOffice\PhpSpreadsheet\Reader\Html',
'PHPExcel_Reader_IReadFilter' => 'PhpOffice\PhpSpreadsheet\Reader\IReadFilter',
'PHPExcel_Reader_IReader' => 'PhpOffice\PhpSpreadsheet\Reader\IReader',
'PHPExcel_Reader_OOCalc' => 'PhpOffice\PhpSpreadsheet\Reader\Ods',
'PHPExcel_Reader_SYLK' => 'PhpOffice\PhpSpreadsheet\Reader\Slk',
'PHPExcel_Reader_Excel5' => 'PhpOffice\PhpSpreadsheet\Reader\Xls',
'PHPExcel_Reader_Excel2007' => 'PhpOffice\PhpSpreadsheet\Reader\Xlsx',
'PHPExcel_RichText_ITextElement' => 'PhpOffice\PhpSpreadsheet\RichText\ITextElement',
'PHPExcel_RichText_Run' => 'PhpOffice\PhpSpreadsheet\RichText\Run',
'PHPExcel_RichText_TextElement' => 'PhpOffice\PhpSpreadsheet\RichText\TextElement',
'PHPExcel_Shared_CodePage' => 'PhpOffice\PhpSpreadsheet\Shared\CodePage',
'PHPExcel_Shared_Date' => 'PhpOffice\PhpSpreadsheet\Shared\Date',
'PHPExcel_Shared_Drawing' => 'PhpOffice\PhpSpreadsheet\Shared\Drawing',
'PHPExcel_Shared_Escher' => 'PhpOffice\PhpSpreadsheet\Shared\Escher',
'PHPExcel_Shared_File' => 'PhpOffice\PhpSpreadsheet\Shared\File',
'PHPExcel_Shared_Font' => 'PhpOffice\PhpSpreadsheet\Shared\Font',
'PHPExcel_Shared_OLE' => 'PhpOffice\PhpSpreadsheet\Shared\OLE',
'PHPExcel_Shared_OLERead' => 'PhpOffice\PhpSpreadsheet\Shared\OLERead',
'PHPExcel_Shared_PasswordHasher' => 'PhpOffice\PhpSpreadsheet\Shared\PasswordHasher',
'PHPExcel_Shared_String' => 'PhpOffice\PhpSpreadsheet\Shared\StringHelper',
'PHPExcel_Shared_TimeZone' => 'PhpOffice\PhpSpreadsheet\Shared\TimeZone',
'PHPExcel_Shared_XMLWriter' => 'PhpOffice\PhpSpreadsheet\Shared\XMLWriter',
'PHPExcel_Shared_Excel5' => 'PhpOffice\PhpSpreadsheet\Shared\Xls',
'PHPExcel_Style_Alignment' => 'PhpOffice\PhpSpreadsheet\Style\Alignment',
'PHPExcel_Style_Border' => 'PhpOffice\PhpSpreadsheet\Style\Border',
'PHPExcel_Style_Borders' => 'PhpOffice\PhpSpreadsheet\Style\Borders',
'PHPExcel_Style_Color' => 'PhpOffice\PhpSpreadsheet\Style\Color',
'PHPExcel_Style_Conditional' => 'PhpOffice\PhpSpreadsheet\Style\Conditional',
'PHPExcel_Style_Fill' => 'PhpOffice\PhpSpreadsheet\Style\Fill',
'PHPExcel_Style_Font' => 'PhpOffice\PhpSpreadsheet\Style\Font',
'PHPExcel_Style_NumberFormat' => 'PhpOffice\PhpSpreadsheet\Style\NumberFormat',
'PHPExcel_Style_Protection' => 'PhpOffice\PhpSpreadsheet\Style\Protection',
'PHPExcel_Style_Supervisor' => 'PhpOffice\PhpSpreadsheet\Style\Supervisor',
'PHPExcel_Worksheet_AutoFilter' => 'PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter',
'PHPExcel_Worksheet_BaseDrawing' => 'PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing',
'PHPExcel_Worksheet_CellIterator' => 'PhpOffice\PhpSpreadsheet\Worksheet\CellIterator',
'PHPExcel_Worksheet_Column' => 'PhpOffice\PhpSpreadsheet\Worksheet\Column',
'PHPExcel_Worksheet_ColumnCellIterator' => 'PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator',
'PHPExcel_Worksheet_ColumnDimension' => 'PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension',
'PHPExcel_Worksheet_ColumnIterator' => 'PhpOffice\PhpSpreadsheet\Worksheet\ColumnIterator',
'PHPExcel_Worksheet_Drawing' => 'PhpOffice\PhpSpreadsheet\Worksheet\Drawing',
'PHPExcel_Worksheet_HeaderFooter' => 'PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter',
'PHPExcel_Worksheet_HeaderFooterDrawing' => 'PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing',
'PHPExcel_WorksheetIterator' => 'PhpOffice\PhpSpreadsheet\Worksheet\Iterator',
'PHPExcel_Worksheet_MemoryDrawing' => 'PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing',
'PHPExcel_Worksheet_PageMargins' => 'PhpOffice\PhpSpreadsheet\Worksheet\PageMargins',
'PHPExcel_Worksheet_PageSetup' => 'PhpOffice\PhpSpreadsheet\Worksheet\PageSetup',
'PHPExcel_Worksheet_Protection' => 'PhpOffice\PhpSpreadsheet\Worksheet\Protection',
'PHPExcel_Worksheet_Row' => 'PhpOffice\PhpSpreadsheet\Worksheet\Row',
'PHPExcel_Worksheet_RowCellIterator' => 'PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator',
'PHPExcel_Worksheet_RowDimension' => 'PhpOffice\PhpSpreadsheet\Worksheet\RowDimension',
'PHPExcel_Worksheet_RowIterator' => 'PhpOffice\PhpSpreadsheet\Worksheet\RowIterator',
'PHPExcel_Worksheet_SheetView' => 'PhpOffice\PhpSpreadsheet\Worksheet\SheetView',
'PHPExcel_Writer_Abstract' => 'PhpOffice\PhpSpreadsheet\Writer\BaseWriter',
'PHPExcel_Writer_CSV' => 'PhpOffice\PhpSpreadsheet\Writer\Csv',
'PHPExcel_Writer_Exception' => 'PhpOffice\PhpSpreadsheet\Writer\Exception',
'PHPExcel_Writer_HTML' => 'PhpOffice\PhpSpreadsheet\Writer\Html',
'PHPExcel_Writer_IWriter' => 'PhpOffice\PhpSpreadsheet\Writer\IWriter',
'PHPExcel_Writer_OpenDocument' => 'PhpOffice\PhpSpreadsheet\Writer\Ods',
'PHPExcel_Writer_PDF' => 'PhpOffice\PhpSpreadsheet\Writer\Pdf',
'PHPExcel_Writer_Excel5' => 'PhpOffice\PhpSpreadsheet\Writer\Xls',
'PHPExcel_Writer_Excel2007' => 'PhpOffice\PhpSpreadsheet\Writer\Xlsx',
'PHPExcel_CachedObjectStorageFactory' => 'PhpOffice\PhpSpreadsheet\Collection\CellsFactory',
'PHPExcel_Calculation' => 'PhpOffice\PhpSpreadsheet\Calculation\Calculation',
'PHPExcel_Cell' => 'PhpOffice\PhpSpreadsheet\Cell\Cell',
'PHPExcel_Chart' => 'PhpOffice\PhpSpreadsheet\Chart\Chart',
'PHPExcel_Comment' => 'PhpOffice\PhpSpreadsheet\Comment',
'PHPExcel_Exception' => 'PhpOffice\PhpSpreadsheet\Exception',
'PHPExcel_HashTable' => 'PhpOffice\PhpSpreadsheet\HashTable',
'PHPExcel_IComparable' => 'PhpOffice\PhpSpreadsheet\IComparable',
'PHPExcel_IOFactory' => 'PhpOffice\PhpSpreadsheet\IOFactory',
'PHPExcel_NamedRange' => 'PhpOffice\PhpSpreadsheet\NamedRange',
'PHPExcel_ReferenceHelper' => 'PhpOffice\PhpSpreadsheet\ReferenceHelper',
'PHPExcel_RichText' => 'PhpOffice\PhpSpreadsheet\RichText\RichText',
'PHPExcel_Settings' => 'PhpOffice\PhpSpreadsheet\Settings',
'PHPExcel_Style' => 'PhpOffice\PhpSpreadsheet\Style\Style',
'PHPExcel_Worksheet' => 'PhpOffice\PhpSpreadsheet\Worksheet\Worksheet',
],
]]);
};

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Rector\Set\ValueObject;
use Rector\PHPOffice\Set\PHPOfficeSetList;
use Rector\Set\Contract\SetListInterface;
final class SetList implements SetListInterface
@ -90,8 +91,9 @@ final class SetList implements SetListInterface
/**
* @var string
* @deprecated Use PHPOfficeSetList class instead
*/
public const PHPEXCEL_TO_PHPSPREADSHEET = __DIR__ . '/../../../config/set/phpexcel-to-phpspreadsheet.php';
public const PHPEXCEL_TO_PHPSPREADSHEET = PHPOfficeSetList::PHPEXCEL_TO_PHPSPREADSHEET;
/**
* @var string

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalGetConditionRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeConditionalGetConditionRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalGetConditionRector\Fixture;
final class Fixture
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->getCondition();
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalGetConditionRector\Fixture;
final class Fixture
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->getConditions()[0] ?? '';
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\ChangeConditionalGetConditionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeConditionalGetConditionRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeConditionalReturnedCellRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector\Fixture;
final class Fixture
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$cell = $worksheet->setCellValue('A1', 'value', true);
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector\Fixture;
final class Fixture
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$cell = $worksheet->getCell('A1')->setValue('value');
}
}
?>

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector\Fixture;
final class SetExplicit
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$cell = $worksheet->setCellValueExplicitByColumnAndRow('A1', 'value', 'bla', 'bla', true);
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector\Fixture;
final class SetExplicit
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$cell = $worksheet->getCellByColumnAndRow('A1', 'value')->setValueExplicit('bla', 'bla');
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeConditionalReturnedCellRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalSetConditionRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeConditionalSetConditionRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalSetConditionRector\Fixture;
final class Fixture
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->setCondition(1);
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalSetConditionRector\Fixture;
final class Fixture
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->setConditions((array) 1);
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\ChangeConditionalSetConditionRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeConditionalSetConditionRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeDuplicateStyleArrayToApplyFromArrayRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeDuplicateStyleArrayToApplyFromArrayRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeDuplicateStyleArrayToApplyFromArrayRector\Fixture;
final class Fixture
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->duplicateStyleArray($styles, $range, $advanced);
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\ChangeDuplicateStyleArrayToApplyFromArrayRector\Fixture;
final class Fixture
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->getStyle($range)->applyFromArray($styles, $advanced);
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\ChangeDuplicateStyleArrayToApplyFromArrayRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeDuplicateStyleArrayToApplyFromArrayRector::class);
};

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\GetDefaultStyleToGetParentRector\Fixture;
class Fixture
{
public function run()
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->getDefaultStyle();
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\GetDefaultStyleToGetParentRector\Fixture;
class Fixture
{
public function run()
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->getParent()->getDefaultStyle();
}
}
?>

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\MethodCall\GetDefaultStyleToGetParentRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class GetDefaultStyleToGetParentRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\GetDefaultStyleToGetParentRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(GetDefaultStyleToGetParentRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class ConcatNumber
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$number = 55;
$worksheet->setCellValueByColumnAndRow($number + 3, 3, '1150');
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class ConcatNumber
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$number = 55;
$worksheet->setCellValueByColumnAndRow($number + 4, 3, '1150');
}
}
?>

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class Fixture
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->setCellValueByColumnAndRow(0, 3, '1150');
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class Fixture
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->setCellValueByColumnAndRow(1, 3, '1150');
}
}
?>

View File

@ -1,39 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class For_
{
public function run(): void
{
$max = 1000;
$row = 5;
$worksheet = new \PHPExcel_Worksheet();
for ($column = 0; $column < $max; $column++) {
$worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column);
}
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class For_
{
public function run(): void
{
$max = 1000;
$row = 5;
$worksheet = new \PHPExcel_Worksheet();
for ($column = 1; $column < $max; $column++) {
$worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column);
}
}
}
?>

View File

@ -1,39 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class ForWithCalls
{
public function run(): void
{
$max = 1000;
$row = 5;
$worksheet = new \PHPExcel_Worksheet();
for ($column = 0; $column < $max; $column++) {
$worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column)->anotherCall();
}
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class ForWithCalls
{
public function run(): void
{
$max = 1000;
$row = 5;
$worksheet = new \PHPExcel_Worksheet();
for ($column = 1; $column < $max; $column++) {
$worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column)->anotherCall();
}
}
}
?>

View File

@ -1,33 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class VariableRenamed
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$number = 55;
$worksheet->setCellValueByColumnAndRow($number, 3, '1150');
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\Fixture;
final class VariableRenamed
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$number = 55;
$worksheet->setCellValueByColumnAndRow($number + 1, 3, '1150');
}
}
?>

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class IncreaseColumnIndexRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(IncreaseColumnIndexRector::class);
};

View File

@ -1,28 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\RemoveSetTempDirOnExcelWriterRector\Fixture;
final class Fixture
{
public function run(): void
{
$writer = new \PHPExcel_Writer_Excel5;
$writer->setTempDir();
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\MethodCall\RemoveSetTempDirOnExcelWriterRector\Fixture;
final class Fixture
{
public function run(): void
{
$writer = new \PHPExcel_Writer_Excel5;
}
}
?>

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\MethodCall\RemoveSetTempDirOnExcelWriterRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class RemoveSetTempDirOnExcelWriterRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\MethodCall\RemoveSetTempDirOnExcelWriterRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(RemoveSetTempDirOnExcelWriterRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class AddRemovedDefaultValuesRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector\Fixture;
final class ClassConstant
{
public function run(): void
{
$dataValidation = new \PHPExcel_Cell_DataValidation;
$dataValidation->setType();
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector\Fixture;
final class ClassConstant
{
public function run(): void
{
$dataValidation = new \PHPExcel_Cell_DataValidation;
$dataValidation->setType(\PHPExcel_Cell_DataValidation::TYPE_NONE);
}
}
?>

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector\Fixture;
final class Fixture
{
public function run(): void
{
$logger = new \PHPExcel_CalcEngine_Logger;
$logger->setWriteDebugLog();
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector\Fixture;
final class Fixture
{
public function run(): void
{
$logger = new \PHPExcel_CalcEngine_Logger;
$logger->setWriteDebugLog(false);
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector\Fixture;
final class SomeStaticCall
{
public function run(): void
{
\PHPExcel_Cell_DataValidation::setType();
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector\Fixture;
final class SomeStaticCall
{
public function run(): void
{
\PHPExcel_Cell_DataValidation::setType(\PHPExcel_Cell_DataValidation::TYPE_NONE);
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(AddRemovedDefaultValuesRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\StaticCall\CellStaticToCoordinateRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class CellStaticToCoordinateRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\CellStaticToCoordinateRector\Fixture;
class Fixture
{
public function run()
{
\PHPExcel_Cell::stringFromColumnIndex();
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\CellStaticToCoordinateRector\Fixture;
class Fixture
{
public function run()
{
\PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex();
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\StaticCall\CellStaticToCoordinateRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(CellStaticToCoordinateRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeChartRendererRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeChartRendererRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeChartRendererRector\Fixture;
final class Fixture
{
public function run(): void
{
\PHPExcel_Settings::setChartRenderer($rendererName, $rendererLibraryPath);
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeChartRendererRector\Fixture;
final class Fixture
{
public function run(): void
{
\PHPExcel_Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class);
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\StaticCall\ChangeChartRendererRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeChartRendererRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeDataTypeForValueRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeDataTypeForValueRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeDataTypeForValueRector\Fixture;
final class Fixture
{
public function run(): void
{
$type = \PHPExcel_Cell_DataType::dataTypeForValue('value');
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeDataTypeForValueRector\Fixture;
final class Fixture
{
public function run(): void
{
$type = \PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::dataTypeForValue('value');
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\StaticCall\ChangeDataTypeForValueRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeDataTypeForValueRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeIOFactoryArgumentRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeIOFactoryArgumentRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeIOFactoryArgumentRector\Fixture;
final class Fixture
{
public function run(): void
{
$writer = \PHPExcel_IOFactory::createWriter('CSV');
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeIOFactoryArgumentRector\Fixture;
final class Fixture
{
public function run(): void
{
$writer = \PHPExcel_IOFactory::createWriter('Csv');
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\StaticCall\ChangeIOFactoryArgumentRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeIOFactoryArgumentRector::class);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangePdfWriterRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangePdfWriterRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangePdfWriterRector\Fixture;
final class Fixture
{
public function run(string $format): void
{
\PHPExcel_Settings::setPdfRendererName(PHPExcel_Settings::PDF_RENDERER_MPDF);
\PHPExcel_Settings::setPdfRenderer($somePath);
$writer = \PHPExcel_IOFactory::createWriter($spreadsheet, 'PDF');
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangePdfWriterRector\Fixture;
final class Fixture
{
public function run(string $format): void
{
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet);
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangePdfWriterRector\Fixture;
final class VariableFormatFixture
{
public function run(string $format): void
{
$writer = \PHPExcel_IOFactory::createWriter($spreadsheet, $format);
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangePdfWriterRector\Fixture;
final class VariableFormatFixture
{
public function run(string $format): void
{
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, $format);
}
}
?>

View File

@ -1,20 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\StaticCall\ChangePdfWriterRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangePdfWriterRector::class);
$services->set(RenameClassRector::class)
->call('configure', [[
RenameClassRector::OLD_TO_NEW_CLASSES => [
'PHPExcel_IOFactory' => 'PhpOffice\PhpSpreadsheet\IOFactory',
],
],
]);
};

View File

@ -1,33 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeSearchLocationToRegisterReaderRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;
final class ChangeSearchLocationToRegisterReaderRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}
/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeSearchLocationToRegisterReaderRector\Fixture;
final class Fixture
{
public function run(): void
{
\PHPExcel_IOFactory::addSearchLocation($type, $location, $classname);
}
}
?>
-----
<?php
namespace Rector\Tests\PHPOffice\Rector\StaticCall\ChangeSearchLocationToRegisterReaderRector\Fixture;
final class Fixture
{
public function run(): void
{
\PhpOffice\PhpSpreadsheet\IOFactory::registerReader($type, $classname);
}
}
?>

View File

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
use Rector\PHPOffice\Rector\StaticCall\ChangeSearchLocationToRegisterReaderRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ChangeSearchLocationToRegisterReaderRector::class);
};

View File

@ -1,84 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\BinaryOp\Coalesce;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Scalar\String_;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#conditionalgetcondition
*
* @see \Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalGetConditionRector\ChangeConditionalGetConditionRectorTest
*/
final class ChangeConditionalGetConditionRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Change argument PHPExcel_Style_Conditional->getCondition() to getConditions()',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->getCondition();
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->getConditions()[0] ?? '';
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [MethodCall::class];
}
/**
* @param MethodCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->var, new ObjectType('PHPExcel_Style_Conditional'))) {
return null;
}
if (! $this->isName($node->name, 'getCondition')) {
return null;
}
$node->name = new Identifier('getConditions');
$arrayDimFetch = new ArrayDimFetch($node, new LNumber(0));
return new Coalesce($arrayDimFetch, new String_(''));
}
}

View File

@ -1,134 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Rector\PHPOffice\ValueObject\ConditionalSetValue;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#dropped-conditionally-returned-cell
*
* @see \Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector\ChangeConditionalReturnedCellRectorTest
*/
final class ChangeConditionalReturnedCellRector extends AbstractRector
{
/**
* @var ConditionalSetValue[]
*/
private array $conditionalSetValues = [];
public function __construct()
{
$this->conditionalSetValues[] = new ConditionalSetValue('setCellValue', 'getCell', 'setValue', 2, false);
$this->conditionalSetValues[] = new ConditionalSetValue(
'setCellValueByColumnAndRow',
'getCellByColumnAndRow',
'setValue',
3,
true
);
$this->conditionalSetValues[] = new ConditionalSetValue(
'setCellValueExplicit',
'getCell',
'setValueExplicit',
3,
false
);
$this->conditionalSetValues[] = new ConditionalSetValue(
'setCellValueExplicitByColumnAndRow',
'getCellByColumnAndRow',
'setValueExplicit',
4,
true
);
}
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Change conditional call to getCell()', [
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$cell = $worksheet->setCellValue('A1', 'value', true);
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$cell = $worksheet->getCell('A1')->setValue('value');
}
}
CODE_SAMPLE
),
]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [MethodCall::class];
}
/**
* @param MethodCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->var, new ObjectType('PHPExcel_Worksheet'))) {
return null;
}
foreach ($this->conditionalSetValues as $conditionalSetValue) {
if (! $this->isName($node->name, $conditionalSetValue->getOldMethod())) {
continue;
}
if (! isset($node->args[$conditionalSetValue->getArgPosition()])) {
continue;
}
$args = $node->args;
unset($args[$conditionalSetValue->getArgPosition()]);
$locationArgs = [];
$locationArgs[] = $args[0];
unset($args[0]);
if ($conditionalSetValue->hasRow()) {
$locationArgs[] = $args[1];
unset($args[1]);
}
$variable = clone $node->var;
$getCellMethodCall = new MethodCall($variable, $conditionalSetValue->getNewGetMethod(), $locationArgs);
$node->var = $getCellMethodCall;
$node->args = $args;
$node->name = new Identifier($conditionalSetValue->getNewSetMethod());
return $node;
}
return null;
}
}

View File

@ -1,94 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\Cast\Array_;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PHPStan\Type\ArrayType;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#conditionalsetcondition
*
* @see \Rector\Tests\PHPOffice\Rector\MethodCall\ChangeConditionalSetConditionRector\ChangeConditionalSetConditionRectorTest
*/
final class ChangeConditionalSetConditionRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Change argument PHPExcel_Style_Conditional->setCondition() to setConditions()',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->setCondition(1);
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$conditional = new \PHPExcel_Style_Conditional;
$someCondition = $conditional->setConditions((array) 1);
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [MethodCall::class];
}
/**
* @param MethodCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->var, new ObjectType('PHPExcel_Style_Conditional'))) {
return null;
}
if (! $this->isName($node->name, 'setCondition')) {
return null;
}
$node->name = new Identifier('setConditions');
$this->castArgumentToArrayIfNotArrayType($node);
return $node;
}
private function castArgumentToArrayIfNotArrayType(MethodCall $methodCall): void
{
$firstArgumentValue = $methodCall->args[0]->value;
$firstArgumentStaticType = $this->getStaticType($firstArgumentValue);
if ($firstArgumentStaticType instanceof ArrayType) {
return;
}
// cast to array if not an array
$methodCall->args[0]->value = new Array_($firstArgumentValue);
}
}

View File

@ -1,87 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#removed-deprecated-things
*
* @see \Rector\Tests\PHPOffice\Rector\MethodCall\ChangeDuplicateStyleArrayToApplyFromArrayRector\ChangeDuplicateStyleArrayToApplyFromArrayRectorTest
*/
final class ChangeDuplicateStyleArrayToApplyFromArrayRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Change method call duplicateStyleArray() to getStyle() + applyFromArray()',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->duplicateStyleArray($styles, $range, $advanced);
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->getStyle($range)->applyFromArray($styles, $advanced);
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [MethodCall::class];
}
/**
* @param MethodCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->var, new ObjectType('PHPExcel_Worksheet'))) {
return null;
}
if (! $this->nodeNameResolver->isName($node->name, 'duplicateStyleArray')) {
return null;
}
$variable = clone $node->var;
// pop out 2nd argument
$secondArgument = $node->args[1];
unset($node->args[1]);
$getStyleMethodCall = new MethodCall($variable, 'getStyle', [$secondArgument]);
$node->var = $getStyleMethodCall;
$node->name = new Identifier('applyFromArray');
return $node;
}
}

View File

@ -1,81 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#dedicated-class-to-manipulate-coordinates
*
* @see \Rector\Tests\PHPOffice\Rector\MethodCall\GetDefaultStyleToGetParentRector\GetDefaultStyleToGetParentRectorTest
*/
final class GetDefaultStyleToGetParentRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Methods to (new Worksheet())->getDefaultStyle() to getParent()->getDefaultStyle()',
[
new CodeSample(
<<<'CODE_SAMPLE'
class SomeClass
{
public function run()
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->getDefaultStyle();
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
class SomeClass
{
public function run()
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->getParent()->getDefaultStyle();
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [MethodCall::class];
}
/**
* @param MethodCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->var, new ObjectType('PHPExcel_Worksheet'))) {
return null;
}
if (! $this->isName($node->name, 'getDefaultStyle')) {
return null;
}
$variable = clone $node->var;
$getParentMethodCall = new MethodCall($variable, 'getParent');
$node->var = $getParentMethodCall;
return $node;
}
}

View File

@ -1,183 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\BinaryOp\Plus;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Stmt\For_;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#column-index-based-on-1
*
* @see \Rector\Tests\PHPOffice\Rector\MethodCall\IncreaseColumnIndexRector\IncreaseColumnIndexRectorTest
*/
final class IncreaseColumnIndexRector extends AbstractRector
{
/**
* @var string
*/
private const ALREADY_CHANGED = 'already_changed';
/**
* @var ObjectType[]
*/
private array $worksheetObjectTypes = [];
public function __construct()
{
$this->worksheetObjectTypes = [
new ObjectType('PHPExcel_Worksheet'),
new ObjectType('PHPExcel_Worksheet_PageSetup'),
];
}
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Column index changed from 0 to 1 - run only ONCE! changes current value without memory',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->setCellValueByColumnAndRow(0, 3, '1150');
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$worksheet = new \PHPExcel_Worksheet();
$worksheet->setCellValueByColumnAndRow(1, 3, '1150');
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [MethodCall::class];
}
/**
* @param MethodCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->nodeTypeResolver->isObjectTypes($node->var, $this->worksheetObjectTypes)) {
return null;
}
if (! $this->isName($node->name, '*ByColumnAndRow')) {
return null;
}
$hasAlreadyChanged = $node->getAttribute(self::ALREADY_CHANGED);
if ($hasAlreadyChanged) {
return null;
}
$node->setAttribute(self::ALREADY_CHANGED, true);
// increase column value
$firstArgumentValue = $node->args[0]->value;
if ($firstArgumentValue instanceof LNumber) {
++$firstArgumentValue->value;
}
if ($firstArgumentValue instanceof BinaryOp) {
$this->refactorBinaryOp($firstArgumentValue);
}
if ($firstArgumentValue instanceof Variable) {
// check if for() value, rather update that
$lNumber = $this->findPreviousForWithVariable($firstArgumentValue);
if (! $lNumber instanceof LNumber) {
$node->args[0]->value = new Plus($firstArgumentValue, new LNumber(1));
return null;
}
++$lNumber->value;
}
return $node;
}
private function refactorBinaryOp(BinaryOp $binaryOp): void
{
if ($binaryOp->left instanceof LNumber) {
++$binaryOp->left->value;
return;
}
if ($binaryOp->right instanceof LNumber) {
++$binaryOp->right->value;
}
}
private function findPreviousForWithVariable(Variable $variable): ?LNumber
{
$for = $this->betterNodeFinder->findFirstPreviousOfTypes($variable, [For_::class]);
if (! $for instanceof For_) {
return null;
}
$variableName = $this->getName($variable);
if ($variableName === null) {
return null;
}
$assignVariable = $this->findVariableAssignName($for->init, $variableName);
if (! $assignVariable instanceof Assign) {
return null;
}
$assignedExpr = $assignVariable->expr;
if ($assignedExpr instanceof LNumber) {
return $assignedExpr;
}
return null;
}
/**
* @param Node[] $node
*/
private function findVariableAssignName(array $node, string $variableName): ?Node
{
return $this->betterNodeFinder->findFirst($node, function (Node $node) use ($variableName): bool {
if (! $node instanceof Assign) {
return false;
}
if (! $node->var instanceof Variable) {
return false;
}
return $this->nodeNameResolver->isName($node->var, $variableName);
});
}
}

View File

@ -1,77 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#writerxlssettempdir
*
* @see \Rector\Tests\PHPOffice\Rector\MethodCall\RemoveSetTempDirOnExcelWriterRector\RemoveSetTempDirOnExcelWriterRectorTest
*/
final class RemoveSetTempDirOnExcelWriterRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Remove setTempDir() on PHPExcel_Writer_Excel5',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$writer = new \PHPExcel_Writer_Excel5;
$writer->setTempDir();
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$writer = new \PHPExcel_Writer_Excel5;
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [MethodCall::class];
}
/**
* @param MethodCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->var, new ObjectType('PHPExcel_Writer_Excel5'))) {
return null;
}
if (! $this->isName($node->name, 'setTempDir')) {
return null;
}
$this->removeNode($node);
return $node;
}
}

View File

@ -1,110 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\StaticCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Rector\PHPOffice\ValueObject\PHPExcelMethodDefaultValues;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/commit/033a4bdad56340795a5bf7ec3c8a2fde005cda24 https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#removed-default-values
*
* @see \Rector\Tests\PHPOffice\Rector\StaticCall\AddRemovedDefaultValuesRector\AddRemovedDefaultValuesRectorTest
*/
final class AddRemovedDefaultValuesRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Complete removed default values explicitly', [
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$logger = new \PHPExcel_CalcEngine_Logger;
$logger->setWriteDebugLog();
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$logger = new \PHPExcel_CalcEngine_Logger;
$logger->setWriteDebugLog(false);
}
}
CODE_SAMPLE
),
]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StaticCall::class, MethodCall::class];
}
/**
* @param StaticCall|MethodCall $node
*/
public function refactor(Node $node): StaticCall | MethodCall
{
foreach (PHPExcelMethodDefaultValues::METHOD_NAMES_BY_TYPE_WITH_VALUE as $type => $defaultValuesByMethodName) {
if (! $this->isCallerObjectType($node, new ObjectType($type))) {
continue;
}
foreach ($defaultValuesByMethodName as $methodName => $defaultValuesByPosition) {
if (! $this->isName($node->name, $methodName)) {
continue;
}
$this->refactorArgs($node, $defaultValuesByPosition);
}
}
return $node;
}
/**
* @param array<int, mixed> $defaultValuesByPosition
*/
private function refactorArgs(StaticCall | MethodCall $node, array $defaultValuesByPosition): void
{
foreach ($defaultValuesByPosition as $position => $defaultValue) {
// value is already set
if (isset($node->args[$position])) {
continue;
}
if (is_string($defaultValue) && \str_contains($defaultValue, '::')) {
[$className, $constant] = explode('::', $defaultValue);
$classConstant = $this->nodeFactory->createClassConstFetch($className, $constant);
$arg = new Arg($classConstant);
} else {
$arg = $this->nodeFactory->createArg($defaultValue);
}
$node->args[$position] = $arg;
}
}
private function isCallerObjectType(StaticCall | MethodCall $node, ObjectType $objectType): bool
{
return $this->isObjectType($node instanceof MethodCall ? $node->var : $node->class, $objectType);
}
}

View File

@ -1,95 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\StaticCall;
use PhpParser\Node;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Name\FullyQualified;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#dedicated-class-to-manipulate-coordinates
*
* @see \Rector\Tests\PHPOffice\Rector\StaticCall\CellStaticToCoordinateRector\CellStaticToCoordinateRectorTest
*/
final class CellStaticToCoordinateRector extends AbstractRector
{
/**
* @var string[]
*/
private const DECOUPLED_METHODS = [
'absoluteCoordinate',
'absoluteReference',
'buildRange',
'columnIndexFromString',
'coordinateFromString',
'extractAllCellReferencesInRange',
'getRangeBoundaries',
'mergeRangesInCollection',
'rangeBoundaries',
'rangeDimension',
'splitRange',
'stringFromColumnIndex',
];
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Methods to manipulate coordinates that used to exists in PHPExcel_Cell to PhpOffice\PhpSpreadsheet\Cell\Coordinate',
[
new CodeSample(
<<<'CODE_SAMPLE'
class SomeClass
{
public function run()
{
\PHPExcel_Cell::stringFromColumnIndex();
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
class SomeClass
{
public function run()
{
\PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex();
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StaticCall::class];
}
/**
* @param StaticCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->class, new ObjectType('PHPExcel_Cell'))) {
return null;
}
if (! $this->isNames($node->name, self::DECOUPLED_METHODS)) {
return null;
}
$node->class = new FullyQualified('PhpOffice\PhpSpreadsheet\Cell\Coordinate');
return $node;
}
}

View File

@ -1,82 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\StaticCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\StaticCall;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#rendering-charts
*
* @see \Rector\Tests\PHPOffice\Rector\StaticCall\ChangeChartRendererRector\ChangeChartRendererRectorTest
*/
final class ChangeChartRendererRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Change chart renderer', [
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
\PHPExcel_Settings::setChartRenderer($rendererName, $rendererLibraryPath);
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
\PHPExcel_Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class);
}
}
CODE_SAMPLE
),
]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StaticCall::class];
}
/**
* @param StaticCall $node
*/
public function refactor(Node $node): ?Node
{
$callerType = $this->nodeTypeResolver->resolve($node->class);
if (! $callerType->isSuperTypeOf(new ObjectType('PHPExcel_Settings'))->yes()) {
return null;
}
if (! $this->nodeNameResolver->isName($node->name, 'setChartRenderer')) {
return null;
}
if (count($node->args) === 1) {
return null;
}
$arg = new Arg($this->nodeFactory->createClassConstReference(
'PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph'
));
$node->args = [$arg];
return $node;
}
}

View File

@ -1,78 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\StaticCall;
use PhpParser\Node;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Name\FullyQualified;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#datatypedatatypeforvalue
*
* @see \Rector\Tests\PHPOffice\Rector\StaticCall\ChangeDataTypeForValueRector\ChangeDataTypeForValueRectorTest
*/
final class ChangeDataTypeForValueRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Change argument DataType::dataTypeForValue() to DefaultValueBinder',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$type = \PHPExcel_Cell_DataType::dataTypeForValue('value');
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$type = \PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::dataTypeForValue('value');
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StaticCall::class];
}
/**
* @param StaticCall $node
*/
public function refactor(Node $node): ?Node
{
$callerType = $this->nodeTypeResolver->resolve($node->class);
if (! $callerType->isSuperTypeOf(new ObjectType('PHPExcel_Cell_DataType'))->yes()) {
return null;
}
if (! $this->nodeNameResolver->isName($node->name, 'dataTypeForValue')) {
return null;
}
$node->class = new FullyQualified('PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder');
return $node;
}
}

View File

@ -1,99 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\StaticCall;
use PhpParser\Node;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Scalar\String_;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#renamed-readers-and-writers
*
* @see \Rector\Tests\PHPOffice\Rector\StaticCall\ChangeIOFactoryArgumentRector\ChangeIOFactoryArgumentRectorTest
*/
final class ChangeIOFactoryArgumentRector extends AbstractRector
{
/**
* @var array<string, string>
*/
private const OLD_TO_NEW_TYPE = [
'CSV' => 'Csv',
'Excel2003XML' => 'Xml',
'Excel2007' => 'Xlsx',
'Excel5' => 'Xls',
'Gnumeric' => 'Gnumeric',
'HTML' => 'Html',
'OOCalc' => 'Ods',
'OpenDocument' => 'Ods',
'PDF' => 'Pdf',
'SYLK' => 'Slk',
];
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Change argument of PHPExcel_IOFactory::createReader(), PHPExcel_IOFactory::createWriter() and PHPExcel_IOFactory::identify()',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$writer = \PHPExcel_IOFactory::createWriter('CSV');
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$writer = \PHPExcel_IOFactory::createWriter('Csv');
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StaticCall::class];
}
/**
* @param StaticCall $node
*/
public function refactor(Node $node): ?Node
{
if (! $this->isObjectType($node->class, new ObjectType('PHPExcel_IOFactory'))) {
return null;
}
if (! $this->isNames($node->name, ['createReader', 'createWriter', 'identify'])) {
return null;
}
$firstArgumentValue = $this->valueResolver->getValue($node->args[0]->value);
$newValue = self::OLD_TO_NEW_TYPE[$firstArgumentValue] ?? null;
if ($newValue === null) {
return null;
}
$node->args[0]->value = new String_($newValue);
return $node;
}
}

View File

@ -1,104 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\StaticCall;
use Nette\Utils\Strings;
use PhpParser\Node;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Name\FullyQualified;
use PHPStan\Type\ObjectType;
use PHPStan\Type\Type;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#writing-pdf
*
* @see \Rector\Tests\PHPOffice\Rector\StaticCall\ChangePdfWriterRector\ChangePdfWriterRectorTest
*/
final class ChangePdfWriterRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Change init of PDF writer', [
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
\PHPExcel_Settings::setPdfRendererName(PHPExcel_Settings::PDF_RENDERER_MPDF);
\PHPExcel_Settings::setPdfRenderer($somePath);
$writer = \PHPExcel_IOFactory::createWriter($spreadsheet, 'PDF');
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet);
}
}
CODE_SAMPLE
),
]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StaticCall::class];
}
/**
* @param StaticCall $node
*/
public function refactor(Node $node): ?Node
{
$callerType = $this->nodeTypeResolver->resolve($node->class);
if ($this->isSettingsPdfRendererStaticCall($callerType, $node)) {
$this->removeNode($node);
return null;
}
if ($callerType->isSuperTypeOf(new ObjectType('PHPExcel_IOFactory'))->yes() && $this->nodeNameResolver->isName(
$node->name,
'createWriter'
)) {
if (! isset($node->args[1])) {
return null;
}
$secondArgValue = $this->valueResolver->getValue($node->args[1]->value);
if (! is_string($secondArgValue)) {
return null;
}
if (Strings::match($secondArgValue, '#pdf#i')) {
return new New_(new FullyQualified('PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf'), [$node->args[0]]);
}
}
return $node;
}
private function isSettingsPdfRendererStaticCall(Type $callerType, StaticCall $staticCall): bool
{
if (! $callerType->isSuperTypeOf(new ObjectType('PHPExcel_Settings'))->yes()) {
return false;
}
return $this->nodeNameResolver->isNames($staticCall->name, ['setPdfRendererName', 'setPdfRenderer']);
}
}

View File

@ -1,86 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\Rector\StaticCall;
use PhpParser\Node;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name\FullyQualified;
use PHPStan\Type\ObjectType;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://github.com/PHPOffice/PhpSpreadsheet/blob/master/docs/topics/migration-from-PHPExcel.md#simplified-iofactory
*
* @see \Rector\Tests\PHPOffice\Rector\StaticCall\ChangeSearchLocationToRegisterReaderRector\ChangeSearchLocationToRegisterReaderRectorTest
*/
final class ChangeSearchLocationToRegisterReaderRector extends AbstractRector
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition(
'Change argument addSearchLocation() to registerReader()',
[
new CodeSample(
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
\PHPExcel_IOFactory::addSearchLocation($type, $location, $classname);
}
}
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
final class SomeClass
{
public function run(): void
{
\PhpOffice\PhpSpreadsheet\IOFactory::registerReader($type, $classname);
}
}
CODE_SAMPLE
),
]
);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StaticCall::class];
}
/**
* @param StaticCall $node
*/
public function refactor(Node $node): ?Node
{
$callerType = $this->nodeTypeResolver->resolve($node->class);
if (! $callerType->isSuperTypeOf(new ObjectType('PHPExcel_IOFactory'))->yes()) {
return null;
}
if (! $this->isName($node->name, 'addSearchLocation')) {
return null;
}
$node->class = new FullyQualified('PhpOffice\PhpSpreadsheet\IOFactory');
$node->name = new Identifier('registerReader');
// remove middle argument
$args = $node->args;
unset($args[1]);
$node->args = array_values($args);
return $node;
}
}

View File

@ -1,42 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\ValueObject;
final class ConditionalSetValue
{
public function __construct(
private string $oldMethod,
private string $newGetMethod,
private string $newSetMethod,
private int $argPosition,
private bool $hasRow
) {
}
public function getOldMethod(): string
{
return $this->oldMethod;
}
public function getArgPosition(): int
{
return $this->argPosition;
}
public function getNewGetMethod(): string
{
return $this->newGetMethod;
}
public function getNewSetMethod(): string
{
return $this->newSetMethod;
}
public function hasRow(): bool
{
return $this->hasRow;
}
}

View File

@ -1,591 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\PHPOffice\ValueObject;
use Rector\Core\ValueObject\MethodName;
final class PHPExcelMethodDefaultValues
{
/**
* @var array<string, array<string, array<int, mixed>>>
*/
public const METHOD_NAMES_BY_TYPE_WITH_VALUE = [
'PHPExcel' => [
'setHasMacros' => [false],
'setMacrosCode' => [null],
'setMacrosCertificate' => [null],
'setRibbonXMLData' => [null, null],
'setRibbonBinObjects' => [null, null],
'getRibbonBinObjects' => ['all'],
'getSheetByCodeName' => [''],
'createSheet' => [null],
'removeSheetByIndex' => [0],
'getSheet' => [0],
'getSheetByName' => [''],
'setActiveSheetIndex' => [0],
'setActiveSheetIndexByName' => [''],
'getCellXfByIndex' => [0],
'getCellXfByHashCode' => [''],
'cellXfExists' => [null],
'removeCellXfByIndex' => [0],
'getCellStyleXfByIndex' => [0],
'getCellStyleXfByHashCode' => [''],
'removeCellStyleXfByIndex' => [0],
],
'PHPExcel_CalcEngine_Logger' => [
'setWriteDebugLog' => [false],
'setEchoDebugLog' => [false],
],
'PHPExcel_Calculation' => [
'setCalculationCacheEnabled' => [true],
'setLocale' => ['en_us'],
],
'PHPExcel_Calculation_FormulaToken' => [
'setTokenType' => ['PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN'],
'setTokenSubType' => ['PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING'],
],
'PHPExcel_Cell' => [
'setValue' => [null],
'setValueExplicit' => [null, 'PHPExcel_Cell_DataType::TYPE_STRING'],
'setCalculatedValue' => [null],
'setDataType' => ['PHPExcel_Cell_DataType::TYPE_STRING'],
'isInRange' => ['A1:A1'],
'coordinateFromString' => ['A1'],
'absoluteReference' => ['A1'],
'absoluteCoordinate' => ['A1'],
'splitRange' => ['A1:A1'],
'rangeBoundaries' => ['A1:A1'],
'rangeDimension' => ['A1:A1'],
'getRangeBoundaries' => ['A1:A1'],
'columnIndexFromString' => ['A'],
'stringFromColumnIndex' => [0],
'extractAllCellReferencesInRange' => ['A1'],
'setXfIndex' => [0],
],
'PHPExcel_Cell_DataType' => [
'checkString' => [null],
'checkErrorCode' => [null],
],
'PHPExcel_Cell_DataValidation' => [
'setFormula1' => [''],
'setFormula2' => [''],
'setType' => ['PHPExcel_Cell_DataValidation::TYPE_NONE'],
'setErrorStyle' => ['PHPExcel_Cell_DataValidation::STYLE_STOP'],
'setOperator' => [''],
'setAllowBlank' => [false],
'setShowDropDown' => [false],
'setShowInputMessage' => [false],
'setShowErrorMessage' => [false],
'setErrorTitle' => [''],
'setError' => [''],
'setPromptTitle' => [''],
'setPrompt' => [''],
],
'PHPExcel_Cell_DefaultValueBinder' => [
'dataTypeForValue' => [null],
],
'PHPExcel_Cell_Hyperlink' => [
'setUrl' => [''],
'setTooltip' => [''],
],
'PHPExcel_Chart' => [
'setPlotVisibleOnly' => [true],
'setDisplayBlanksAs' => ['0'],
'setTopLeftOffset' => [null, null],
'setBottomRightOffset' => [null, null],
],
'PHPExcel_Chart_DataSeries' => [
'setPlotType' => [''],
'setPlotGrouping' => [null],
'setPlotDirection' => [null],
'setPlotStyle' => [null],
'setSmoothLine' => [true],
],
'PHPExcel_Chart_DataSeriesValues' => [
'setDataType' => ['PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER'],
'setDataSource' => [null, true],
'setPointMarker' => [null],
'setFormatCode' => [null],
'setDataValues' => [[], true],
],
'PHPExcel_Chart_Layout' => [
MethodName::CONSTRUCT => [[]],
],
'PHPExcel_Chart_Legend' => [
'setPosition' => ['PHPExcel_Chart_Legend::POSITION_RIGHT'],
'setPositionXL' => ['PHPExcel_Chart_Legend::XL_LEGEND_POSITION_RIGHT'],
'setOverlay' => [false],
],
'PHPExcel_Chart_PlotArea' => [
MethodName::CONSTRUCT => [null, []],
'setPlotSeries' => [[]],
],
'PHPExcel_Chart_Title' => [
'setCaption' => [null],
],
'PHPExcel_Comment' => [
'setAuthor' => [''],
'setWidth' => ['96pt'],
'setHeight' => ['55.5pt'],
'setMarginLeft' => ['59.25pt'],
'setMarginTop' => ['1.5pt'],
'setVisible' => [false],
'setAlignment' => ['Style\\Alignment::HORIZONTAL_GENERAL'],
],
'PHPExcel_DocumentProperties' => [
'setCreator' => [''],
'setLastModifiedBy' => [''],
'setCreated' => [null],
'setModified' => [null],
'setTitle' => [''],
'setDescription' => [''],
'setSubject' => [''],
'setKeywords' => [''],
'setCategory' => [''],
'setCompany' => [''],
'setManager' => [''],
],
'PHPExcel_DocumentSecurity' => [
'setLockRevision' => [false],
'setLockStructure' => [false],
'setLockWindows' => [false],
'setRevisionsPassword' => ['', false],
'setWorkbookPassword' => ['', false],
],
'PHPExcel_HashTable' => [
'addFromSource' => [null],
'getIndexForHashCode' => [''],
'getByIndex' => [0],
'getByHashCode' => [''],
],
'PHPExcel_IOFactory' => [
'addSearchLocation' => ['', '', ''],
'createReader' => [''],
],
'PHPExcel_NamedRange' => [
'setName' => [null],
'setRange' => [null],
'setLocalOnly' => [false],
],
'PHPExcel_Reader_Abstract' => [
'setReadDataOnly' => [false],
'setReadEmptyCells' => [true],
'setIncludeCharts' => [false],
'setLoadSheetsOnly' => [null],
],
'PHPExcel_Reader_CSV' => [
'setInputEncoding' => ['UTF-8'],
'setDelimiter' => [','],
'setEnclosure' => ['\\'],
'setSheetIndex' => [0],
'setContiguous' => [false],
],
'PHPExcel_Reader_Excel2003XML' => [
'parseRichText' => [''],
],
'PHPExcel_Reader_Excel2007' => [
'parseRichText' => [null],
'boolean' => [null],
],
'PHPExcel_Reader_Excel2007_Chart' => [
'parseRichText' => [null],
],
'PHPExcel_Reader_Excel2007_Theme' => [
'getColourByIndex' => [0],
],
'PHPExcel_Reader_Excel5' => [
'parseRichText' => [''],
],
'PHPExcel_Reader_Gnumeric' => [
'parseRichText' => [''],
],
'PHPExcel_Reader_HTML' => [
'setInputEncoding' => ['ANSI'],
'setSheetIndex' => [0],
],
'PHPExcel_Reader_OOCalc' => [
'parseRichText' => [''],
],
'PHPExcel_Reader_SYLK' => [
'setInputEncoding' => ['ANSI'],
'setSheetIndex' => [0],
],
'PHPExcel_RichText' => [
'createText' => [''],
'createTextRun' => [''],
'setRichTextElements' => [null],
],
'PHPExcel_RichText_TextElement' => [
'setText' => [''],
],
'PHPExcel_Settings' => [
'setLocale' => ['en_us'],
'setLibXmlLoaderOptions' => [null],
],
'PHPExcel_Shared_CodePage' => [
'numberToName' => ['1252'],
],
'PHPExcel_Shared_Date' => [
'excelToDateTimeObject' => [0, null],
'excelToTimestamp' => [0, null],
'PHPToExcel' => [0],
'timestampToExcel' => [0],
'isDateTimeFormatCode' => [''],
'stringToExcel' => [''],
],
'PHPExcel_Shared_Drawing' => [
'pixelsToEMU' => [0],
'EMUToPixels' => [0],
'pixelsToPoints' => [0],
'pointsToPixels' => [0],
'degreesToAngle' => [0],
'angleToDegrees' => [0],
],
'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer' => [
'setSpgr' => [false],
'setStartCoordinates' => ['A1'],
'setStartOffsetX' => [0],
'setStartOffsetY' => [0],
'setEndCoordinates' => ['A1'],
'setEndOffsetX' => [0],
'setEndOffsetY' => [0],
],
'PHPExcel_Shared_File' => [
'setUseUploadTempDirectory' => [false],
],
'PHPExcel_Shared_Font' => [
'setAutoSizeMethod' => ['PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX'],
'setTrueTypeFontPath' => [''],
'fontSizeToPixels' => ['11'],
'inchSizeToPixels' => ['1'],
'centimeterSizeToPixels' => ['1'],
],
'PHPExcel_Shared_OLE' => [
'localDateToOLE' => [null],
],
'PHPExcel_Shared_PasswordHasher' => [
'hashPassword' => [''],
],
'PHPExcel_Shared_String' => [
'controlCharacterOOXML2PHP' => [''],
'controlCharacterPHP2OOXML' => [''],
'isUTF8' => [''],
'substring' => ['', 0, 0],
'strToUpper' => [''],
'strToLower' => [''],
'strToTitle' => [''],
'strCaseReverse' => [''],
'setDecimalSeparator' => ['.'],
'setThousandsSeparator' => [','],
'setCurrencyCode' => ['$'],
'SYLKtoUTF8' => [''],
],
'PHPExcel_Style' => [
'applyFromArray' => [null, true],
'setConditionalStyles' => [null],
],
'PHPExcel_Style_Alignment' => [
'applyFromArray' => [null],
'setHorizontal' => ['PHPExcel_Style_Alignment::HORIZONTAL_GENERAL'],
'setVertical' => ['PHPExcel_Style_Alignment::VERTICAL_BOTTOM'],
'setTextRotation' => [0],
'setWrapText' => [false],
'setShrinkToFit' => [false],
'setIndent' => [0],
'setReadorder' => [0],
],
'PHPExcel_Style_Border' => [
'applyFromArray' => [null],
'setBorderStyle' => ['PHPExcel_Style_Border::BORDER_NONE'],
],
'PHPExcel_Style_Borders' => [
'applyFromArray' => [null],
'setDiagonalDirection' => ['PHPExcel_Style_Borders::DIAGONAL_NONE'],
],
'PHPExcel_Style_Color' => [
'applyFromArray' => [null],
'setARGB' => ['PHPExcel_Style_Color::COLOR_BLACK'],
'setRGB' => ['000000'],
],
'PHPExcel_Style_Conditional' => [
'setConditionType' => ['PHPExcel_Style_Conditional::CONDITION_NONE'],
'setOperatorType' => ['PHPExcel_Style_Conditional::OPERATOR_NONE'],
'setText' => [null],
'addCondition' => [''],
],
'PHPExcel_Style_Fill' => [
'applyFromArray' => [null],
'setFillType' => ['PHPExcel_Style_Fill::FILL_NONE'],
'setRotation' => [0],
],
'PHPExcel_Style_Font' => [
'applyFromArray' => [null],
'setName' => ['Calibri'],
'setSize' => ['10'],
'setBold' => [false],
'setItalic' => [false],
'setSuperScript' => [false],
'setSubScript' => [false],
'setUnderline' => ['PHPExcel_Style_Font::UNDERLINE_NONE'],
'setStrikethrough' => [false],
],
'PHPExcel_Style_NumberFormat' => [
'applyFromArray' => [null],
'setFormatCode' => ['PHPExcel_Style_NumberFormat::FORMAT_GENERAL'],
'setBuiltInFormatCode' => [0],
'toFormattedString' => ['0', 'PHPExcel_Style_NumberFormat::FORMAT_GENERAL', null],
],
'PHPExcel_Style_Protection' => [
'applyFromArray' => [null],
'setLocked' => ['PHPExcel_Style_Protection::PROTECTION_INHERIT'],
'setHidden' => ['PHPExcel_Style_Protection::PROTECTION_INHERIT'],
],
'PHPExcel_Worksheet' => [
'getChartByIndex' => [null],
'getChartByName' => [''],
'setTitle' => ['Worksheet', true],
'setSheetState' => ['PHPExcel_Worksheet::SHEETSTATE_VISIBLE'],
'setCellValue' => ['A1', null, false],
'setCellValueByColumnAndRow' => [0, '1', null, false],
'setCellValueExplicit' => ['A1', null, 'PHPExcel_Cell_DataType::TYPE_STRING', false],
'setCellValueExplicitByColumnAndRow' => [0, '1', null, 'PHPExcel_Cell_DataType::TYPE_STRING', false],
'getCell' => ['A1', true],
'getCellByColumnAndRow' => [0, '1', true],
'cellExists' => ['A1'],
'cellExistsByColumnAndRow' => [0, '1'],
'getRowDimension' => ['1', true],
'getColumnDimension' => ['A', true],
'getColumnDimensionByColumn' => [0],
'getStyle' => ['A1'],
'getConditionalStyles' => ['A1'],
'conditionalStylesExists' => ['A1'],
'removeConditionalStyles' => ['A1'],
'getStyleByColumnAndRow' => [0, '1', null, null],
'setBreak' => ['A1', 'PHPExcel_Worksheet::BREAK_NONE'],
'setBreakByColumnAndRow' => [0, '1', 'PHPExcel_Worksheet::BREAK_NONE'],
'mergeCells' => ['A1:A1'],
'mergeCellsByColumnAndRow' => [0, '1', 0, '1'],
'unmergeCells' => ['A1:A1'],
'unmergeCellsByColumnAndRow' => [0, '1', 0, '1'],
'setMergeCells' => [[]],
'protectCells' => ['A1', '', false],
'protectCellsByColumnAndRow' => [0, '1', 0, '1', '', false],
'unprotectCells' => ['A1'],
'unprotectCellsByColumnAndRow' => [0, '1', 0, '1', '', false],
'setAutoFilterByColumnAndRow' => [0, '1', 0, '1'],
'freezePane' => [''],
'freezePaneByColumnAndRow' => [0, '1'],
'insertNewRowBefore' => ['1', '1'],
'insertNewColumnBefore' => ['A', '1'],
'insertNewColumnBeforeByIndex' => [0, '1'],
'removeRow' => ['1', '1'],
'removeColumn' => ['A', '1'],
'removeColumnByIndex' => [0, '1'],
'setShowGridlines' => [false],
'setPrintGridlines' => [false],
'setShowRowColHeaders' => [false],
'setShowSummaryBelow' => [true],
'setShowSummaryRight' => [true],
'setComments' => [[]],
'getComment' => ['A1'],
'getCommentByColumnAndRow' => [0, '1'],
'setSelectedCell' => ['A1'],
'setSelectedCells' => ['A1'],
'setSelectedCellByColumnAndRow' => [0, '1'],
'setRightToLeft' => [false],
'fromArray' => [null, null, 'A1', false],
'rangeToArray' => ['A1', null, true, true, false],
'namedRangeToArray' => ['', null, true, true, false],
'getHyperlink' => ['A1'],
'setHyperlink' => ['A1', null],
'hyperlinkExists' => ['A1'],
'getDataValidation' => ['A1'],
'setDataValidation' => ['A1', null],
'dataValidationExists' => ['A1'],
'setCodeName' => [null],
],
'PHPExcel_Worksheet_AutoFilter' => [
'setRange' => [''],
'getColumnByOffset' => [0],
'shiftColumn' => [null, null],
],
'PHPExcel_Worksheet_AutoFilter_Column' => [
'setFilterType' => ['PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER'],
'setJoin' => ['PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR'],
'setAttributes' => [[]],
'addRule' => [
1 => true,
],
],
'PHPExcel_Worksheet_AutoFilter_Column_Rule' => [
'setRuleType' => ['PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER'],
'setValue' => [''],
'setOperator' => ['PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL'],
'setGrouping' => [null],
'setRule' => ['PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL', '', null],
],
'PHPExcel_Worksheet_BaseDrawing' => [
'setName' => [''],
'setDescription' => [''],
'setCoordinates' => ['A1'],
'setOffsetX' => [0],
'setOffsetY' => [0],
'setWidth' => [0],
'setHeight' => [0],
'setWidthAndHeight' => [0, 0],
'setResizeProportional' => [true],
'setRotation' => [0],
],
'PHPExcel_Worksheet_CellIterator' => [
'setIterateOnlyExistingCells' => [true],
],
'PHPExcel_Worksheet_ColumnDimension' => [
'setWidth' => ['-1'],
'setAutoSize' => [false],
],
'PHPExcel_Worksheet_Drawing' => [
'setPath' => ['', true],
],
'PHPExcel_Worksheet_Drawing_Shadow' => [
'setVisible' => [false],
'setBlurRadius' => ['6'],
'setDistance' => ['2'],
'setDirection' => [0],
'setAlignment' => [0],
'setAlpha' => [0],
],
'PHPExcel_Worksheet_HeaderFooter' => [
'setDifferentOddEven' => [false],
'setDifferentFirst' => [false],
'setScaleWithDocument' => [true],
'setAlignWithMargins' => [true],
],
'PHPExcel_Worksheet_HeaderFooterDrawing' => [
'setName' => [''],
'setOffsetX' => [0],
'setOffsetY' => [0],
'setWidth' => [0],
'setHeight' => [0],
'setWidthAndHeight' => [0, 0],
'setResizeProportional' => [true],
'setPath' => ['', true],
],
'PHPExcel_Worksheet_MemoryDrawing' => [
'setImageResource' => [null],
'setRenderingFunction' => ['PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT'],
'setMimeType' => ['PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT'],
],
'PHPExcel_Worksheet_PageSetup' => [
'setPaperSize' => ['PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER'],
'setOrientation' => ['PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT'],
'setScale' => ['100', true],
'setFitToPage' => [true],
'setFitToHeight' => ['1', true],
'setFitToWidth' => ['1', true],
'setColumnsToRepeatAtLeft' => [null],
'setColumnsToRepeatAtLeftByStartAndEnd' => ['A', 'A'],
'setRowsToRepeatAtTop' => [null],
'setRowsToRepeatAtTopByStartAndEnd' => ['1', '1'],
'setHorizontalCentered' => [false],
'setVerticalCentered' => [false],
'setFirstPageNumber' => [null],
],
'PHPExcel_Worksheet_Protection' => [
'setSheet' => [false],
'setObjects' => [false],
'setScenarios' => [false],
'setFormatCells' => [false],
'setFormatColumns' => [false],
'setFormatRows' => [false],
'setInsertColumns' => [false],
'setInsertRows' => [false],
'setInsertHyperlinks' => [false],
'setDeleteColumns' => [false],
'setDeleteRows' => [false],
'setSelectLockedCells' => [false],
'setSort' => [false],
'setAutoFilter' => [false],
'setPivotTables' => [false],
'setSelectUnlockedCells' => [false],
'setPassword' => ['', false],
],
'PHPExcel_Worksheet_RowDimension' => [
'setRowHeight' => ['-1'],
'setZeroHeight' => [false],
],
'PHPExcel_Worksheet_SheetView' => [
'setZoomScale' => ['100'],
'setZoomScaleNormal' => ['100'],
'setView' => [null],
],
'PHPExcel_Writer_Abstract' => [
'setIncludeCharts' => [false],
'setPreCalculateFormulas' => [true],
'setUseDiskCaching' => [false, null],
],
'PHPExcel_Writer_CSV' => [
'save' => [null],
'setDelimiter' => [','],
'setEnclosure' => ['\\'],
'setLineEnding' => [PHP_EOL],
'setUseBOM' => [false],
'setIncludeSeparatorLine' => [false],
'setExcelCompatibility' => [false],
'setSheetIndex' => [0],
'writeLine' => [null, null],
],
'PHPExcel_Writer_Excel2007' => [
'getWriterPart' => [''],
'save' => [null],
'setOffice2003Compatibility' => [false],
],
'PHPExcel_Writer_Excel2007_ContentTypes' => [
'getImageMimeType' => [''],
],
'PHPExcel_Writer_Excel2007_StringTable' => [
'writeStringTable' => [null],
'flipStringTable' => [[]],
],
'PHPExcel_Writer_Excel5' => [
'save' => [null],
],
'PHPExcel_Writer_Excel5_Workbook' => [
'writeWorkbook' => [null],
],
'PHPExcel_Writer_Excel5_Worksheet' => [
'writeBIFF8CellRangeAddressFixed' => ['A1'],
],
'PHPExcel_Writer_HTML' => [
'save' => [null],
'setSheetIndex' => [0],
'setGenerateSheetNavigationBlock' => [true],
'setImagesRoot' => ['.'],
'setEmbedImages' => [true],
'setUseInlineCss' => [false],
],
'PHPExcel_Writer_OpenDocument' => [
'getWriterPart' => [''],
'save' => [null],
],
'PHPExcel_Writer_PDF' => [
'save' => [null],
],
'PHPExcel_Writer_PDF_Core' => [
'setPaperSize' => ['PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER'],
'setOrientation' => ['PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT'],
'setTempDir' => [''],
'prepareForSave' => [null],
],
'PHPExcel_Writer_PDF_DomPDF' => [
'save' => [null],
],
'PHPExcel_Writer_PDF_mPDF' => [
'save' => [null],
],
'PHPExcel_Writer_PDF_tcPDF' => [
'save' => [null],
],
];
}