()
| 1884 | class StaticEnumDemo |
| 1885 | { |
| 1886 | public function demo(): void |
| 1887 | { |
| 1888 | User::$defaultRole; // static property |
| 1889 | User::TYPE_ADMIN; // class constant |
| 1890 | User::findByEmail('a@b.c'); // static method |
| 1891 | User::make('Bob'); // inherited static (Model) |
| 1892 | User::query(); // @mixin Builder (Model) |
| 1893 | |
| 1894 | Status::Active; // backed enum case |
| 1895 | Status::Active->label(); // enum method |
| 1896 | Status::Active->name; // "Active" (from UnitEnum) |
| 1897 | Status::Active->value; // "active" (from BackedEnum) |
| 1898 | Priority::High; // int-backed enum |
| 1899 | Priority::High->name; // "High" (from UnitEnum) |
| 1900 | Priority::High->value; // 3 (from BackedEnum, int) |
| 1901 | Mode::Manual; // unit enum |
| 1902 | Mode::Manual->name; // "Manual" (from UnitEnum) |
| 1903 | |
| 1904 | // Enum case assigned to variable |
| 1905 | $status = Status::Active; |
| 1906 | $status->name; // resolves through variable |
| 1907 | $status->value; |
| 1908 | |
| 1909 | // self::/static:: inside enum methods resolve to the enum type |
| 1910 | Status::defaultValue(); // self::Active->value inside enum |
| 1911 | } |
| 1912 | } |
| 1913 | |
| 1914 |
nothing calls this directly
no test coverage detected