1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | namespace Phauthentic\Authentication\Identifier\Resolver; |
||
4 | |||
5 | use ArrayAccess; |
||
6 | use Authentication\Identifier\Resolver\ResolverInterface; |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
Phauthentic\Authenticati...olver\ResolverInterface . Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
|
|||
7 | use Cake\Core\InstanceConfigTrait; |
||
8 | use Cake\ORM\Locator\LocatorAwareTrait; |
||
9 | |||
10 | class OrmResolver implements ResolverInterface |
||
11 | { |
||
12 | |||
13 | use InstanceConfigTrait; |
||
14 | use LocatorAwareTrait; |
||
15 | |||
16 | /** |
||
17 | * Default configuration. |
||
18 | * - `userModel` The alias for users table, defaults to Users. |
||
19 | * - `finder` The finder method to use to fetch user record. Defaults to 'all'. |
||
20 | * You can set finder name as string or an array where key is finder name and value |
||
21 | * is an array passed to `Table::find()` options. |
||
22 | * E.g. ['finderName' => ['some_finder_option' => 'some_value']] |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $_defaultConfig = [ |
||
27 | 'userModel' => 'Users', |
||
28 | 'finder' => 'all', |
||
29 | ]; |
||
30 | |||
31 | protected $_config; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param array $config Config array. |
||
37 | */ |
||
38 | 5 | public function __construct(array $config = []) |
|
39 | { |
||
40 | 5 | $this->setConfig($config); |
|
41 | 5 | } |
|
42 | |||
43 | /** |
||
44 | * {@inheritDoc} |
||
45 | */ |
||
46 | 5 | public function find(array $conditions): ?ArrayAccess |
|
47 | { |
||
48 | 5 | $table = $this->getTableLocator()->get($this->getConfig('userModel')); |
|
49 | |||
50 | 5 | $query = $table->query(); |
|
51 | 5 | $finders = (array)$this->getConfig('finder'); |
|
52 | 5 | foreach ($finders as $finder => $options) { |
|
53 | 5 | if (is_string($options)) { |
|
54 | 5 | $query->find($options); |
|
55 | } else { |
||
56 | 5 | $query->find($finder, $options); |
|
57 | } |
||
58 | } |
||
59 | |||
60 | 5 | $where = []; |
|
61 | 5 | foreach ($conditions as $field => $value) { |
|
62 | 5 | $field = $table->aliasField($field); |
|
63 | 5 | if (is_array($value)) { |
|
64 | 1 | $field = $field . ' IN'; |
|
65 | } |
||
66 | 5 | $where[$field] = $value; |
|
67 | } |
||
68 | |||
69 | 5 | return $query->where($where)->first(); |
|
70 | } |
||
71 | } |
||
72 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths