Skip to content

Instantly share code, notes, and snippets.

@ismail1432
Created December 22, 2021 15:17
Show Gist options
  • Save ismail1432/8e601baf15ad9d4aa3ec75510f648780 to your computer and use it in GitHub Desktop.
Save ismail1432/8e601baf15ad9d4aa3ec75510f648780 to your computer and use it in GitHub Desktop.
<?php
namespace App\Domain;
final class Status
{
public const DELETED = 'deleted';
public function getDeletedStatus(): string
{
return self::DELETED;
}
}
// access from FQCN
echo Status::DELETED; // output deleted
$status = new Status;
// access from instance
echo $status::DELETED; // output deleted
// access from the class itself
echo $status->getDeletedStatus(); // output deleted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment