Skip to content

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Nov 23, 2017

map() does not reset internal object cache for this key, and there is no way to tell build() to make a fresh one.

As Travis around dereuromark/cakephp-ide-helper@f3128fe shows, mapping a different type after building has already been done still uses the old object.
Using set() and an actual instance (Type::set('uuid', new UuidType());) works, but I think resetting here is the expected and intuitive behavior after remapping.

With this fix Type::map('uuid', UuidType::class); etc works.

@dereuromark dereuromark added this to the 3.5.7 milestone Nov 23, 2017
@markstory
Copy link
Member

Is there a way we could capture the changed behavior with a test case?

@codecov-io
Copy link

codecov-io commented Nov 23, 2017

Codecov Report

Merging #11457 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11457      +/-   ##
============================================
+ Coverage     93.11%   93.12%   +0.01%     
- Complexity    13008    13012       +4     
============================================
  Files           436      436              
  Lines         33699    33708       +9     
============================================
+ Hits          31378    31392      +14     
+ Misses         2321     2316       -5
Impacted Files Coverage Δ Complexity Δ
src/Database/Type.php 60.6% <100%> (+0.6%) 32 <0> (ø) ⬇️
src/Auth/DigestAuthenticate.php 92.3% <0%> (+0.74%) 36% <0%> (+4%) ⬆️
src/Cache/Engine/FileEngine.php 90.16% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4%) 11% <0%> (ø) ⬇️
src/Cache/CacheEngine.php 93.61% <0%> (+4.25%) 19% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d42b5f...9902994. Read the comment docs.

@dereuromark
Copy link
Member Author

I added some tests, and cleaned up the smell about the inline class in the process :)

@markstory markstory merged commit 5a76d37 into master Nov 23, 2017
@markstory markstory deleted the bugfix/type-map branch November 23, 2017 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants