Skip to content

Commit c658378

Browse files
committed
Fix missing type definitions for callable
1 parent f08e126 commit c658378

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/FileCodeGenerator.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ public function generateFiles(
5252
$files = [];
5353

5454
if ($currentFileAst === null) {
55-
$currentFileAst = static function (File $file, ClassInfo $classInfo) {
55+
/**
56+
* @param File $file
57+
* @param ClassInfo $classInfo
58+
* @return \PhpParser\Node\Stmt[]
59+
*/
60+
$currentFileAst = static function (File $file, ClassInfo $classInfo): array {
5661
return [];
5762
};
5863
}
@@ -93,7 +98,7 @@ public function addGetterMethodsForProperties(
9398
callable $skip = null
9499
): void {
95100
if ($skip === null) {
96-
$skip = static function (ClassBuilder $classBuilder) {
101+
$skip = static function (ClassBuilder $classBuilder): bool {
97102
return false;
98103
};
99104
}
@@ -106,7 +111,8 @@ public function addGetterMethodsForProperties(
106111
$methodName = ($methodNameFilter)($classPropertyBuilder->getName());
107112

108113
if (true === ($skip)($classBuilder)
109-
|| $classBuilder->hasMethod($methodName)) {
114+
|| $classBuilder->hasMethod($methodName)
115+
) {
110116
continue 2;
111117
}
112118
$classBuilder->addMethod(
@@ -136,7 +142,7 @@ public function addClassConstantsForProperties(
136142
int $visibility = ClassConstGenerator::FLAG_PUBLIC
137143
): void {
138144
if ($skip === null) {
139-
$skip = static function (ClassBuilder $classBuilder) {
145+
$skip = static function (ClassBuilder $classBuilder): bool {
140146
return false;
141147
};
142148
}
@@ -149,7 +155,8 @@ public function addClassConstantsForProperties(
149155
$constantName = ($constantNameFilter)($classPropertyBuilder->getName());
150156

151157
if (true === ($skip)($classBuilder)
152-
|| $classBuilder->hasConstant($constantName)) {
158+
|| $classBuilder->hasConstant($constantName)
159+
) {
153160
continue 2;
154161
}
155162
$classBuilder->addConstant(

0 commit comments

Comments
 (0)