Rector upgrades rules for Nette

Overview

Rector Rules for Nette

See available Nette rules

Install

composer require rector/rector-nette

Use Sets

To add a set to your config, use Rector\Nette\Set\NetteSetList class and pick one of constants:

use Rector\Nette\Set\NetteSetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $containerConfigurator->import(NetteSetList::NETTE_24);
};
Comments
  • Create form data class rector

    Create form data class rector

    This is POC for creating / updating data classes for Forms in Nette applications https://doc.nette.org/en/3.1/form-presenter#toc-mapping-to-classes

    I would be happy if you find time to check if I am on right way how to do it or I am completely missing the point. I don't really like the way how I'm finding $form in class and then its fields, but I didn't find any other way yet.

    Next steps should be to find $form->onSuccess callback and change the type of second parameter ($values) to newly class created.

    I would be also grateful if you give me some hint how should I test this type of rector (where new class is created and old class is also changed)

    opened by lulco 11
  • [Nette] Update to nette/neon 3.3.3 compatibility

    [Nette] Update to nette/neon 3.3.3 compatibility

    Fix to avoid error:

    1) Rector\Nette\Tests\Rector\Neon\RenameMethodNeonRector\RenameMethodNeonRectorTest::test with data set #0 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
    Error: Call to undefined method Nette\Neon\Node\BlockArrayNode::getSubNodes()
    
    • [x] Update to nette/neon ^3.3.3
    • [x] Replace $node->getSubNodes() to directly use $node on loop.
    opened by samsonasik 3
  • [Test] Revert ContextGetByTypeToConstructorInjectionRector test for use existing property with same Object Type

    [Test] Revert ContextGetByTypeToConstructorInjectionRector test for use existing property with same Object Type

    Revert https://github.com/rectorphp/rector-nette/pull/57 due to use only increment when different object update on https://github.com/rectorphp/rector-symfony/pull/120

    opened by samsonasik 3
  • [FileProcessor] Fix return array on FileProcessors

    [FileProcessor] Fix return array on FileProcessors

    @TomasVotruba this is based on error https://github.com/rectorphp/rector-src/runs/4649685575?check_suite_focus=true#step:14:81 , I tried to apply the changes of return of FIle processor return on LatteFileProcessor and NeonFileProcessor

    opened by samsonasik 3
  • [Nette][NodeAnalyzer] Use PropertyFetchAnalyzer->isLocalPropertyFetchName() on PropertyUsageAnalyzer

    [Nette][NodeAnalyzer] Use PropertyFetchAnalyzer->isLocalPropertyFetchName() on PropertyUsageAnalyzer

    There is already PropertyFetchAnalyzer->isLocalPropertyFetchName() that verify local property fetch, check against both this and self usage, so moving to PropertyFetchAnalyzer->isLocalPropertyFetchName() instead of $this->nodeNameResolver->isLocalPropertyFetchNamed()

    opened by samsonasik 2
  • [Nette] Using NodeTypeResolver->getType() instead of deprecated getObjectType()

    [Nette] Using NodeTypeResolver->getType() instead of deprecated getObjectType()

    The getObjectType() is deprecated at rector-src's AbstractRector

    https://github.com/rectorphp/rector-src/blob/c6473c6a0b4ecaab710353e83f0c740e2e998d26/src/Rector/AbstractRector.php#L335-L338

    This PR update to use NodeTypeResolver->getType()

    opened by samsonasik 2
  • Fixing test neon renamemethod

    Fixing test neon renamemethod

    @TomasVotruba it seems on latest CI run, the test indentation seems removed after services new line. This remove the indentation so the CI will be green.

    opened by samsonasik 2
  • [NodeAnalyzer] Fix error BetterNodeFinder->findParentTypes() not found

    [NodeAnalyzer] Fix error BetterNodeFinder->findParentTypes() not found

    Fix BetterNodeFinder->findParentTypes() not found, need to loop as ScopeNestingComparator->isInBothIfElseBranch pass a single Node in first parameter.

    opened by samsonasik 2
  • Unit tests broken on HEAD due to file processor contract change

    Unit tests broken on HEAD due to file processor contract change

    HEAD is failing, and so are any tests in packages relying on the AbstractRectorTestCase class from Rector

    https://github.com/rectorphp/rector-nette/commit/0227bb6f43bde75467ee2c14219713784db47afa

            $file = new File($fileInfo, $fileInfo->getContents());
            $this->applicationFileProcessor->run([$file], $configuration);
    
    opened by mglaman 2
  • [PostRector] Using NodesToAddCollector on rector rules

    [PostRector] Using NodesToAddCollector on rector rules

    Based on https://github.com/rectorphp/rector-src/pull/812 as this direct call is deprecated. I tried to follow return array of nodes of https://tomasvotruba.com/blog/how-to-replace-single-node-with-two-nodes-in-abstract-syntax-tree/ and seems failure on assign and method call:

                return [
                    new Expression($assign),
                    new Expression($node)
                ];
    

    It got error:

    Rector\Nette\Tests\Rector\MethodCall\AddNextrasDatePickerToDateControlRector\AddNextrasDatePickerToDateControlRectorTest::test with data set #3 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
    LogicException: leaveNode() may only return an array if the parent structure is an array
    

    so use NodesToAddCollector property for now.

    opened by samsonasik 1
