Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何为方法调用启用不匹配的typehint警告?_Php_Phpstorm_Phpdoc - Fatal编程技术网

Php 如何为方法调用启用不匹配的typehint警告?

Php 如何为方法调用启用不匹配的typehint警告?,php,phpstorm,phpdoc,Php,Phpstorm,Phpdoc,我有一个方法需要int: /** * @param int $someInt */ public function methodExpectingInt($someInt) { // stuff } 然而,当仅在向其中传递对象时才从某处调用时,PhpStorm中将出现警告 /** * @return void */ public function someMethod() { $this->methodExpectingInt(23); // no warning

我有一个方法需要
int

/**
 * @param int $someInt
 */
public function methodExpectingInt($someInt)
{
    // stuff
}
然而,当仅在向其中传递对象时才从某处调用时,PhpStorm中将出现警告

/**
 * @return void
 */
public function someMethod()
{
    $this->methodExpectingInt(23); // no warning but as an int everything is fine
    $this->methodExpectingInt(new \Object()); // gets a warning in phpstorm \o/
    $this->methodExpectingInt("this string should issue a warning"); // no warning yet is string
    $this->methodExpectingInt(null); // no warning yet is null
    $this->methodExpectingInt(2.9); // no warning yet is a float
}
它将如下所示:


使用的PhpStorm版本是什么?可能是在v9中修复的。在任何情况下:没有额外的设置——这就是它目前的工作方式(v8.x)——不幸的是,我找不到票证(肯定有一个票证存在)。@LazyOne如果它不是当前的功能,那么我将创建一个票证=)@LazyOne当前我使用8.0。3@LazyOne如果有这个的复制品,我们会发现:找到它: