1. Go to this page and download the library: Download mudandstars/sync-enum-types library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
enum MyEnum: int
{
case FIRST_CASE = 1;
case SECOND_CASE = 2;
public function description(): string
{
return match($this) {
self::FIRST_CASE => 'first case description',
self::SECOND_CASE => 'second case description',
};
}
public function someOtherFunction()...
}
enum MyEnum: int
{
case FIRST_CASE = 1;
case SECOND_CASE = 2;
// @sync-enum-types: sync-using-method
public function description(): string
{
return match($this) {
self::FIRST_CASE => 'first case description',
self::SECOND_CASE => 'second case description',
};
}
public function someOtherFunction()...
}