Using camelcase instead of all caps for constants

This commit is contained in:
Cédric Belin
2019-04-15 20:27:27 +02:00
parent 76e8cfa0a4
commit 21b2fc1fa3
4 changed files with 19 additions and 13 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## Version [0.3.0](https://github.com/sab-international/gitea.php/compare/v0.2.0...v0.3.0)
- Breaking change: removed `__toString()` methods from the model classes.
- Breaking change: using camelcase instead of all caps for constants.
- Modified the package layout.
- Updated the package dependencies.
## Version [0.2.0](https://github.com/sab-international/gitea.php/compare/v0.1.1...v0.2.0)
- Added `__toString()` methods to the model classes.
- Added the `TrackedTime` model.

View File

@ -8,17 +8,17 @@ final class StatusState {
use EnumTrait;
/** @var string The status is an error. */
const ERROR = 'error';
const error = 'error';
/** @var string The status is a failure. */
const FAILURE = 'failure';
const failure = 'failure';
/** @var string The status is pending. */
const PENDING = 'pending';
const pending = 'pending';
/** @var string The status is a success. */
const SUCCESS = 'success';
const success = 'success';
/** @var string The status is a warning. */
const WARNING = 'warning';
const warning = 'warning';
}

View File

@ -14,7 +14,7 @@ class Team implements \JsonSerializable {
private $name;
/** @var string The team permission. */
private $permission = TeamPermission::NONE;
private $permission = TeamPermission::none;
/**
* Creates a new team.
@ -34,7 +34,7 @@ class Team implements \JsonSerializable {
static function fromJson(object $map): self {
return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->name) && is_string($map->name) ? $map->name : ''))
->setDescription(isset($map->description) && is_string($map->description) ? $map->description : '')
->setPermission(isset($map->permission) && is_string($map->permission) ? $map->permission : TeamPermission::NONE);
->setPermission(isset($map->permission) && is_string($map->permission) ? $map->permission : TeamPermission::none);
}
/**
@ -108,7 +108,7 @@ class Team implements \JsonSerializable {
* @return $this This instance.
*/
function setPermission(string $value): self {
$this->permission = TeamPermission::coerce($value, TeamPermission::NONE);
$this->permission = TeamPermission::coerce($value, TeamPermission::none);
return $this;
}
}

View File

@ -8,17 +8,17 @@ final class TeamPermission {
use EnumTrait;
/** @var string The team has the administrator permission. */
const ADMIN = 'admin';
const admin = 'admin';
/** @var string The team doesn't have any permission. */
const NONE = 'none';
const none = 'none';
/** @var string The team has the owner permission. */
const OWNER = 'owner';
const owner = 'owner';
/** @var string The team has the read permission. */
const READ = 'read';
const read = 'read';
/** @var string The team has the write permission. */
const WRITE = 'write';
const write = 'write';
}