Rector upgrades rules for Symfony Framework

Rector Rules for Symfony See available Symfony rules Install This package is already part of rector/rector package, so it works out of the box. All yo

Rector 107 Dec 31, 2022
Rector upgrades rules for Laravel

Rector Rules for Laravel See available Laravel rules Install This package is already part of rector/rector package, so it works out of the box. All yo

Rector 185 Dec 30, 2022
Rector rules for Nette to Symfony migration

Rector Nette to Symfony Do you need to migrate from Nette to Symfony? You can ↓ How we Migrated 54 357-lines Application from Nette to Symfony in 2 Pe

Rector 8 May 30, 2022
PHPStan Rules for Rector developers

Rector PHPStan Rules PHPStan rules for Rector and projects that maintain Rector rulesets. Install composer require rector/phpstan-rules --dev Do you u

RectorPHP 12 Dec 22, 2022
Instant Upgrades and Instant Refactoring of any PHP 5.3+ code

Rector - Speedup Your PHP Development Rector helps you with 2 areas - major code changes and in daily work. Do you have a legacy code base? Do you wan

RectorPHP 6.5k Jan 8, 2023
phpcs-security-audit is a set of PHP_CodeSniffer rules that finds vulnerabilities and weaknesses related to security in PHP code

phpcs-security-audit v3 About phpcs-security-audit is a set of PHP_CodeSniffer rules that finds vulnerabilities and weaknesses related to security in

Floe design + technologies 655 Jan 3, 2023
Rector upgrades rules for CakePHP

Rector Rules for CakePHP See available CakePHP rules Install composer require rector/rector-cakephp Use Sets To add a set to your config, use Rector\C

RectorPHP 19 Oct 27, 2022
Rector upgrades rules for PHPUnit

Rector Rules for PHPUnit See available PHPUnit rules Install composer require rector/rector-phpunit Use Sets To add a set to your config, use Rector\P

RectorPHP 34 Dec 27, 2022
Rector upgrades rules for Doctrine

Rector Rules for Doctrine See available Doctrine rules Install This package is already part of rector/rector package, so it works out of the box.

Rector 37 Nov 7, 2022
Rector upgrades rules for Symfony Framework

Rector Rules for Symfony See available Symfony rules Install This package is already part of rector/rector package, so it works out of the box. All yo

Rector 107 Dec 31, 2022
Rector upgrades rules for Laravel

Rector Rules for Laravel See available Laravel rules Install This package is already part of rector/rector package, so it works out of the box. All yo

Rector 185 Dec 30, 2022
Rector rules for Nette to Symfony migration

Rector Nette to Symfony Do you need to migrate from Nette to Symfony? You can ↓ How we Migrated 54 357-lines Application from Nette to Symfony in 2 Pe

Rector 8 May 30, 2022
Rector - Instant Upgrades and Automated Refactoring

Rector - Instant Upgrades and Automated Refactoring This repository (rectorphp/rector-src) is for development Rector only. Head to rectorphp/rector fo

Rector 64 Dec 27, 2022
🔴 First class integration of Sentry to Nette Framework (@nette)

Website ?? contributte.org | Contact ????‍?? f3l1x.io | Twitter ?? @contributte Usage To install latest version of contributte/sentry use Composer. co

Contributte 3 Dec 15, 2022
Best logging support into Nette Framework (@nette)

Website ?? contributte.org | Contact ????‍?? f3l1x.io | Twitter ?? @contributte Usage To install the latest version of contributte/monolog use Compose

Contributte 21 Dec 1, 2022
PHPStan Rules for Rector developers

Rector PHPStan Rules PHPStan rules for Rector and projects that maintain Rector rulesets. Install composer require rector/phpstan-rules --dev Do you u

RectorPHP 12 Dec 22, 2022
Rector Rules for BEAR.Sunday

Rector Rules for BEAR.Sunday The rector/rector rules for BEAR.Sunday.

BEAR.Sunday 2 Mar 30, 2022
Manage redirects using database rules. Rules are intended to be very similar to Laravel default routes, so syntax is pretty easy to comprehend.

Laravel DB redirector Manage HTTP redirections in Laravel using database Manage redirects using database rules. Rules are intended to be very similar

Vladimir Ković 12 Jul 18, 2022
Phpcs-magento-rules - A set of PHPCS rules used by made.com when hacking Magento

Made.com PHPCS Magento Rules A set of PHPCS rules used by made.com when hacking Magento. Pre-Requisites PHPCS Installation Short Version Clone this re

Made.com Tech Team 26 Jun 3, 2020
Instant Upgrades and Instant Refactoring of any PHP 5.3+ code

Rector - Speedup Your PHP Development Rector helps you with 2 areas - major code changes and in daily work. Do you have a legacy code base? Do you wan

RectorPHP 6.5k Jan 8, 2023