<commit_before><?php
/*
 * @copyright 2022 Passwords App
 *
 * @author <NAME>
 * @license AGPL-3.0
 *
 * This file is part of the Passwords App
 * created by <NAME>.
 */

namespace Utils\Rector\Rector;

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

class FixReturnTypeExtension extends AbstractRector {
    /**
     * @return array<class-string<Node>>
     */
    public function getNodeTypes(): array {
        return [ClassMethod::class];
    }

    /**
     * @param ClassMethod $node
     */
    public function refactor(Node $node): ?Node {
        if(!$this->isName($node->name, 'insert') && !$this->isName($node->name, 'update')) {
            return null;
        }

        if($node->returnType === null || $node->returnType->toString() === 'OCA\Passwords\Db\AbstractRevision') {
            $node->returnType = new \PhpParser\Node\Name\FullyQualified('OCP\AppFramework\Db\Entity');<commit_msg>Update rector setup<commit_after><?php
/*
 * @copyright 2022 Passwords App
 *
 * @author <NAME>
 * @license AGPL-3.0
 *
 * This file is part of the Passwords App
 * created by <NAME>.
 */

namespace Utils\Rector\Rector;

use PhpParser\Node;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

class FixReturnTypeExtension extends AbstractRector {
    /**
     * @return array<class-string<Node>>
     */
    public function getNodeTypes(): array {
        return [ClassMethod::class];
    }

    /**
     * @param ClassMethod $node
     */
    public function refactor(Node $node): ?Node {
        if(!$this->isName($node->name, 'insert') && !$this->isName($node->name, 'update')) {
            return null;
        }

        if($node->returnType === null || $node->returnType->toString() === 'OCA\Passwords\Db\AbstractRevision') {
            $node->returnType = new FullyQualified('OCP\AppFramework\Db\Entity');
{'fraction_non_alphanumeric': 0.14434389140271492, 'fraction_numerical': 0.005429864253393665, 'mean_word_length': 3.4576612903225805, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3378184', 'n_tokens_mistral': 698, 'n_tokens_neox': 685, 'n_words': 135}