Giter Club home page Giter Club logo

rector's People

Contributors

aerendir avatar bendavies avatar carusogabriel avatar derrickschoen avatar dobryy avatar github-actions[bot] avatar gnutix avatar greg0ire avatar janmikes avatar jeroensmit avatar keulinho avatar kodiakhq[bot] avatar lctrs avatar leoloso avatar lulco avatar markstory avatar mssimi avatar ondrejmirtes avatar ruudk avatar sabbelasichon avatar samsonasik avatar sashabeton avatar scheb avatar shyim avatar simivar avatar snapshotpl avatar staabm avatar stedekay avatar tomasvotruba avatar uftimmy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rector's Issues

[Dynamic] Property to MethodCall

Should cover

  • getter
  • setter

E.g Symfony 3.0

Before

 class CustomTranslator extends Translator
 {
     public function fooMethod()
     {
        // get locale
        $locale = $this->locale;

        // update locale
        $this->locale = $locale;
     }
 }

After

 class CustomTranslator extends Translator
 {
     public function fooMethod()
     {
        // get locale
        $locale = $this->getLocale();

        // update locale
        $this->setLocale($locale);
    }
 }

Rector fails to run

I run rector as standalone project. If I run it on my project like this:

php w:\git\rector\bin\rector process src --level symfony40

I get following error

...
 - src\Admin\Media\Image\EntityType.php

...and 356 more.

PHP Notice:  Undefined property: PhpParser\Node\Stmt\Trait_::$extends in W:\git\rector\src\NodeAnalyzer\ClassAnalyzer.php on line 48

Notice: Undefined property: PhpParser\Node\Stmt\Trait_::$extends in W:\git\rector\src\NodeAnalyzer\ClassAnalyzer.php on line 48
PHP Notice:  Undefined property: PhpParser\Node\Stmt\Trait_::$implements in W:\git\rector\src\NodeAnalyzer\ClassAnalyzer.php on line 58

Notice: Undefined property: PhpParser\Node\Stmt\Trait_::$implements in W:\git\rector\src\NodeAnalyzer\ClassAnalyzer.php on line 58
PHP Notice:  Undefined property: PhpParser\Node\Stmt\Interface_::$implements in W:\git\rector\src\NodeAnalyzer\ClassAnalyzer.php on line 58

Notice: Undefined property: PhpParser\Node\Stmt\Interface_::$implements in W:\git\rector\src\NodeAnalyzer\ClassAnalyzer.php on line 58

[Rector\BetterReflection\Reflector\Exception\IdentifierNotFound]
  Rector\BetterReflection\Reflection\ReflectionClass "XY\AppBundle\Sentry\SentryObject" could not be found in the located source

[Symfony] 3.2 to 3.3

For @shopsys ❤️

Ref: https://github.com/symfony/symfony/blob/master/UPGRADE-3.3.md

  • FrameworkBundle classes https://github.com/symfony/symfony/blob/master/UPGRADE-3.3.md#frameworkbundle

  • The console.exception event and the related ConsoleExceptionEvent class have been deprecated in favor of the console.error event and the ConsoleErrorEvent class. The deprecated event and class will be removed in 4.0.

  • The ContextErrorException class is deprecated. \ErrorException will be used instead in 4.0.

Run tool

Hi,

I have trouble with run Rector. After creating rector as project (via #46) then I run

rector/bin/rector process /path/to/my-files

Iteration from files was correct (I dumped file names) but it did nothing. Where is the problem, maybe it is in rewrited command?

packagist

Hi,

is it on packagist already?
It looks really great, I want test it :)

 [InvalidArgumentException]                                                                                                                     
  Could not find package rector/rector at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability  

Crazy dependencies in Nette 0.9

I get project with full of problems in codebase. For example how are created dependencies:

  protected function createComponent($name)
  {
    switch ($name)
    {
      // models
      case 'catalog': $this->addComponent(Environment::getService('CatalogModel'), $name); return;
      case 'library': $this->addComponent(Environment::getService('LibraryModel'), $name); return;
      case 'page': $this->addComponent(Environment::getService('PageModel'), $name); return;
      case 'seo': $this->addComponent(Environment::getService('SeoModel'), $name); return;
      case 'shop': $this->addComponent(Environment::getService('ShopModel'), $name); return;
      case 'user': $this->addComponent(Environment::getService('UserModel'), $name); return;

      default:
        return parent::createComponent($name);
    }
  }

