silverleague / silverstripe-ideannotator

Generate docblocks for DataObjects, Page, PageControllers and (Data)Extensions
BSD 3-Clause "New" or "Revised" License
46 stars 25 forks source link

Error when running dev/build #117

Closed phyzical closed 5 years ago

phyzical commented 6 years ago

Strange one for some reason i think its unable to find files it should be able to?

dev/build completes but this error is still shown below the output

GET /dev/build?flushtoken=b0ca9d6852f5b8536f106e5d10fe3639&flush=1

Line 227 in /Users/phyzical/Sites/dasdasds/vendor/silverstripe/framework/src/Core/ClassInfo.php
Source

218         }
219 
220         $key = strtolower($nameOrObject);
221         if (!isset(static::$_cache_class_names[$key])) {
222             // Get manifest name
223             $name = ClassLoader::inst()->getManifest()->getItemName($nameOrObject);
224 
225             // Use reflection for non-manifest classes
226             if (!$name) {
227                 $reflection = new ReflectionClass($nameOrObject);
228                 $name = $reflection->getName();
229             }
230             static::$_cache_class_names[$key] = $name;
231         }
232 
233         return static::$_cache_class_names[$key];

Trace

    ReflectionClass->__construct(silverstripe\filesystem\storage\dbfile)
    ClassInfo.php:227
    SilverStripe\Core\ClassInfo::class_name(silverstripe\filesystem\storage\dbfile)
    DataObjectAnnotator.php:127
    SilverLeague\IDEAnnotator\DataObjectAnnotator->setupExtensionClasses()
    DataObjectAnnotator.php:89
    SilverLeague\IDEAnnotator\DataObjectAnnotator->__construct()
    ReflectionClass->newInstance()
    InjectionCreator.php:26
    SilverStripe\Core\Injector\InjectionCreator->create(SilverLeague\IDEAnnotator\DataObjectAnnotator, Array)
    Injector.php:585
    SilverStripe\Core\Injector\Injector->instantiate(Array, SilverLeague\IDEAnnotator\DataObjectAnnotator, singleton)
    Injector.php:993
    SilverStripe\Core\Injector\Injector->getNamedService(SilverLeague\IDEAnnotator\DataObjectAnnotator, 1, Array)
    Injector.php:946
    SilverStripe\Core\Injector\Injector->get(SilverLeague\IDEAnnotator\DataObjectAnnotator)
    Annotatable.php:81
    SilverLeague\IDEAnnotator\Extensions\Annotatable->setUp()
    Annotatable.php:56
    SilverLeague\IDEAnnotator\Extensions\Annotatable->afterCallActionHandler(SilverStripe\Control\HTTPRequest, build, HTTP/1.1 200 OK content-type: text/html; charset=utf-8 , , , , )
    Extensible.php:464
    SilverStripe\View\ViewableData->extend(afterCallActionHandler, SilverStripe\Control\HTTPRequest, build, HTTP/1.1 200 OK content-type: text/html; charset=utf-8 )
    RequestHandler.php:322
    SilverStripe\Control\RequestHandler->handleAction(SilverStripe\Control\HTTPRequest, build)
    Controller.php:284
    SilverStripe\Control\Controller->handleAction(SilverStripe\Control\HTTPRequest, build)
    RequestHandler.php:202
    SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest)
    Controller.php:212
    SilverStripe\Control\Controller->handleRequest(SilverStripe\Control\HTTPRequest)
    RequestHandler.php:226
    SilverStripe\Control\RequestHandler->handleRequest(SilverStripe\Control\HTTPRequest)
    Controller.php:212
    SilverStripe\Control\Controller->handleRequest(SilverStripe\Control\HTTPRequest)
    Director.php:361
    SilverStripe\Control\Director->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
    VersionedHTTPMiddleware.php:40
    SilverStripe\Versioned\VersionedHTTPMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    BasicAuthMiddleware.php:68
    SilverStripe\Security\BasicAuthMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    AuthenticationMiddleware.php:61
    SilverStripe\Security\AuthenticationMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    AkismetMiddleware.php:22
    SilverStripe\Akismet\Config\AkismetMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    CanonicalURLMiddleware.php:188
    SilverStripe\Control\Middleware\CanonicalURLMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    HTTPCacheControlMiddleware.php:42
    SilverStripe\Control\Middleware\HTTPCacheControlMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    ChangeDetectionMiddleware.php:27
    SilverStripe\Control\Middleware\ChangeDetectionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    FlushMiddleware.php:29
    SilverStripe\Control\Middleware\FlushMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    RequestProcessor.php:66
    SilverStripe\Control\RequestProcessor->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    SessionMiddleware.php:20
    SilverStripe\Control\Middleware\SessionMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    AllowedHostsMiddleware.php:60
    SilverStripe\Control\Middleware\AllowedHostsMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    TrustedProxyMiddleware.php:176
    SilverStripe\Control\Middleware\TrustedProxyMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\Director->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    HTTPMiddlewareAware.php:65
    SilverStripe\Control\Director->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
    Director.php:370
    SilverStripe\Control\Director->handleRequest(SilverStripe\Control\HTTPRequest)
    HTTPApplication.php:48
    SilverStripe\Control\HTTPApplication->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
    call_user_func(Closure, SilverStripe\Control\HTTPRequest)
    HTTPApplication.php:66
    SilverStripe\Control\HTTPApplication->SilverStripe\Control\{closure}(SilverStripe\Control\HTTPRequest)
    call_user_func(Closure, SilverStripe\Control\HTTPRequest)
    ErrorControlChainMiddleware.php:56
    SilverStripe\Core\Startup\ErrorControlChainMiddleware->SilverStripe\Core\Startup\{closure}(SilverStripe\Core\Startup\ErrorControlChain)
    call_user_func(Closure, SilverStripe\Core\Startup\ErrorControlChain)
    ErrorControlChain.php:236
    SilverStripe\Core\Startup\ErrorControlChain->step()
    ErrorControlChain.php:226
    SilverStripe\Core\Startup\ErrorControlChain->execute()
    ErrorControlChainMiddleware.php:69
    SilverStripe\Core\Startup\ErrorControlChainMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62
    SilverStripe\Control\HTTPApplication->SilverStripe\Control\Middleware\{closure}(SilverStripe\Control\HTTPRequest)
    HTTPMiddlewareAware.php:65
    SilverStripe\Control\HTTPApplication->callMiddleware(SilverStripe\Control\HTTPRequest, Closure)
    HTTPApplication.php:67
    SilverStripe\Control\HTTPApplication->execute(SilverStripe\Control\HTTPRequest, Closure, 1)
    HTTPApplication.php:49
    SilverStripe\Control\HTTPApplication->handle(SilverStripe\Control\HTTPRequest)
    index.php:26

