Skip to content
PHP Logo

What are some best practices for resolving type conflicts between DocBlock and function signature in PHPStorm?

When resolving type conflicts between DocBlock and function signature in PHPStorm, it is best practice to ensure that the types specified in the DocBlock match those in the function signature. This helps maintain consistency and clarity in your code. To resolve any conflicts, you can update the types in either the DocBlock or the function signature to match each other.

php
/**
 * @param int $num1
 * @param int $num2
 * @return int
 */
function addNumbers(int $num1, int $num2): int {
    return $num1 + $num2;
}