CakePHP 3 - 如何在 bootstrap.php 中记录 useImmutable() 方法
CakePHP 3 - How to do document useImmutable() method in bootstrap.php
我们使用 scrutinizer 检查我们的代码。这是与 phpdoc 相关的 "bug":
<?php
*
* @method \Cake\Database\Type\DateTimeType[] useImmutable()
*/
Type::build('time')->useImmutable();
错误信息:
The method useImmutable() does not exist on Cake\Database\Type. It
seems like you code against a sub-type of Cake\Database\Type such as
Cake\Database\Type\DateTimeType.
创建一个变量并对其进行类型提示:
/** @var \Cake\Database\Type\DateTimeType $time */
$time = Type::build('time');
$time->useImmutable();
我们使用 scrutinizer 检查我们的代码。这是与 phpdoc 相关的 "bug":
<?php
*
* @method \Cake\Database\Type\DateTimeType[] useImmutable()
*/
Type::build('time')->useImmutable();
错误信息:
The method useImmutable() does not exist on Cake\Database\Type. It seems like you code against a sub-type of Cake\Database\Type such as Cake\Database\Type\DateTimeType.
创建一个变量并对其进行类型提示:
/** @var \Cake\Database\Type\DateTimeType $time */
$time = Type::build('time');
$time->useImmutable();