Closed huangdijia closed 3 months ago
/** * @template T * @param T|null $a * @return ($a is null ? null : T) */ function test($a = null) { if (is_null($a)) { return null; } return $a; } $b = test(1); // The return type is '1'
Platform and version
版本: 1.90.2 (Universal) 提交: 5437499feb04f7a586f677b155b039bc2b3669eb 日期: 2024-06-18T22:37:41.291Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin x64 20.6.0
It's using the literal type, but probably not useful to return this, so I'll change it to use the super type.
Platform and version