for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* PHP version 7.1
*
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
namespace PhUml\Code;
class Constant implements HasType
{
use WithTypeDeclaration;
/** @var string */
private $name;
public function __construct(string $name, TypeDeclaration $type = null)
$this->name = $name;
$this->type = $type ?? TypeDeclaration::absent();
}
public function __toString()
return sprintf(
"+%s%s",
$this->name,
$this->type->isPresent() ? ": {$this->type}" : ''
);