Code improvements (#1649)
* use global namespace for faster lookups * phpstan level 5
This commit is contained in:
@@ -26,14 +26,14 @@ final class ActivityFormTypeQuery extends BaseFormTypeQuery
|
||||
public function __construct($activity = null, $project = null)
|
||||
{
|
||||
if (null !== $activity) {
|
||||
if (!is_array($activity)) {
|
||||
if (!\is_array($activity)) {
|
||||
$activity = [$activity];
|
||||
}
|
||||
$this->setActivities($activity);
|
||||
}
|
||||
|
||||
if (null !== $project) {
|
||||
if (!is_array($project)) {
|
||||
if (!\is_array($project)) {
|
||||
$project = [$project];
|
||||
}
|
||||
$this->setProjects($project);
|
||||
|
||||
@@ -76,7 +76,7 @@ class ActivityQuery extends ProjectQuery
|
||||
*/
|
||||
public function getProject()
|
||||
{
|
||||
if (count($this->projects) > 0) {
|
||||
if (\count($this->projects) > 0) {
|
||||
return $this->projects[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ abstract class BaseFormTypeQuery
|
||||
*/
|
||||
public function getActivity()
|
||||
{
|
||||
if (count($this->activities) > 0) {
|
||||
if (\count($this->activities) > 0) {
|
||||
return $this->activities[0];
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ abstract class BaseFormTypeQuery
|
||||
*/
|
||||
public function getProject()
|
||||
{
|
||||
if (count($this->projects) > 0) {
|
||||
if (\count($this->projects) > 0) {
|
||||
return $this->projects[0];
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ abstract class BaseFormTypeQuery
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
if (count($this->customers) > 0) {
|
||||
if (\count($this->customers) > 0) {
|
||||
return $this->customers[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ class BaseQuery
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
if (in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
|
||||
if (\in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ class BaseQuery
|
||||
{
|
||||
foreach ($errors as $error) {
|
||||
$key = $error->getOrigin()->getName();
|
||||
if (array_key_exists($key, $this->defaults)) {
|
||||
if (\array_key_exists($key, $this->defaults)) {
|
||||
$this->set($key, $this->defaults[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ final class CustomerFormTypeQuery extends BaseFormTypeQuery
|
||||
public function __construct($customer = null)
|
||||
{
|
||||
if (null !== $customer) {
|
||||
if (!is_array($customer)) {
|
||||
if (!\is_array($customer)) {
|
||||
$customer = [$customer];
|
||||
}
|
||||
$this->setCustomers($customer);
|
||||
|
||||
@@ -30,14 +30,14 @@ final class ProjectFormTypeQuery extends BaseFormTypeQuery
|
||||
public function __construct($project = null, $customer = null)
|
||||
{
|
||||
if (null !== $project) {
|
||||
if (!is_array($project)) {
|
||||
if (!\is_array($project)) {
|
||||
$project = [$project];
|
||||
}
|
||||
$this->setProjects($project);
|
||||
}
|
||||
|
||||
if (null !== $customer) {
|
||||
if (!is_array($customer)) {
|
||||
if (!\is_array($customer)) {
|
||||
$customer = [$customer];
|
||||
}
|
||||
$this->setCustomers($customer);
|
||||
|
||||
@@ -46,7 +46,7 @@ class ProjectQuery extends BaseQuery implements VisibilityInterface
|
||||
*/
|
||||
public function getCustomer()
|
||||
{
|
||||
if (count($this->customers) > 0) {
|
||||
if (\count($this->customers) > 0) {
|
||||
return $this->customers[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class TimesheetQuery extends ActivityQuery
|
||||
*/
|
||||
public function getActivity()
|
||||
{
|
||||
if (count($this->activities) > 0) {
|
||||
if (\count($this->activities) > 0) {
|
||||
return $this->activities[0];
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class TimesheetQuery extends ActivityQuery
|
||||
public function setState($state)
|
||||
{
|
||||
$state = (int) $state;
|
||||
if (in_array($state, [self::STATE_ALL, self::STATE_RUNNING, self::STATE_STOPPED], true)) {
|
||||
if (\in_array($state, [self::STATE_ALL, self::STATE_RUNNING, self::STATE_STOPPED], true)) {
|
||||
$this->state = $state;
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ class TimesheetQuery extends ActivityQuery
|
||||
public function setExported($exported)
|
||||
{
|
||||
$exported = (int) $exported;
|
||||
if (in_array($exported, [self::STATE_ALL, self::STATE_EXPORTED, self::STATE_NOT_EXPORTED], true)) {
|
||||
if (\in_array($exported, [self::STATE_ALL, self::STATE_EXPORTED, self::STATE_NOT_EXPORTED], true)) {
|
||||
$this->exported = $exported;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ trait VisibilityTrait
|
||||
public function setVisibility($visibility)
|
||||
{
|
||||
$visibility = (int) $visibility;
|
||||
if (in_array($visibility, VisibilityInterface::ALLOWED_VISIBILITY_STATES, true)) {
|
||||
if (\in_array($visibility, VisibilityInterface::ALLOWED_VISIBILITY_STATES, true)) {
|
||||
$this->visibility = $visibility;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user