Skip to content

Commit a56c7e2

Browse files
committedJul 3, 2018
Move the empty($cassetteName) Check Up
Acts as a gaurd so no `substr(...)` operations are performed on a null and break things.
1 parent a6009d8 commit a56c7e2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/VCRTestListener.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public function startTest(Test $test): void
4545
$parsed = self::parseDocBlock($docBlock, '@vcr');
4646
$cassetteName = array_pop($parsed);
4747

48+
if (empty($cassetteName)) {
49+
return;
50+
}
51+
4852
// If the cassette name ends in .json, then use the JSON storage format
4953
if (substr($cassetteName, -5) === '.json') {
5054
VCR::configure()->setStorage('json');
5155
}
5256

53-
if (empty($cassetteName)) {
54-
return;
55-
}
56-
5757
VCR::turnOn();
5858
VCR::insertCassette($cassetteName);
5959
}

0 commit comments

Comments
 (0)