friendsoftypo3/phpstan-typo3 问题修复 & 功能扩展

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

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

friendsoftypo3/phpstan-typo3

Composer 安装命令:

composer require friendsoftypo3/phpstan-typo3

包简介

TYPO3 rules for PHPStan

README 文档

README

Note

friendsoftypo3/phpstan-typo3 is obsolete and has been retired. The package dependency should be removed from TYPO3 project or extension development: composer rem --dev friendsoftypo3/phpstan-typo3. See below for transition options.

Migrating away from friendsoftypo3/phpstan-typo3 since TYPO3 core v12

Remove package and rely on core annotations

  • The list of global TYPO3 specific constants shrunk over time and phpstan finds more of the remaining ones by default. phpstan may mumble about constants LF and CR not being defined. They can be made known to phpstan like this in a phpstan.neon config file:
      parameters:
        bootstrapFiles:
        - phpstan.bootstrap.php
    
    File phpstan.bootstrap.php then contains:
      <?php
      define('LF', chr(10));
      define('CR', chr(13));
    
  • GeneralUtility::makeInstance(), Context->getAspect(), Query->execute() and QueryInterface->execute() have proper method annotations since TYPO3 v12, the phpstan extension classes are not needed anymore and phpstan "understands" return values of these methods out of the box.
  • ObjectManagerInterface->get() and ObjectManager->get() extensions have been removed from TYPO3 since v12 and are thus obsolete.

TYPO3 CMS class reflection extension for PHPStan & framework-specific rules

This extension provides the following features:

  • Provides correct return type for \TYPO3\CMS\Core\Context\Context->getAspect().
  • Provides correct return type for \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance().
  • Provides correct return type for \TYPO3\CMS\Extbase\Object\ObjectManagerInterface->get().
  • Provides correct return type for \TYPO3\CMS\Extbase\Object\ObjectManager->get().
  • Provides correct return type for \TYPO3\CMS\Extbase\Persistence\Generic\Query->execute().
  • Provides correct return type for \TYPO3\CMS\Extbase\Persistence\QueryInterface->execute().
Details on GeneralUtility::makeInstance()

Dynamic return types are returned for:

  • GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class)
  • GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler')
  • GeneralUtility::makeInstance(self::class)
  • GeneralUtility::makeInstance(static::class)
Details on ObjectManagerInterface::get() and ObjectManager::get()

Dynamic return types are returned for:

  • ObjectManager->get(\TYPO3\CMS\Core\DataHandling\DataHandler::class)
  • ObjectManager->get('TYPO3\\CMS\\Core\\DataHandling\\DataHandler')
  • ObjectManager->get(self::class)
  • ObjectManager->get(static::class)

Installation & Configuration

To use this extension, require it in Composer:

composer require friendsoftypo3/phpstan-typo3 --dev

Once installed, put this into your phpstan.neon config:

includes:
    - vendor/friendsoftypo3/phpstan-typo3/extension.neon

FAQ

I found this extension and the one from Sascha (saschaegerer/phpstan-typo3). Why are there two extensions and which should I use?

Well, this package has one specific purpose. It's made to help making the TYPO3 core phpstan max level compatible. To achieve this, the core team needs to be able to have its own extension which can be quickly adjusted as soon as the core itself changes. If for example, a new core version is released, the core team can quickly raise the dependency constraints for typo3/cms-core and typo3/cms-extbase which cannot be done when working with Sascha's package.

Also, Sascha's package contains dynamic return type providers that are not needed (yet) to make the core more compatible with phpstan.

To sum it all up: There is no competition between both extensions and this extension should not be used by users but only by the TYPO3 core.

friendsoftypo3/phpstan-typo3 适用场景与选型建议

friendsoftypo3/phpstan-typo3 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 648.26k 次下载、GitHub Stars 达 19, 最近一次更新时间为 2020 年 03 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 friendsoftypo3/phpstan-typo3 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 19
  • Watchers: 7
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2020-03-21