Giter Site home page Giter Site logo

rector-phpoffice's People

Contributors

sabbelasichon avatar samsonasik avatar tomasvotruba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rector-phpoffice's Issues

install issue: [ERROR] Class "Rector\Doctrine\Set\PHPOfficeSetList" not found

Hi,
I'm new to rector. I'm trying to use it to convert some php-excel programs to phpspreadsheet.
The basic installation instructions don't work.
Here is what I did:
-created a new folder and install using the command : composer require rector/rector --dev (see image 1)
-created a rector.php file with the content copied from the install page (see image 2)
-created a src folder and put an excel report to be processed
-ran the command : vendor\bin\rector process src (see image 3)
I get this error : [ERROR] Class "Rector\Doctrine\Set\PHPOfficeSetList" not found

What did I missed ? This is on windows 10 with wamp server. See attached screen captures.
Thank you
rector1
rector2
rector3
.

Rule ChangeConditionalReturnedCellRector not applied

Hello,

I am currently migrating my old phpexcel code the phpoffice/phpspreadsheet (better late than never ;-).

However, I encountered the following problem: rule ChangeConditionalReturnedCellRector is not applied where it should be.

Rector config file :

------------------ start rector.php -------------------------

<?php
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->rule(ChangeConditionalReturnedCellRector::class);
};

------------------ end rector.php ---------------------------

Sample code :

------------------ start rector.testfile.php ------------------

<?php

$workbook = new PHPExcel();
$sheet = $workbook->getActiveSheet();
$sheet->setCellValue('A1', 'Hello rector!');

unset($workbook);

------------------ end rector.testfile.php --------------------

Command-line execution :

------------------ start command-line -------------------------

rector process rector.testfile.php --dry-run --debug
rector.testfile.php
[file] rector.testfile.php
[rule] Rector\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector

[file] rector.testfile.php
[rule] Rector\PHPOffice\Rector\MethodCall\ChangeConditionalReturnedCellRector


                                                                                                                        
 [OK] Rector is done!  

------------------ end command-line ----------------------------

I was expected line:
$sheet->setCellValue('A1', 'Hello rector!');
to be changed to:
$sheet->getCell('A1')->setValue('Hello rector!');

But nothing happened.

I investigated a little bit and found that the rule was not applied because rector did not find any node of type 'PHPExcel_Worksheet'.

Questions :

Am I doing something wrong (I have no prior experience with rector)?
Am I missing something important in my rector config file?

Any help would be greatly appreciated, thanks.

Rector is too greedy and broke my application

Bug Report

Subject Details
Rector version e.g. v0.11.5 (invoke vendor/bin/rector --version)

I run PHPOfficeSetList::PHPEXCEL_TO_PHPSPREADSHEET set against my code. However Rector is changing completely unrelated files. It removed an argument from a method call inside a class that has nothing to do with phpexcel.
I can say that this class had a problem with typehint missmatch, i.e. property's @var had another type in comparison with related constructor parameter type. This was probably a source of invalid removal. However Rector should never touch this class. It should focus only on PHPExcel symbols and only on methods from PHPExcel and not refactor anything else.

Minimal PHP Code Causing Issue

Expected Behaviour

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.