Giter VIP home page Giter VIP logo

Comments (4)

shochdoerfer avatar shochdoerfer commented on August 26, 2024

HI @kanduvisla I would think the problem could be using the shim version. The readme of the GitHub repo sates that they are using a "prefixed" version, so I think the namespaces might be different.

Mind checking with the non-shim version?

from phpstan-magento.

kanduvisla avatar kanduvisla commented on August 26, 2024

I'll check if I can get it to work with the non-shim version. In the meanwhile I did manage to find a fix for this issue when using the shim. I'm not sure if it's the best fix, but it might help others experiencing the same issue:

I've create a new file in the root of my module called phpstan.php:

<?php

declare(strict_types=1);

use bitExpert\PHPStan\Magento\Autoload\Autoloader;

// Since we're using the PHPStan Shim, we need to write a fix for the
// autoloader hack as defined by bitExpert/phpstan-magento:

Autoloader::register();

And in my phpstan.neon I've added the following line:

parameters:
    autoload_files:
        - phpstan.php

from phpstan-magento.

kanduvisla avatar kanduvisla commented on August 26, 2024

I've tested with the non-shim version and I can confirm that works fine without the fix. So this is an issue caused by using the shim. I think this ticket can be closed now.

The only thing I can think of is to add an update to the README for known issues when using the shim (and perhaps suggest this fix?)

from phpstan-magento.

shochdoerfer avatar shochdoerfer commented on August 26, 2024

Mind providing a fix for the readme then? ;)

from phpstan-magento.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.