and using of dependency:

$this['shop']->getShopSubcategories(..);

Any idea how automaticaly repair this? :-))

Add multiple types support

E.g.

class MyControl extends Control
{
}
$types = $controlNode->getAttribute(Attribute::TYPES);
dump($types); // ['MyControl', 'Control']

PHPUnit rectors

- $this->assertTrue(is_readable($readmeFile), sprintf('Cannot read "%s".', $readmeFile));
+ $this->assertIsReadable($readmeFile, sprintf('Cannot read "%s".', $readmeFile));

   $this->setExpectedExceptionRegExp(
-            \PhpCsFixer\ConfigurationException\InvalidConfigurationException::class,
+        $this->expectException(InvalidConfigurationException::class);
+        $this->expectExceptionMessageRegExp(
             '#^The config file: ".+[\/\\\]Fixtures[\/\\\]ConfigurationResolverConfigFile[\/\\\]case_5[\/\\\]\.php_cs\.dist" does not return a "PhpCsFixer\\\ConfigInterface" instance\. Got: "string"\.$#'
         );

See PHP-CS-Fixer/PHP-CS-Fixer#3182

mimic Retors from umpirsky/Symfony-Upgrade-Fixer

See https://github.com/umpirsky/Symfony-Upgrade-Fixer#fixers-available

  • symfony30.yml
Done Name Description
👍 form_configure_options The method AbstractType::setDefaultOptions(OptionsResolverInterface $resolver) have been renamed to AbstractType::configureOptions(OptionsResolver $resolver).
👍 form_events The events PRE_BIND, BIND and POST_BIND were renamed to PRE_SUBMIT, SUBMIT and POST_SUBMIT.
👍 form_getname_to_getblockprefix The method FormTypeInterface::getName() was deprecated, you should now implement FormTypeInterface::getBlockPrefix() instead.
👍 form_option_names Options precision and virtual was renamed to scale and inherit_data.
👍 form_parent_type Returning type instances from FormTypeInterface::getParent() is deprecated, return the fully-qualified class name of the parent type class instead.
👍 form_type_names Instead of referencing types by name, you should reference them by their fully-qualified class name (FQCN) instead.
👍 get_request The getRequest method of the base controller class was removed, request object is injected in the action method instead.
👍 inherit_data_aware_iterator The class VirtualFormAwareIterator was renamed to InheritDataAwareIterator.
👍 progress_bar ProgressHelper has been removed in favor of ProgressBar.
👍 property_access Renamed PropertyAccess::getPropertyAccessor to PropertyAccess::createPropertyAccessor.

[Nette] 2.3 to 2.4

All migration guides in Docs:

Done

  • "In PhpGenerator methods setDocuments(), getDocuments() and addDocument() was replaced by setComment(), getComment() and addComment()" - Closed by #12

  • "Negative validation rules. An alternative for the ~Form::FILLED is Form::BLANK, or ~Form::EQUAL can be replaced with Form::NOT_EQUAL"

  • "Nette\Utils\Html::add() is replaced with addHtml() and addText()" - Closed by #8

Sources

Ideas to use abstract class replacer in config way

Faster to bootstrap:

# symfony33.yml
rectors:
    ClassReplacer:
        OldClass: NewClass

It would also make change more transparent and easy to scale - adding new class is now easy.

It's not worth writing custom class and tests, since it only uses AbstractClassReplacerRector over and over again.

What do you think @grogy?

Todo

  • document in docs: How to write RectorsClass or method replacement in config

[Dynamic] Add Argument Replacer

use Symfony\Component\DependencyInjection\ContainerBuilder;

$container = new ContainerBuilder();
$container
    ->register('foo', 'stdClass')
    ->setScope(ContainerBuilder::SCOPE_PROTOTYPE)
;

last call into

  ->setShared(false)

Project specific rectors should be in their own repos

This looks amazing! Really looking forward to testing it. One thing I noticed straight from the README, though. Shouldn't the nette, symfony, etc rectors be in their own repositories? I think it will be a pain, further down the road, to strip them from the main repo and notify everyone to update the dependencies, etc.

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.