nextcloud/rector 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nextcloud/rector

Composer 安装命令:

composer require nextcloud/rector

包简介

Rector upgrade rules for Nextcloud

README 文档

README

Rector upgrade rules for Nextcloud

About

This is a package containing rector rules and sets to use to upgrade your Nextcloud application to the latest API changes.

This project adheres to a code of conduct. By participating in this project and its community, you are expected to uphold this code.

Installation

Install this package as a dependency using Composer. We recommend to do so in a vendor bin directory along with rector.

composer require --dev bamarni/composer-bin-plugin
composer bin rector require rector/rector --dev
composer bin rector require nextcloud/rector --dev

Usage

First generate a rector.php configuration by running process command a first time:

./vendor/bin/rector process

We recommend that you first run rector with an empty configuration, commit the result, and then add the sets from Nextcloud and PHP one by one and commit the rule along with its result each time. You should stop at the oldest version your application is supporting of both Nextcloud and PHP. Do not apply a newer set or you might lose compatibility. Each Nextcloud set includes the older ones so you only need one of them in your configuration. You could end up with a configuration like this one:

<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-only
 */

use Nextcloud\Rector\Set\NextcloudSets;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
	->withPaths([
		__DIR__ . '/appinfo',
		__DIR__ . '/lib',
		__DIR__ . '/tests',
	])
	->withPhpSets(php81: true)
	->withTypeCoverageLevel(0)
	->withSets([
		NextcloudSets::NEXTCLOUD_30,
	]);

nextcloud/ocp dependency

Some rules e.g. ->withPhpSets(php82: true) require a reference to the OCP package. If you are receiving an error like the following, you are facing one of them:

System error: "Class "OCP\AppFramework\Db\Entity" not found

The nextcloud/rector package comes with a version of nextcloud/ocp, that can be good enough, but it can also be outdated later. So if you have an up-to-date dependency to nextcloud/ocp anyway, it totally makes sense to link that root instead. Simply add the following autoload-information into the vendor-bin/rector/composer.json file, to use the internal package, or use paths like ../../vendor/nextcloud/ocp to reference the OCP package from your root composer or ../vendor-bin/nextcloud-ocp/vendor/nextcloud/ocp if you have it in another composer-bin:

    "autoload": {
        "psr-4": {
            "OCP\\": "vendor/nextcloud/ocp/OCP/",
            "NCU\\": "vendor/nextcloud/ocp/NCU/"
        }
    }

Make sure that you also have nextcloud/coding-standard setup and to run the code style fixer after rector to fix styling.

Contributing

Contributions are welcome! To contribute, please familiarize yourself with CONTRIBUTING.md.

Copyright and License

nextcloud/rector is copyright © Christoph Wurst and licensed for use under the terms of the GNU Affero General Public License (AGPL-3.0-or-later) as published by the Free Software Foundation. Please see COPYING and NOTICE for more information.

nextcloud/rector 适用场景与选型建议

nextcloud/rector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 534.24k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 09 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「refactoring」 「nextcloud」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nextcloud/rector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nextcloud/rector 我们能提供哪些服务?
定制开发 / 二次开发

基于 nextcloud/rector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 534.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 5
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2024-09-18