Skip to content

Some reported PHPstan issues #262

@hostep

Description

@hostep

Environment details

Klaviyo extension version: 4.0.12

Steps to reproduce

Run from inside a Magento shop:

$ vendor/bin/phpstan clear-result-cache && bin/magento setup:di:compile && vendor/bin/phpstan analyse --level=0 vendor/klaviyo

Expected result

Ideally we should see 0 problems

Actual result

We find a couple of small issues in the code that should be able to be resolved easily:

 ------ ---------------------------------------------------------------------
  Line   magento2-extension/Observer/KlaviyoOAuthObserver.php
 ------ ---------------------------------------------------------------------
  88     Caught class Klaviyo\Reclaim\Observer\Exception not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
 ------ ---------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------------------------
  Line   magento2-extension/Test/Fakes/RadioBtnFake.php
 ------ ----------------------------------------------------------------------------------------------------------------------------------
  5      Class Klaviyo\Reclaim\Model\Config\Source\Radiobtn referenced with incorrect case: Klaviyo\Reclaim\Model\Config\Source\RadioBtn.
  7      Class Klaviyo\Reclaim\Model\Config\Source\Radiobtn referenced with incorrect case: Klaviyo\Reclaim\Model\Config\Source\RadioBtn.
 ------ ----------------------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------
  Line   magento2-extension/Test/Unit/Helper/ScopeSettingTest.php
 ------ -------------------------------------------------------------------------------------
  61     Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_USERNAME.
  64     Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_PASSWORD.
  67     Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_EMAIL.
  103    Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_USERNAME.
  104    Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_PASSWORD.
  105    Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_EMAIL.
  119    Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_USERNAME.
  122    Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_PASSWORD.
  125    Access to undefined constant Klaviyo\Reclaim\Helper\ScopeSetting::KLAVIYO_EMAIL.
 ------ -------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------
  Line   magento2-extension/Test/Unit/Observer/UserProfileNewsletterSubscribeObserverTest.php
 ------ -----------------------------------------------------------------------------------------------
  49     Instantiated class Klaviyo\Reclaim\Observer\UserProfileNewsletterSubscribeObserver not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
  58     Class Klaviyo\Reclaim\Observer\UserProfileNewsletterSubscribeObserver not found.
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
 ------ -----------------------------------------------------------------------------------------------

Additional information

Maybe consider adding a static analyser check (like phpstan) to your automated test checks so code quality stays high all the time?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions