Skip to content

Commit 525505b

Browse files
committed
Fix codestyle and phpstan
1 parent e36b8bf commit 525505b

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/Config/ExpectationsPath.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace DEVizzent\CodeceptionMockServerHelper\Config;
44

55
use DEVizzent\CodeceptionMockServerHelper\MockServerHelper;
6+
use InvalidArgumentException;
67
use RecursiveDirectoryIterator;
78
use RecursiveIteratorIterator;
89
use SplFileInfo;
@@ -13,24 +14,27 @@ class ExpectationsPath
1314

1415
public function __construct(string $path = '')
1516
{
16-
if (!empty($path)) {
17+
if ('' === $path) {
1718
$this->set($path);
1819
}
1920
}
2021

21-
private function set(string $path)
22+
private function set(string $path): void
2223
{
2324
$path = realpath($path);
24-
if ($path) {
25+
if (false !== $path) {
2526
$this->path = $path;
2627
return;
2728
}
28-
throw new \InvalidArgumentException(sprintf('"%s" is not a valid path for "expectationsPath"', $path));
29+
throw new InvalidArgumentException(sprintf('"%s" is not a valid path for "expectationsPath"', $path));
2930
}
3031

32+
/**
33+
* @return array<string>
34+
*/
3135
public function getExpectationsFiles(): iterable
3236
{
33-
if (empty($this->path)) {
37+
if ('' !== $this->path) {
3438
return [];
3539
}
3640
if (!is_dir($this->path)) {
@@ -40,11 +44,11 @@ public function getExpectationsFiles(): iterable
4044
$files = [];
4145
/** @var SplFileInfo $file */
4246
foreach ($recursiveIterator as $file) {
43-
if ($file->isDir()){
47+
if ($file->isDir()) {
4448
continue;
4549
}
4650
$files[] = $file->getPathname();
4751
}
4852
return $files;
4953
}
50-
}
54+
}

src/MockServerHelper.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public function _initialize(): void
5858

5959
try {
6060
$this->deactivateNotMatchedRequest();
61-
} catch (AssertionFailedError $exception) {}
61+
} catch (AssertionFailedError $exception) {
62+
return;
63+
}
6264
}
6365

6466
public function _beforeSuite($settings = []): void
@@ -130,7 +132,7 @@ public function deactivateNotMatchedRequest(): void
130132
$this->mockserver->removeById(self::NOT_MATCHED_REQUEST_ID);
131133
}
132134

133-
public function createMockRequestFromJsonFile($expectationFile): void
135+
public function createMockRequestFromJsonFile(string $expectationFile): void
134136
{
135137
$expectationJson = file_get_contents($expectationFile);
136138
Assert::assertIsString($expectationJson);

0 commit comments

Comments
 (0)