Skip to content

Commit

Permalink
Feature/script version (#83)
Browse files Browse the repository at this point in the history
* Allow int values in Script version to allow `filemtime` to be used.

* Update Style version to allow for int.
  • Loading branch information
thefrosty authored Apr 24, 2024
1 parent 515b1f8 commit 9b85b65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 8 additions & 7 deletions src/Api/Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,27 @@ public function getDependencies(): array

/**
* Script version.
* @var string $version
* @var int|string $version
*/
protected string $version;
protected int|string $version;

/**
* Set the Script version.
* @param string $version
* @param int|string $version
*/
public function setVersion(string $version = '0.0.1'): void
public function setVersion(int|string $version = ''): void
{
$this->version = $version;
}

/**
* Get the Script version.
* @return string
* @return int|string
*/
public function getVersion(): string
public function getVersion(): int|string
{
return $this->version ?? '0.0.1';
global $wp_version;
return $this->version === '' ? $wp_version : $this->version;
}

/**
Expand Down
15 changes: 8 additions & 7 deletions src/Api/Style.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,27 @@ public function getDependencies(): array

/**
* Style version.
* @var string $version
* @var int|string $version
*/
protected string $version;
protected int|string $version;

/**
* Set Style version.
* @param string $version
* @param int|string $version
*/
public function setVersion(string $version = '0.0.1'): void
public function setVersion(int|string $version = ''): void
{
$this->version = $version;
}

/**
* Get Style version.
* @return string
* @return int|string
*/
public function getVersion(): string
public function getVersion(): int|string
{
return $this->version ?? '0.0.1';
global $wp_version;
return $this->version === '' ? $wp_version : $this->version;
}

/**
Expand Down

0 comments on commit 9b85b65

Please sign in to comment.