Namespaces not properly working after using php-scoper

56 views Asked by At

My plugin was having conflict with the other plugin if it was using google library in Wordpress. Previously my vendor folder was namespace by prefix Analytify using php-scoper excluding the namespaces Composer, Grpc and Google I worked around the solution and then I exclude three more namespaces that were Guzzlehttp, Monology, and Psr and by this the conflict was totally resolved. But now I was making the entire vendor namespace to MyPlugin so that it is totally containerized but then I get following errors in my plugin and I have looked into them and all the mentioned classes are properly namespace by MyPlugin but it is saying not found. The errors are:

WARNING MyPlugin\Google\Analytics\Admin\V1alpha\DataStream is not found in descriptor pool. Only generated classes may derive from Message

WARNING MyPlugin\Google\Analytics\Admin\V1alpha\ListDataStreamsRequest is not found in descriptor pool

WARNING (query) missing required param: 'siteUrl'

WARNING MyPlugin\Google\Analytics\Admin\V1alpha\ListAccountsRequest is not found in descriptor pool

WARNING MyPlugin\Google\Analytics\Admin\V1alpha\ListAccountsRequest is not found in descriptor pool

Now I want a way to solve this because I have checked the classes are namespace properly but it is showing not found. Any clue to fix it?

My scoper.inc.php file is

<?php

declare (strict_types=1);
namespace MyPlugin;

// scoper.inc.php
use MyPlugin\Isolated\Symfony\Component\Finder\Finder;
return [
    'prefix' => 'MyPlugin',
    // string|null
    'output-dir' => null,
    // string|null
    'finders' => [],
    // list<Finder>
    'patchers' => [],
    // list<callable(string $filePath, string $prefix, string $contents): string>
    'exclude-files' => [],
    // list<string>
    'exclude-namespaces' => [],
    // list<string|regex>
    'exclude-constants' => [],
    // list<string|regex>
    'exclude-classes' => [],
    // list<string|regex>
    'exclude-functions' => [],
    // list<string|regex>
    'expose-global-constants' => \false,
    // bool
    'expose-global-classes' => \false,
    // bool
    'expose-global-functions' => \false,
    // bool
    'expose-namespaces' => [],
    // list<string|regex>
    'expose-constants' => [],
    // list<string|regex>
    'expose-classes' => [],
    // list<string|regex>
    'expose-functions' => [],
];

Also a guidance needed that is excluding the namespaces on which error occurs is better or just namespace entire vendor that contains Google Libraries for php

0

There are 0 answers