Issues (72)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/dbQuery.php (30 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php declare(strict_types = 1);
2
namespace samson\activerecord;
3
4
use samsonframework\orm\ArgumentInterface;
5
use samsonframework\orm\Condition;
6
use samsonframework\orm\ConditionInterface;
7
use samsonframework\orm\QueryHandler;
8
use samsonframework\orm\QueryInterface;
9
10
/**
11
 * This class will be removed in next major release.
12
 * @author     Vitaly Iegorov <[email protected]>
13
 * @deprecated Should be removed ASAP in favor of generated classes or DI
14
 *
15
 */
16
class dbQuery extends QueryHandler
0 ignored issues
show
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
Deprecated Code introduced by
The class samsonframework\orm\QueryHandler has been deprecated.

This class, trait or interface has been deprecated.

Loading history...
17
{
18
    /** Virtual field for base table */
19
    public $own_virtual_fields = array();
20
    /** Virtual fields */
21
    public $virtual_fields = array();
22
    public $empty = false;
23
    protected $class_name;
24
    /**
25
     * @var QueryInterface
26
     */
27
    protected $query;
28
    /** @var bool True to show requests */
29
    protected $debug = false;
30
31
    /** Constructor */
32
    public function __construct()
33
    {
34
        $this->database = $GLOBALS['__core']->getContainer()->getDatabase();
0 ignored issues
show
The property database does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
35
        $this->sqlBuilder = $GLOBALS['__core']->getContainer()->getSqlBuilder();
0 ignored issues
show
The property sqlBuilder does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
36
    }
37
    
38
    /**
39
     * @param string $metadata
40
     *
41
     * @deprecated Use entity()
42
     * @return QueryInterface|string
43
     */
44
    public function className(string $metadata = null)
45
    {
46
        if (func_num_args() === 0) {
47
            return $this->metadata->className;
0 ignored issues
show
The property metadata does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
48
        } else {
49
            return $this->entity($metadata);
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class samson\activerecord\dbQuery as the method entity() does only exist in the following sub-classes of samson\activerecord\dbQuery: samsonframework\orm\Query. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
50
        }
51
    }
52
53
54
    /** @deprecated Use QueryInterface implementation */
55
    public function own_limit($st, $en = 0)
0 ignored issues
show
Method name "dbQuery::own_limit" is not in camel caps format
Loading history...
56
    {
57
        $this->query->limit($st, $en);
58
59
        return $this;
60
    }
61
62
    /** @deprecated Use QueryInterface implementation */
63
    public function own_group_by($params)
0 ignored issues
show
Method name "dbQuery::own_group_by" is not in camel caps format
Loading history...
64
    {
65
        $this->query->groupBy($this->class_name, $params);
0 ignored issues
show
The call to QueryInterface::groupBy() has too many arguments starting with $params.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
66
67
        return $this;
68
    }
69
70
    /** @deprecated Use QueryInterface implementation */
71
    public function own_order_by($field, $direction = 'ASC')
0 ignored issues
show
Method name "dbQuery::own_order_by" is not in camel caps format
Loading history...
72
    {
73
        $this->query->orderBy($this->class_name, $field, $direction);
0 ignored issues
show
The call to QueryInterface::orderBy() has too many arguments starting with $direction.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
74
75
        return $this;
76
    }
77
78
    /** @see idbQuery::random() */
79
    public function random(& $return_value = null)
80
    {
81
        // Add random ordering
82
        $this->order_by('', 'RAND()');
0 ignored issues
show
Deprecated Code introduced by
The method samson\activerecord\dbQuery::order_by() has been deprecated with message: Use groupBy()

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
83
84
        // Correctly perform db request for multiple data
85
        return func_num_args() ? $this->exec($return_value) : $this->exec();
0 ignored issues
show
The call to dbQuery::exec() has too many arguments starting with $return_value.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
Deprecated Code introduced by
The method samson\activerecord\dbQuery::exec() has been deprecated with message: Use self::find()

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
86
    }
87
88
    /**
89
     * @param        $columnName
90
     * @param string $sorting
91
     *
92
     * @deprecated Use groupBy()
93
     * @return QueryInterface|static
94
     */
95
    public function order_by($columnName, $sorting = 'ASC')
0 ignored issues
show
Method name "dbQuery::order_by" is not in camel caps format
Loading history...
96
    {
97
        return $this->orderBy($this->metadata->tableName, $columnName, $sorting);
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class samson\activerecord\dbQuery as the method orderBy() does only exist in the following sub-classes of samson\activerecord\dbQuery: samsonframework\orm\Query. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
98
    }
99
100
    /**
101
     * Execute current query and receive collection of RecordInterface objects from database.
102
     * @deprecated Use self::find()
103
     * @return RecordInterface[] Database entities collection
104
     */
105
    public function exec() : array
106
    {
107
        return $this->find();
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class samson\activerecord\dbQuery as the method find() does only exist in the following sub-classes of samson\activerecord\dbQuery: samsonframework\orm\Query. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
108
    }
109
110
    /** @deprecated Use QueryInterface implementation */
111
    public function or_($relation = 'OR')
0 ignored issues
show
Method name "dbQuery::or_" is not in camel caps format
Loading history...
112
    {
113
        // Получим либо переданную группу условий, либо создадим новую, потом добавим её в массив групп условий запроса
114
        $cond_group = new Condition($relation);
115
116
        // Установим текущую группу условий с которой работает запрос
117
        $this->cConditionGroup = &$cond_group;
0 ignored issues
show
The property cConditionGroup does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
118
119
        // Добавим нову группу условий в коллекцию групп
120
        $this->condition->arguments[] = $cond_group;
0 ignored issues
show
The property condition does not seem to exist. Did you mean cConditionGroup?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
121
122
        // Вернем себя для цепирования
123
        return $this;
124
    }
125
126
    /** @deprecated Use QueryInterface implementation */
127
    public function debug($value = true)
128
    {
129
        db()->debug($this->debug = $value);
0 ignored issues
show
Deprecated Code introduced by
The function db() has been deprecated with message: Use dependency injection or generated class

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
130
131
        return $this;
132
    }
133
134
    /** @deprecated Use QueryInterface implementation */
135
    public function fieldsNew($fieldName, & $return = null)
0 ignored issues
show
The parameter $fieldName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $return is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
136
    {
137
        return call_user_func_array(array($this, 'fields'), func_get_args());
138
    }
139
140
    /** @deprecated Use QueryInterface implementation */
141
    public function group_by($field)
0 ignored issues
show
Method name "dbQuery::group_by" is not in camel caps format
Loading history...
142
    {
143
        $this->query->groupBy($this->metadata->tablename, $field);
0 ignored issues
show
The call to QueryInterface::groupBy() has too many arguments starting with $field.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
144
145
        // Вернем себя для цепирования
146
        return $this;
147
    }
148
149
    /** @deprecated Use QueryInterface implementation */
150
    public function add_field($field, $alias = null, $own = true)
0 ignored issues
show
Method name "dbQuery::add_field" is not in camel caps format
Loading history...
151
    {
152
        // Если передан псевдоним для поля, то подставим его
153
        if (isset($alias)) {
154
            $field = $field . ' as ' . $alias;
155
        } else {
156
            $alias = $field;
157
        }
158
159
        // Добавим виртуальное поле
160
        if ($own) {
161
            $this->own_virtual_fields[$alias] = $field;
162
        } else {
163
            $this->virtual_fields[$alias] = $field;
164
        }
165
166
        // Вернем себя для цепирования
167
        return $this;
168
    }
169
170
    /** @deprecated Use QueryInterface implementation */
171
    public function innerCount($field = '*')
0 ignored issues
show
The parameter $field is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
172
    {
173
        return $this->query->count();
174
    }
175
176
    /** @deprecated Use QueryInterface implementation */
177
    public function id($value)
178
    {
179
        $this->query->primary($value);
180
181
        return $this;
182
    }
183
184
    /**
185
     * Add condition to current query.
186
     * This method supports receives three possible types for $fieldName,
187
     * this is deprecated logic and this should be changed to use separate methods
188
     * for each argument type.
189
     *
190
     * @param string|ConditionInterface|ArgumentInterface $fieldName  Entity field name
191
     * @param string                                      $fieldValue Value
192
     * @param string                                      $relation   Relation between field name and its value
193
     *
194
     * @deprecated Use QueryInterface implementation
195
     * @return self Chaining
196
     */
197
    public function cond($fieldName, $fieldValue = null, $relation = '=')
198
    {
199
        // If empty array is passed
200
        if (is_string($fieldName)) {
201
            return $this->where($fieldName, $fieldValue, $relation);
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class samson\activerecord\dbQuery as the method where() does only exist in the following sub-classes of samson\activerecord\dbQuery: samsonframework\orm\Query. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
202
        } elseif (is_array($fieldValue) && !sizeof($fieldValue)) {
203
            $this->empty = true;
204
            return $this;
205
        } elseif ($fieldName instanceof ConditionInterface) {
206
            $this->whereCondition($fieldName);
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class samson\activerecord\dbQuery as the method whereCondition() does only exist in the following sub-classes of samson\activerecord\dbQuery: samsonframework\orm\Query. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
207
        } elseif ($fieldName instanceof ArgumentInterface) {
208
            $this->whereCondition((new Condition())->addArgument($fieldName));
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class samson\activerecord\dbQuery as the method whereCondition() does only exist in the following sub-classes of samson\activerecord\dbQuery: samsonframework\orm\Query. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
209
        }
210
211
        return $this;
212
    }
213
}
214