Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Strong typing for the view layer #634

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading