Conditions | 4 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | function getMatchers() |
||
40 | { |
||
41 | return [ |
||
42 | 'beAContainerWithParent' => function($subject) { |
||
43 | if (!$subject instanceof ContainerInterface) { |
||
|
|||
44 | throw new FailureException( |
||
45 | "Returned value should be a ContainerInterface, but it was not!" |
||
46 | ); |
||
47 | } |
||
48 | |||
49 | if (!$subject->has('isParent') || $subject->get('isParent') !== true) { |
||
50 | throw new FailureException( |
||
51 | "The returned container must have a parent that is created form ". |
||
52 | "services path passed when creating the application. This container ". |
||
53 | "was not properly created." |
||
54 | |||
55 | ); |
||
56 | } |
||
57 | return true; |
||
58 | } |
||
59 | ]; |
||
60 | } |
||
61 | } |
||
62 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.