Skip to content

Commit f90cf82

Browse files
Refactor
1 parent 985227d commit f90cf82

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/Metadata/Api/DataProvider.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,16 @@ private function dataProvidedByMethods(ReflectionMethod $testMethod, MetadataCol
9898
$methodsCalled[] = $dataProviderMethod;
9999

100100
try {
101-
$method = new ReflectionMethod($_dataProvider->className(), $_dataProvider->methodName());
101+
$method = new ReflectionMethod($_dataProvider->className(), $_dataProvider->methodName());
102+
$className = $_dataProvider->className();
103+
$methodName = $_dataProvider->methodName();
102104

103105
if (!$method->isPublic()) {
104106
throw new InvalidDataProviderException(
105107
sprintf(
106108
'Data Provider method %s::%s() is not public',
107-
$_dataProvider->className(),
108-
$_dataProvider->methodName(),
109+
$className,
110+
$methodName,
109111
),
110112
);
111113
}
@@ -114,8 +116,8 @@ private function dataProvidedByMethods(ReflectionMethod $testMethod, MetadataCol
114116
throw new InvalidDataProviderException(
115117
sprintf(
116118
'Data Provider method %s::%s() is not static',
117-
$_dataProvider->className(),
118-
$_dataProvider->methodName(),
119+
$className,
120+
$methodName,
119121
),
120122
);
121123
}
@@ -124,24 +126,21 @@ private function dataProvidedByMethods(ReflectionMethod $testMethod, MetadataCol
124126
throw new InvalidDataProviderException(
125127
sprintf(
126128
'Data Provider method %s::%s() expects an argument',
127-
$_dataProvider->className(),
128-
$_dataProvider->methodName(),
129+
$className,
130+
$methodName,
129131
),
130132
);
131133
}
132134

133-
$className = $_dataProvider->className();
134-
$methodName = $_dataProvider->methodName();
135-
136135
/** @phpstan-ignore staticMethod.dynamicName */
137136
$data = $className::$methodName();
138137

139138
if (!is_iterable($data)) {
140139
throw new InvalidDataProviderException(
141140
sprintf(
142141
'Data Provider method %s::%s() does not return an iterable',
143-
$_dataProvider->className(),
144-
$_dataProvider->methodName(),
142+
$className,
143+
$methodName,
145144
),
146145
);
147146
}

0 commit comments

Comments
 (0)