the offending lines seem to be located in DataObjectAnnotator.php setupExtensionClasses() line 115 $extendableClasses had 814 items for me but i assume this is normal as it filters items out. All the classes are lowercase which i thought was strange but is probably normal also.

 $extendableClasses = Config::inst()->getAll();
        // We need to check all config to see if the class is extensible
        // @todo change this to a proper php array_walk or something method?
        foreach ($extendableClasses as $key => $configClass) {
            // If the class doesn't already exist in the extension classes
            // And the 'extensions' key is set in the config class
            // And the 'extensions' key actually contains values
            // Add it.
            if (!in_array(self::$extension_classes, $configClass, true) &&
                isset($configClass['extensions']) &&
                count($configClass['extensions']) > 0
            ) {
                $extension_classes[] = ClassInfo::class_name($key);
            }
        }

my composer.json as follows


    "name": "dsaasd",
    "license": "proprietary",
    "require": {
        "php": ">=5.6.0",
        "silverstripe/recipe-plugin": "1.3.0",
        "silverstripe/recipe-cms": "4.2.1",
        "symbiote/silverstripe-addressable": "^4.0.1"
    },
    "require-dev": {
        "squizlabs/php_codesniffer": "3.2.3",
        "phpunit/phpunit": "^5.7",
        "silverleague/ideannotator": "3.x-dev"
    },
    "extra": {
        "project-files": [
            "mysite/_config/*",
            ".env.example"
        ],
        "public-files": [
            "assets/*",
            "favicon.ico"
        ],
        "branch-alias": {
            "4.x-dev": "4.2.x-dev",
            "dev-master": "5.x-dev"
        },
        "project-files-installed": [
            "app/.htaccess",
            "app/_config.php",
            "app/_config/mysite.yml",
            "app/src/Page.php",
            "app/src/PageController.php",
            "mysite/.htaccess",
            "mysite/_config.php",
            "mysite/_config/mysite.yml",
            "mysite/code/Page.php",
            "mysite/code/PageController.php"
        ],
        "public-files-installed": [
            ".htaccess",
            "index.php",
            "install-frameworkmissing.html",
            "install.php",
            "web.config"
        ]
    },
    "config": {
        "process-timeout": 600
    },
    "prefer-stable": true,
    "minimum-stability": "dev"

hopefully you can replicate

let me know if you need any more info

robbieaverill commented 6 years ago

Would you mind trying the changes in #116 and see if that helps? I made some bug fixes and improvements there which could help with this issue

Firesphere commented 6 years ago

Is this still happening if you check out the master branch?

phyzical commented 6 years ago

hey @Firesphere i tested robbies changes on his fork back when he first asked and it seemed to solve my issues.

unfortunately installing dev-master at commit 2400b06 and running tests or dev build still have issues

Firesphere commented 6 years ago

That's strange, because I merged in #116 , Is it the same error?

phyzical commented 6 years ago

i just tried dev-master again and yeah its still present and the exact same error i originally listed

i feel as if im testing the changes wrong? the other notice thrown during tests is still present too.

using dev-master composer tag should include the changes ye?

Firesphere commented 6 years ago

I can't seem to reproduce this, what extensions do you have applied (especially the addressable module?)

phyzical commented 6 years ago

composer.json`is in original app.yml

Name: app
---
SilverStripe\Core\Manifest\ModuleManifest:
  project: app

SilverStripe\View\Requirements_Backend:
  combine_in_dev: false

Symbiote\Addressable\Addressable:
  allowed_countries:
    au: 'Australia'
  allowed_states:
    vic: 'Victoria'
    nsw: 'New South Wales'
    sa: 'South Australia'
    wa: 'Western Australia'
    qld: 'Queensland'
    tas: 'Tasmania'

---
Only:
    environment: 'dev'
---
SilverLeague\IDEAnnotator\DataObjectAnnotator:
    enabled: true
    enabled_modules:
      - app

let me know if there is anything else i can provide

Firesphere commented 6 years ago

Do you have a model or pagetype that has a relation to DBFile? If so, could you try and change the DBFile to just read File?

phyzical commented 6 years ago

ive tried across 2 projects cant seem to see any DBFile references from my code.

ill try a blank project to try and isolate these issues to something in my setups.

phyzical commented 6 years ago

Confirmed this bug was related to my code. had an extension being applied to DBFile oops.

But https://github.com/silverleague/silverstripe-ideannotator/issues/118 seems to still be present on dev-master?

robbieaverill commented 5 years ago

I've merged up the branches, that should resolve the missing changes from #118 in master. Thanks for raising the issue, sounds like it's resolved in your project code now so I'll close.