Skip to content

Commit ac2105b

Browse files
committed
Register TypeMapperInterface and TypeMapper as one singleton
One can easily make a mistake by resolving `TypeMapper` from the container instead of `TypeMapperInterface`. This class wasn't registered as singleton (only the interface) so you always get a new instance without types. By registering them both as one singleton, we make it less error prone. Closes: swisnl#65
1 parent 8b5cb05 commit ac2105b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010

1111
* Reworded `ValidationException` messages to align them with the wordings used in the specification.
1212
* `DocumentParser` throws a `ValidationException` when it encounters duplicate resources.
13+
* `TypeMapperInterface` and `TypeMapper` are now registered as the same singleton.
1314

1415
## [1.0.0-beta.3] - 2019-09-30
1516

src/Providers/ServiceProvider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public function boot()
3737

3838
protected function registerSharedTypeMapper()
3939
{
40-
$this->app->singleton(TypeMapperInterface::class, TypeMapper::class);
40+
$this->app->bind(TypeMapperInterface::class, TypeMapper::class);
41+
$this->app->singleton(TypeMapper::class);
4142
}
4243

4344
protected function registerParsers()

0 commit comments

Comments
 (0)