Skip to content

Commit

Permalink
No longer cache the license object
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Dec 4, 2024
1 parent 7e57f56 commit bb7c529
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 1 addition & 5 deletions src/Plugin/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,8 @@ public function link(): string|null
*/
public function license(): License
{
if ($this->license instanceof License) {
return $this->license;
}

// resolve license info from Closure, array or string
return $this->license = License::from(
return License::from(
plugin: $this,
license: $this->license
);
Expand Down
2 changes: 0 additions & 2 deletions tests/Plugin/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@ public function testLicense(): void
{
$plugin = new Plugin(name: 'getkirby/test-plugin');
$this->assertInstanceOf(License::class, $license = $plugin->license());
// check for cached instance
$this->assertSame($license, $plugin->license());
}

public function testLicenseFromString(): void
Expand Down

0 comments on commit bb7c529

Please sign in to comment.