diff --git a/phpstan.neon b/phpstan.neon index 77e6353..ced2469 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,16 +1,14 @@ parameters: reportUnmatchedIgnoredErrors: false checkMissingIterableValueType: false + level: 8 - excludes_analyse: + paths: + - 'src' + + excludePaths: # Makes PHPStan crash - 'src/DependencyInjection/Configuration.php' - # Test dependencies - - 'tests/Application/*' - - # ECS Fixer dependency - - 'src/Fixer' - ignoreErrors: - '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./' diff --git a/src/Api/WebClient.php b/src/Api/WebClient.php index daccfd4..2de43d9 100644 --- a/src/Api/WebClient.php +++ b/src/Api/WebClient.php @@ -19,11 +19,9 @@ final class WebClient implements WebClientInterface { public const DATE_FORMAT = 'Y-m-d'; - /** @var ShippingGatewayInterface */ - private $shippingGateway; + private ShippingGatewayInterface $shippingGateway; - /** @var ShipmentInterface */ - private $shipment; + private ShipmentInterface $shipment; public function setShippingGateway(ShippingGatewayInterface $shippingGateway): void { @@ -123,14 +121,6 @@ public function getPickupAddress(): array { return [ 'fid' => $this->getShippingGatewayConfig('id'), -// 'name' => 'NAME', -// 'company' => 'COMPANY', -// 'address' => 'ADDRESS', -// 'city' => 'CITY', -// 'postalCode' => '85132', -// 'countryCode' => 'PL', -// 'email'=> 'test@test.test', -// 'phone' => '777888999', ]; } @@ -214,8 +204,7 @@ private function resolveWeekend(\DateTime $date): \DateTime return $date; } - /** @return mixed */ - private function getShippingGatewayConfig(string $config) + private function getShippingGatewayConfig(string $config): mixed { return $this->shippingGateway->getConfigValue($config); } diff --git a/src/EventListener/ShippingExportEventListener.php b/src/EventListener/ShippingExportEventListener.php index 781cfa7..33f4c24 100644 --- a/src/EventListener/ShippingExportEventListener.php +++ b/src/EventListener/ShippingExportEventListener.php @@ -18,6 +18,7 @@ use Sylius\Bundle\ResourceBundle\Event\ResourceControllerEvent; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Session\Session; use Webmozart\Assert\Assert; final class ShippingExportEventListener @@ -26,19 +27,15 @@ final class ShippingExportEventListener public const BASE_LABEL_EXTENSION = 'pdf'; - /** @var WebClientInterface */ - private $webClient; + private WebClientInterface $webClient; private RequestStack $requestStack; - /** @var Filesystem */ - private $fileSystem; + private Filesystem $fileSystem; - /** @var ObjectManager */ - private $shippingExportManager; + private ObjectManager $shippingExportManager; - /** @var string */ - private $shippingLabelsPath; + private string $shippingLabelsPath; public function __construct( WebClientInterface $webClient, @@ -74,6 +71,7 @@ public function exportShipment(ResourceControllerEvent $exportShipmentEvent): vo Assert::notNull($shipment); $this->webClient->setShipment($shipment); + /** @var Session $session */ $session = $this->requestStack->getSession(); try {