1 | <?php |
||
26 | final class QuoteProcessor implements DelimiterProcessorInterface |
||
27 | { |
||
28 | /** @var CoreProcessor */ |
||
29 | private $coreProcessor; |
||
30 | |||
31 | 4 | private function __construct(CoreProcessor $coreProcessor) |
|
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 4 | public function getOpeningCharacter(): string |
|
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 4 | public function getClosingCharacter(): string |
|
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 4 | public function getMinLength(): int |
|
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | 4 | public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 4 | public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) |
|
76 | |||
77 | /** |
||
78 | * Create a double-quote processor |
||
79 | * |
||
80 | * @param string $opener |
||
81 | * @param string $closer |
||
82 | * |
||
83 | * @return QuoteProcessor |
||
84 | */ |
||
85 | 2 | public static function createDoubleQuoteProcessor(string $opener = Quote::DOUBLE_QUOTE_OPENER, string $closer = Quote::DOUBLE_QUOTE_CLOSER): self |
|
89 | |||
90 | /** |
||
91 | * Create a single-quote processor |
||
92 | * |
||
93 | * @param string $opener |
||
94 | * @param string $closer |
||
95 | * |
||
96 | * @return QuoteProcessor |
||
97 | */ |
||
98 | 2 | public static function createSingleQuoteProcessor(string $opener = Quote::SINGLE_QUOTE_OPENER, string $closer = Quote::SINGLE_QUOTE_CLOSER): self |
|
102 | } |
||
103 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/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 beforeOtherDir/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: