emteknetnz/type-transitioner

类型转换器

安装: 454

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:silverstripe-vendormodule

dev-main 2022-08-22 00:59 UTC

This package is auto-updated.

Last update: 2024-09-22 05:31:36 UTC


README

协助迁移从动态类型到静态类型

注意

$lineageJ = $this->getClassLineage($argTypeI); 应该是 $lineageJ = $this->getClassLineage($argTypeJ);

然而运行似乎陷入了一个递归循环

然而在这个阶段,团队已经一致同意我们不采用这种方法

一次性扫描多个模块

已测试此功能正常工作

for vendorPath in vendor/*; do
  if [[ $vendorPath =~ vendor/(silverstripe|symbiote|dnadesign) ]]; then
    for modulePath in $vendorPath/*; do
      if [ -f TESTS_RUNNING.json ]; then
        rm TESTS_RUNNING.json
      fi
      pu $modulePath
      if [ -f $modulePath/behat.yml ]; then
        [[ $modulePath =~ /([a-zA-Z0-0\-]+)$ ]]
        suite="${BASH_REMATCH[1]}"
        bha $suite
      fi
    done
  fi
done

它将基本上跳过recipe-cms和其他包含测试套件而不是自身测试的recipe,尽管这是可取的,因为它们只会重复常规模块的测试

如果behat有“意外警报”问题,它将不会在模块内运行后续的behat测试,然而bash仍将继续到下一个模块运行phpunit测试。

关于为什么这项工作不适合PHP8.1的说明

_c('string', $arg, 1) 不适用于php8.1,因为所有 _a() 数据收集都会告诉我们传递了哪些arg类型。然而,如果我们得到一大堆 stringnull,那么参数类型是 string,还是 string|null。没有简单的方法可以判断是否应该允许所有的 null 参数。

因此,我们不能安心地使用 _c('string', $arg, 1),因为也许我们应该允许 $argnull 值?我们没有办法判断它应该是 string 还是 ?string

似乎我们需要等到CMS5,然后将其设置为 string 并手动更新每个 null 方法调用到一个空字符串