Skip to content

Commit

Permalink
API Strong typing for the view layer (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Aug 27, 2024
1 parent e2eb3f6 commit 1e8c034
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 117 deletions.
8 changes: 2 additions & 6 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,8 @@ public static function get_shortcodes()
*
* Use $file->isInDB() to only check for a DB record
* Use $file->File->exists() to only check if the asset exists
*
* @return bool
*/
public function exists()
public function exists(): bool
{
return parent::exists() && $this->File->exists();
}
Expand Down Expand Up @@ -1316,10 +1314,8 @@ public function getVariant()

/**
* Return a html5 tag of the appropriate for this file (normally img or a)
*
* @return string
*/
public function forTemplate()
public function forTemplate(): string
{
return $this->getTag() ?: '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Folder extends File

private static $table_name = 'Folder';

public function exists()
public function exists(): bool
{
return $this->isInDB();
}
Expand Down
Loading

0 comments on commit 1e8c034

Please sign in to comment.