Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mpysiak committed Oct 23, 2023
1 parent d40c5e1 commit 4f97481
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 29 deletions.
12 changes: 5 additions & 7 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -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\./'
17 changes: 3 additions & 14 deletions src/Api/WebClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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'=> '[email protected]',
// 'phone' => '777888999',
];
}

Expand Down Expand Up @@ -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);
}
Expand Down
14 changes: 6 additions & 8 deletions src/EventListener/ShippingExportEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4f97481

Please sign in to comment.