diff --git a/src/Psalm/Checker/ClassLikeChecker.php b/src/Psalm/Checker/ClassLikeChecker.php index 7b2549194..febe59c1d 100644 --- a/src/Psalm/Checker/ClassLikeChecker.php +++ b/src/Psalm/Checker/ClassLikeChecker.php @@ -546,7 +546,7 @@ abstract class ClassLikeChecker extends SourceChecker implements StatementsSourc new PropertyNotSetInConstructor( 'Property ' . $property_id . ' is not defined in constructor of ' . $this->fq_class_name . ' or in any private methods called in the constructor', - new CodeLocation($this, $this->class, true) + new CodeLocation($this, $constructor_checker->getFunctionLike(), true) ), $this->source->getSuppressedIssues() )) { diff --git a/src/Psalm/Checker/FunctionLikeChecker.php b/src/Psalm/Checker/FunctionLikeChecker.php index 1613f7a43..1f0dbdb37 100644 --- a/src/Psalm/Checker/FunctionLikeChecker.php +++ b/src/Psalm/Checker/FunctionLikeChecker.php @@ -738,6 +738,14 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo return $this->is_static; } + /** + * @return Closure|Function_|ClassMethod + */ + public function getFunctionLike() + { + return $this->function; + } + /** * @return StatementsSource */