vimeo /
psalm
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | namespace Psalm; |
||
| 3 | |||
| 4 | use Psalm\Plugin\Hook; |
||
| 5 | use Psalm\Plugin\RegistrationInterface; |
||
| 6 | use function class_exists; |
||
| 7 | use function is_subclass_of; |
||
| 8 | |||
| 9 | class PluginRegistrationSocket implements RegistrationInterface |
||
| 10 | { |
||
| 11 | /** @var Config */ |
||
| 12 | private $config; |
||
| 13 | |||
| 14 | /** @var Codebase */ |
||
| 15 | private $codebase; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @internal |
||
| 19 | */ |
||
| 20 | public function __construct(Config $config, Codebase $codebase) |
||
| 21 | { |
||
| 22 | $this->config = $config; |
||
| 23 | $this->codebase = $codebase; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** @return void */ |
||
| 27 | public function addStubFile(string $file_name) |
||
| 28 | { |
||
| 29 | $this->config->addStubFile($file_name); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return void |
||
| 34 | */ |
||
| 35 | public function registerHooksFromClass(string $handler) |
||
| 36 | { |
||
| 37 | if (!class_exists($handler, false)) { |
||
| 38 | throw new \InvalidArgumentException('Plugins must be loaded before registration'); |
||
| 39 | } |
||
| 40 | |||
| 41 | if (is_subclass_of($handler, Hook\AfterMethodCallAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 42 | $this->config->after_method_checks[$handler] = $handler; |
||
| 43 | } |
||
| 44 | |||
| 45 | if (is_subclass_of($handler, Hook\AfterFunctionCallAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 46 | $this->config->after_function_checks[$handler] = $handler; |
||
| 47 | } |
||
| 48 | |||
| 49 | if (is_subclass_of($handler, Hook\AfterEveryFunctionCallAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 50 | $this->config->after_every_function_checks[$handler] = $handler; |
||
| 51 | } |
||
| 52 | |||
| 53 | if (is_subclass_of($handler, Hook\AfterExpressionAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 54 | $this->config->after_expression_checks[$handler] = $handler; |
||
| 55 | } |
||
| 56 | |||
| 57 | if (is_subclass_of($handler, Hook\AfterStatementAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 58 | $this->config->after_statement_checks[$handler] = $handler; |
||
| 59 | } |
||
| 60 | |||
| 61 | if (is_subclass_of($handler, Hook\AfterClassLikeExistenceCheckInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 62 | $this->config->after_classlike_exists_checks[$handler] = $handler; |
||
| 63 | } |
||
| 64 | |||
| 65 | if (is_subclass_of($handler, Hook\AfterClassLikeAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 66 | $this->config->after_classlike_checks[$handler] = $handler; |
||
| 67 | } |
||
| 68 | |||
| 69 | if (is_subclass_of($handler, Hook\AfterClassLikeVisitInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 70 | $this->config->after_visit_classlikes[$handler] = $handler; |
||
| 71 | } |
||
| 72 | |||
| 73 | if (is_subclass_of($handler, Hook\AfterCodebasePopulatedInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 74 | $this->config->after_codebase_populated[$handler] = $handler; |
||
| 75 | } |
||
| 76 | |||
| 77 | if (is_subclass_of($handler, Hook\PropertyExistenceProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 78 | $this->codebase->properties->property_existence_provider->registerClass($handler); |
||
| 79 | } |
||
| 80 | |||
| 81 | if (is_subclass_of($handler, Hook\PropertyVisibilityProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 82 | $this->codebase->properties->property_visibility_provider->registerClass($handler); |
||
| 83 | } |
||
| 84 | |||
| 85 | if (is_subclass_of($handler, Hook\PropertyTypeProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 86 | $this->codebase->properties->property_type_provider->registerClass($handler); |
||
| 87 | } |
||
| 88 | |||
| 89 | if (is_subclass_of($handler, Hook\MethodExistenceProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 90 | $this->codebase->methods->existence_provider->registerClass($handler); |
||
| 91 | } |
||
| 92 | |||
| 93 | if (is_subclass_of($handler, Hook\MethodVisibilityProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 94 | $this->codebase->methods->visibility_provider->registerClass($handler); |
||
| 95 | } |
||
| 96 | |||
| 97 | if (is_subclass_of($handler, Hook\MethodReturnTypeProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 98 | $this->codebase->methods->return_type_provider->registerClass($handler); |
||
| 99 | } |
||
| 100 | |||
| 101 | if (is_subclass_of($handler, Hook\MethodParamsProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 102 | $this->codebase->methods->params_provider->registerClass($handler); |
||
| 103 | } |
||
| 104 | |||
| 105 | if (is_subclass_of($handler, Hook\FunctionExistenceProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 106 | $this->codebase->functions->existence_provider->registerClass($handler); |
||
| 107 | } |
||
| 108 | |||
| 109 | if (is_subclass_of($handler, Hook\FunctionParamsProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 110 | $this->codebase->functions->params_provider->registerClass($handler); |
||
| 111 | } |
||
| 112 | |||
| 113 | if (is_subclass_of($handler, Hook\FunctionReturnTypeProviderInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 114 | $this->codebase->functions->return_type_provider->registerClass($handler); |
||
| 115 | } |
||
| 116 | |||
| 117 | if (is_subclass_of($handler, Hook\AfterAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 118 | $this->config->after_analysis[$handler] = $handler; |
||
| 119 | } |
||
| 120 | |||
| 121 | if (is_subclass_of($handler, Hook\StringInterpreterInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 122 | $this->config->string_interpreters[$handler] = $handler; |
||
| 123 | } |
||
| 124 | |||
| 125 | if (is_subclass_of($handler, Hook\AfterFunctionLikeAnalysisInterface::class)) { |
||
|
0 ignored issues
–
show
|
|||
| 126 | $this->config->after_functionlike_checks[$handler] = $handler; |
||
| 127 | } |
||
| 128 | } |
||
| 129 | } |
||
| 130 |