Skip to content

Commit 1e814d8

Browse files
committed
Improve type hinting
1 parent 01cef3b commit 1e814d8

File tree

6 files changed

+13
-10
lines changed

6 files changed

+13
-10
lines changed

src/Adapters/FakeFeatureAdapter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ class FakeFeatureAdapter implements FeatureAdapter
1111
/**
1212
* @var Change[]|array
1313
*/
14-
private $changes = [];
14+
private array $changes = [];
1515

1616
/**
17+
* Set a lis of changes for the given path.
18+
*
1719
* @param string $path
1820
* @param Feature $changes
1921
*/
20-
public function setChanges(string $path, Feature $changes)
22+
public function setChanges(string $path, Feature $changes): void
2123
{
2224
$this->changes[$path] = $changes;
2325
}

src/Adapters/FakeReleaseAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class FakeReleaseAdapter implements ReleaseAdapter
1515
/**
1616
* @var Release[][]|array
1717
*/
18-
private $releases = [];
18+
private array $releases = [];
1919

2020
/**
21-
* A a release to the list.
21+
* A release to the list.
2222
*
2323
* @param string $path
2424
* @param string $version

src/Adapters/XmlFeatureAdapter.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace MarkWalet\Changelog\Adapters;
44

55
use DOMDocument;
6+
use Illuminate\Contracts\Filesystem\FileNotFoundException as FilesystemFileNotFoundException;
67
use Illuminate\Filesystem\Filesystem;
78
use MarkWalet\Changelog\Change;
89
use MarkWalet\Changelog\Exceptions\FileNotFoundException;
@@ -14,7 +15,7 @@ class XmlFeatureAdapter implements FeatureAdapter
1415
/**
1516
* @var Filesystem
1617
*/
17-
private $filesystem;
18+
private Filesystem $filesystem;
1819

1920
/**
2021
* XmlFeatureAdapter constructor.
@@ -34,13 +35,13 @@ public function read(string $path): Feature
3435
{
3536
try {
3637
$content = $this->filesystem->get($path);
37-
} catch (\Illuminate\Contracts\Filesystem\FileNotFoundException $e) {
38+
} catch (FilesystemFileNotFoundException $e) {
3839
throw new FileNotFoundException($path);
3940
}
4041

4142
$element = simplexml_load_string($content);
4243

43-
$feature = new Feature;
44+
$feature = new Feature();
4445

4546
foreach ($element->children() as $change) {
4647
$type = $change->attributes()['type'];

src/Adapters/XmlReleaseAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class XmlReleaseAdapter implements ReleaseAdapter
1717
/**
1818
* @var XmlFeatureAdapter
1919
*/
20-
private $featureAdapter;
20+
private XmlFeatureAdapter $featureAdapter;
2121

2222
/**
2323
* XmlReleaseAdapter constructor.

src/ChangelogFormatterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function make(string $type): ChangelogFormatter
4040
$driver = Arr::pull($config, 'driver');
4141

4242
if (Arr::has(class_parents($driver), ChangelogFormatter::class) === false) {
43-
throw new InvalidArgumentException("The driver {$driver} is not a valid driver.");
43+
throw new InvalidArgumentException("The driver $driver is not a valid driver.");
4444
}
4545

4646
return new $driver($config);

src/Commands/ChangelogAddCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private function changelog(FeatureAdapter $adapter, string $path): Feature
8383
* @param GitDriver $gitState
8484
* @return string
8585
*/
86-
private function path(GitDriver $gitState)
86+
private function path(GitDriver $gitState): string
8787
{
8888
return config('changelog.path')
8989
.DIRECTORY_SEPARATOR.'unreleased'

0 commit comments

Comments
 (0)