Issues (220)

src/Entity/SubscriptionInterface.php (1 issue)

Labels
Severity
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusMolliePlugin\Entity;
13
14
use Sylius\Component\Core\Model\OrderInterface;
0 ignored issues
show
This use statement conflicts with another class in this namespace, BitBag\SyliusMolliePlugin\Entity\OrderInterface. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
15
use Sylius\Component\Resource\Model\ResourceInterface;
16
17
interface SubscriptionInterface extends ResourceInterface
18
{
19
    public const STATE_NEW = 'new';
20
21
    public const STATE_PENDING = 'pending';
22
23
    public const STATE_ACTIVE = 'active';
24
25
    public const STATE_CANCELLED = 'cancelled';
26
27
    public const STATE_SUSPENDED = 'suspended';
28
29
    public const STATE_COMPLETED = 'completed';
30
31
    public function getOrder(): OrderInterface;
32
33
    public function setOrder(OrderInterface $order): void;
34
35
    public function getSubscriptionId(): ?string;
36
37
    public function setSubscriptionId(?string $subscriptionId): void;
38
39
    public function getCustomerId(): ?string;
40
41
    public function setCustomerId(?string $customerId): void;
42
43
    public function getState(): string;
44
45
    public function setState(string $state): void;
46
}
47