diff --git a/Block/Adminhtml/System/Config/DeploymentConfigInfo.php b/Block/Adminhtml/System/Config/DeploymentConfigInfo.php index 534de17..17c546d 100644 --- a/Block/Adminhtml/System/Config/DeploymentConfigInfo.php +++ b/Block/Adminhtml/System/Config/DeploymentConfigInfo.php @@ -9,11 +9,6 @@ class DeploymentConfigInfo extends Field { - /** - * @var Version - */ - private $version; - /** * @var string */ @@ -28,10 +23,9 @@ class DeploymentConfigInfo extends Field */ public function __construct( Context $context, - Version $version, + private Version $version, array $data = [] ) { - $this->version = $version; parent::__construct($context, $data); } diff --git a/Block/SentryScript.php b/Block/SentryScript.php index 9926822..c35b1ef 100644 --- a/Block/SentryScript.php +++ b/Block/SentryScript.php @@ -11,21 +11,6 @@ class SentryScript extends Template { const CURRENT_VERSION = '7.39.0'; - /** - * @var DataHelper - */ - private $dataHelper; - - /** - * @var Version - */ - private $version; - - /** - * @var Json - */ - private $json; - /** * SentryScript constructor. * @@ -34,16 +19,12 @@ class SentryScript extends Template * @param array $data */ public function __construct( - DataHelper $dataHelper, - Version $version, + private DataHelper $dataHelper, + private Version $version, Template\Context $context, - Json $json, + private Json $json, array $data = [] ) { - $this->dataHelper = $dataHelper; - $this->version = $version; - $this->json = $json; - parent::__construct($context, $data); } diff --git a/Controller/Adminhtml/Test/Sentry.php b/Controller/Adminhtml/Test/Sentry.php index ad78dc0..3c5479a 100755 --- a/Controller/Adminhtml/Test/Sentry.php +++ b/Controller/Adminhtml/Test/Sentry.php @@ -3,7 +3,6 @@ namespace JustBetter\Sentry\Controller\Adminhtml\Test; use JustBetter\Sentry\Helper\Data; -use JustBetter\Sentry\Model\SentryLog; use JustBetter\Sentry\Plugin\MonologPlugin; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; @@ -20,29 +19,6 @@ class Sentry extends Action */ const ADMIN_RESOURCE = 'JustBetter_Sentry::sentry'; - /** - * @var PageFactory - */ - protected $resultPageFactory; - - /** - * @var LoggerInterface - */ - protected $logger; - - /** - * @var Json - */ - private $jsonSerializer; - /** - * @var Data - */ - private $helperSentry; - /** - * @var \JustBetter\Sentry\Model\SentryLog|SentryLog - */ - private $monologPlugin; - /** * Sentry constructor. * @@ -55,18 +31,12 @@ class Sentry extends Action */ public function __construct( Context $context, - PageFactory $resultPageFactory, - Json $jsonSerializer, - LoggerInterface $logger, - Data $helperSentry, - MonologPlugin $monologPlugin + protected PageFactory $resultPageFactory, + private Json $jsonSerializer, + protected LoggerInterface $logger, + private Data $helperSentry, + private MonologPlugin $monologPlugin ) { - $this->resultPageFactory = $resultPageFactory; - $this->jsonSerializer = $jsonSerializer; - $this->logger = $logger; - $this->helperSentry = $helperSentry; - $this->monologPlugin = $monologPlugin; - parent::__construct($context); } diff --git a/Helper/Data.php b/Helper/Data.php index e4890b3..01d2e58 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -24,31 +24,11 @@ class Data extends AbstractHelper const XML_PATH_SRS = 'sentry/general/'; const XML_PATH_SRS_ISSUE_GROUPING = 'sentry/issue_grouping/'; - /** - * @var StoreManagerInterface - */ - protected $storeManager; - - /** - * @var State - */ - protected $appState; - /** * @var ScopeConfigInterface */ protected $scopeConfig; - /** - * @var ProductMetaDataInterface - */ - protected $productMetadataInterface; - - /** - * @var DeploymentConfig - */ - protected $deploymentConfig; - /** * @var array */ @@ -70,10 +50,6 @@ class Data extends AbstractHelper 'tracing_sample_rate', 'ignore_js_errors', ]; - /** - * @var Json - */ - private $serializer; /** * Data constructor. @@ -87,18 +63,13 @@ class Data extends AbstractHelper */ public function __construct( Context $context, - StoreManagerInterface $storeManager, - State $appState, - Json $serializer, - ProductMetadataInterface $productMetadataInterface, - DeploymentConfig $deploymentConfig + protected StoreManagerInterface $storeManager, + protected State $appState, + private Json $serializer, + protected ProductMetadataInterface $productMetadataInterface, + protected DeploymentConfig $deploymentConfig ) { - $this->storeManager = $storeManager; - $this->appState = $appState; $this->scopeConfig = $context->getScopeConfig(); - $this->productMetadataInterface = $productMetadataInterface; - $this->deploymentConfig = $deploymentConfig; - $this->serializer = $serializer; $this->collectModuleConfig(); parent::__construct($context); diff --git a/Helper/Version.php b/Helper/Version.php index de7cd51..41923b7 100644 --- a/Helper/Version.php +++ b/Helper/Version.php @@ -13,16 +13,6 @@ */ class Version extends AbstractHelper { - /** - * @var \Magento\Framework\App\State - */ - private $appState; - - /** - * @var \Magento\Framework\App\View\Deployment\Version\StorageInterface - */ - private $versionStorage; - /** * @var string */ @@ -44,12 +34,10 @@ class Version extends AbstractHelper * @param DeploymentConfig|null $deploymentConfig */ public function __construct( - \Magento\Framework\App\State $appState, - \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage, + private \Magento\Framework\App\State $appState, + private \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage, DeploymentConfig $deploymentConfig = null ) { - $this->appState = $appState; - $this->versionStorage = $versionStorage; $this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class); } diff --git a/Model/ReleaseIdentifier.php b/Model/ReleaseIdentifier.php index 1cc759f..f3b34c7 100644 --- a/Model/ReleaseIdentifier.php +++ b/Model/ReleaseIdentifier.php @@ -8,20 +8,14 @@ class ReleaseIdentifier { - /** - * @var Version - */ - private $version; - /** * ReleaseIdentifier constructor. * * @param Version $version */ public function __construct( - Version $version + private Version $version ) { - $this->version = $version; } /** diff --git a/Model/SentryLog.php b/Model/SentryLog.php index 1000ebc..691cd72 100755 --- a/Model/SentryLog.php +++ b/Model/SentryLog.php @@ -13,24 +13,11 @@ class SentryLog extends Monolog { - /** - * @var Data - */ - protected $data; - - /** - * @var Session - */ - protected $customerSession; - /** * @var array */ protected $config = []; - /** @var State */ - private $appState; - /** * SentryLog constructor. * @@ -42,17 +29,13 @@ class SentryLog extends Monolog */ public function __construct( $name, - Data $data, - Session $customerSession, - State $appState, + protected Data $data, + protected Session $customerSession, + private State $appState, private SentryInteraction $sentryInteraction, array $handlers = [], array $processors = [] ) { - $this->data = $data; - $this->customerSession = $customerSession; - $this->appState = $appState; - parent::__construct($name, $handlers, $processors); } diff --git a/Plugin/GlobalExceptionCatcher.php b/Plugin/GlobalExceptionCatcher.php index 8756a61..8f53f35 100755 --- a/Plugin/GlobalExceptionCatcher.php +++ b/Plugin/GlobalExceptionCatcher.php @@ -13,21 +13,6 @@ class GlobalExceptionCatcher { - /** @var SenteryHelper */ - protected $sentryHelper; - - /** @var ReleaseIdentifier */ - private $releaseIdentifier; - - /** @var SentryInteraction */ - private $sentryInteraction; - - /** @var EventManagerInterface */ - private $eventManager; - - /** @var DataObjectFactory */ - private $dataObjectFactory; - /** * ExceptionCatcher constructor. * @@ -38,17 +23,12 @@ class GlobalExceptionCatcher * @param DataObjectFactory $dataObjectFactory */ public function __construct( - SenteryHelper $sentryHelper, - ReleaseIdentifier $releaseIdentifier, - SentryInteraction $sentryInteraction, - EventManagerInterface $eventManager, - DataObjectFactory $dataObjectFactory + protected SenteryHelper $sentryHelper, + private ReleaseIdentifier $releaseIdentifier, + private SentryInteraction $sentryInteraction, + private EventManagerInterface $eventManager, + private DataObjectFactory $dataObjectFactory ) { - $this->sentryHelper = $sentryHelper; - $this->releaseIdentifier = $releaseIdentifier; - $this->sentryInteraction = $sentryInteraction; - $this->eventManager = $eventManager; - $this->dataObjectFactory = $dataObjectFactory; } public function aroundLaunch(AppInterface $subject, callable $proceed) diff --git a/Plugin/LogrocketCustomerInfo.php b/Plugin/LogrocketCustomerInfo.php index 51946df..e7daeda 100644 --- a/Plugin/LogrocketCustomerInfo.php +++ b/Plugin/LogrocketCustomerInfo.php @@ -8,15 +8,10 @@ class LogrocketCustomerInfo { - protected $currentCustomer; - protected $customerSession; - public function __construct( - CurrentCustomer $currentCustomer, - Session $session + protected CurrentCustomer $currentCustomer, + protected Session $customerSession ) { - $this->currentCustomer = $currentCustomer; - $this->customerSession = $session; } public function afterGetSectionData(Customer $subject, $result) diff --git a/Plugin/MonologPlugin.php b/Plugin/MonologPlugin.php index 832e569..416ed2b 100755 --- a/Plugin/MonologPlugin.php +++ b/Plugin/MonologPlugin.php @@ -10,36 +10,17 @@ class MonologPlugin extends Monolog { - /** - * @var Data - */ - protected $sentryHelper; - - /** - * @var SentryLog - */ - protected $sentryLog; - - /** - * @var DeploymentConfig - */ - protected $deploymentConfig; - /** * {@inheritdoc} */ public function __construct( $name, - Data $data, - SentryLog $sentryLog, - DeploymentConfig $deploymentConfig, + protected Data $sentryHelper, + protected SentryLog $sentryLog, + protected DeploymentConfig $deploymentConfig, array $handlers = [], array $processors = [] ) { - $this->sentryHelper = $data; - $this->sentryLog = $sentryLog; - $this->deploymentConfig = $deploymentConfig; - parent::__construct($name, $handlers, $processors); } diff --git a/composer.json b/composer.json index 8e78730..0bf93a6 100755 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "version": "3.5.2", "license": "MIT", "require": { - "php": ">=7.0", + "php": ">=8.0", "sentry/sdk": "^3.0", "monolog/monolog": ">=2.7.0", "magento/framework": "*",