for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
namespace Reflection\ClassUseStatements;
/**
* Class UseStatement
* @package UsesReflection
*/
class UseStatement {
* @var string
private $use;
private $alias;
* UseStatement constructor.
* @param string $use
* @param string $alias
public function __construct(string $use, string $alias = '') {
$this->setUse($use)
->setAlias($alias);
}
* @return string
public function getUse(): string {
return $this->use;
* @return UseStatement
public function setUse(string $use): UseStatement {
if ($use[0] !== '\\') {
$use = "\\$use";
$this->use = $use;
return $this;
public function getAlias(): string {
return $this->alias;
public function setAlias(string $alias): UseStatement {
$this->alias = $alias;
* @param string $statement
* @return bool
public function isEqual(string $statement): bool {
if ($statement === $this->getUse()) {
return true;
if ($statement === $this->getAlias()) {
return false;