@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function assertRegExp(string $pattern, string $string, string $message = ''): void |
21 | 21 | { |
22 | - if (\method_exists(Assert::class, 'assertMatchesRegularExpression')) { |
|
22 | + if (\method_exists(Assert::class, 'assertMatchesRegularExpression')){ |
|
23 | 23 | Assert::assertMatchesRegularExpression($pattern, $string, $message); |
24 | 24 | |
25 | 25 | return; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function assertNotRegExp(string $pattern, string $string, string $message = ''): void |
37 | 37 | { |
38 | - if (\method_exists(Assert::class, 'assertDoesNotMatchRegularExpression')) { |
|
38 | + if (\method_exists(Assert::class, 'assertDoesNotMatchRegularExpression')){ |
|
39 | 39 | Assert::assertDoesNotMatchRegularExpression($pattern, $string, $message); |
40 | 40 | |
41 | 41 | return; |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function assertRegExp(string $pattern, string $string, string $message = ''): void |
21 | 21 | { |
22 | - if (\method_exists(Assert::class, 'assertMatchesRegularExpression')) { |
|
22 | + if (\method_exists(Assert::class, 'assertMatchesRegularExpression')) |
|
23 | + { |
|
23 | 24 | Assert::assertMatchesRegularExpression($pattern, $string, $message); |
24 | 25 | |
25 | 26 | return; |
@@ -35,7 +36,8 @@ discard block |
||
35 | 36 | */ |
36 | 37 | public static function assertNotRegExp(string $pattern, string $string, string $message = ''): void |
37 | 38 | { |
38 | - if (\method_exists(Assert::class, 'assertDoesNotMatchRegularExpression')) { |
|
39 | + if (\method_exists(Assert::class, 'assertDoesNotMatchRegularExpression')) |
|
40 | + { |
|
39 | 41 | Assert::assertDoesNotMatchRegularExpression($pattern, $string, $message); |
40 | 42 | |
41 | 43 | return; |
@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | |
28 | 28 | public function setUp(): void |
29 | 29 | { |
30 | - if ((string)ini_get('zend.assertions') === 1) { |
|
30 | + if ((string)ini_get('zend.assertions') === 1) |
|
31 | + { |
|
31 | 32 | ini_set('zend.assertions', 0); |
32 | 33 | } |
33 | 34 | } |
@@ -75,15 +76,21 @@ discard block |
||
75 | 76 | $noPhpDoc |
76 | 77 | ); |
77 | 78 | |
78 | - if ($expectedTypedProperty) { |
|
79 | + if ($expectedTypedProperty) |
|
80 | + { |
|
79 | 81 | $this->assertStringContainsString('private TestClass $testClass;', $printed); |
80 | - } else { |
|
82 | + } |
|
83 | + else |
|
84 | + { |
|
81 | 85 | $this->assertStringNotContainsString('private TestClass $testClass;', $printed); |
82 | 86 | } |
83 | 87 | |
84 | - if ($expectedPhpDoc) { |
|
88 | + if ($expectedPhpDoc) |
|
89 | + { |
|
85 | 90 | $this->assertRegExp('/@var TestClass[\s|\r\n]/', $printed); |
86 | - } else { |
|
91 | + } |
|
92 | + else |
|
93 | + { |
|
87 | 94 | $this->assertNotRegExp('/@var TestClass[\s|\r\n]/', $printed); |
88 | 95 | } |
89 | 96 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | public function setUp(): void |
29 | 29 | { |
30 | - if ((string)ini_get('zend.assertions') === 1) { |
|
30 | + if ((string)ini_get('zend.assertions') === 1){ |
|
31 | 31 | ini_set('zend.assertions', 0); |
32 | 32 | } |
33 | 33 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $i = new Injector(); |
42 | 42 | |
43 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
43 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
44 | 44 | $printed = $i->injectDependencies( |
45 | 45 | file_get_contents($filename), |
46 | 46 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | ): void { |
67 | 67 | $i = new Injector(); |
68 | 68 | |
69 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
69 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
70 | 70 | $printed = $i->injectDependencies( |
71 | 71 | file_get_contents($filename), |
72 | 72 | $this->getDefinition($filename, ['testClass' => TestClass::class]), |
@@ -75,15 +75,15 @@ discard block |
||
75 | 75 | $noPhpDoc |
76 | 76 | ); |
77 | 77 | |
78 | - if ($expectedTypedProperty) { |
|
78 | + if ($expectedTypedProperty){ |
|
79 | 79 | $this->assertStringContainsString('private TestClass $testClass;', $printed); |
80 | - } else { |
|
80 | + }else{ |
|
81 | 81 | $this->assertStringNotContainsString('private TestClass $testClass;', $printed); |
82 | 82 | } |
83 | 83 | |
84 | - if ($expectedPhpDoc) { |
|
84 | + if ($expectedPhpDoc){ |
|
85 | 85 | $this->assertRegExp('/@var TestClass[\s|\r\n]/', $printed); |
86 | - } else { |
|
86 | + }else{ |
|
87 | 87 | $this->assertNotRegExp('/@var TestClass[\s|\r\n]/', $printed); |
88 | 88 | } |
89 | 89 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $i = new Injector(); |
108 | 108 | |
109 | - $filename = __DIR__ . '/Fixtures/TestEmptyClass.php'; |
|
109 | + $filename = __DIR__.'/Fixtures/TestEmptyClass.php'; |
|
110 | 110 | $content = file_get_contents($filename); |
111 | 111 | $printed = $i->injectDependencies( |
112 | 112 | file_get_contents($filename), |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | { |
125 | 125 | $i = new Injector(); |
126 | 126 | |
127 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
127 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
128 | 128 | $r = $i->injectDependencies( |
129 | 129 | file_get_contents($filename), |
130 | 130 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | { |
150 | 150 | $i = new Injector(); |
151 | 151 | |
152 | - $filename = __DIR__ . '/Fixtures/ChildClass.php'; |
|
152 | + $filename = __DIR__.'/Fixtures/ChildClass.php'; |
|
153 | 153 | $r = $i->injectDependencies( |
154 | 154 | file_get_contents($filename), |
155 | 155 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | $i = new Injector(); |
169 | 169 | |
170 | - $filename = __DIR__ . '/Fixtures/ChildWithConstructorClass.php'; |
|
170 | + $filename = __DIR__.'/Fixtures/ChildWithConstructorClass.php'; |
|
171 | 171 | $r = $i->injectDependencies( |
172 | 172 | file_get_contents($filename), |
173 | 173 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function testModifyConstructor(): void |
185 | 185 | { |
186 | - $filename = __DIR__ . '/Fixtures/WithConstructor.php'; |
|
186 | + $filename = __DIR__.'/Fixtures/WithConstructor.php'; |
|
187 | 187 | $extractor = new Traverse\Extractor(); |
188 | 188 | |
189 | 189 | $parameters = $extractor->extractFromFilename($filename); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function testPriorOptionalConstructorParameters(): void |
211 | 211 | { |
212 | - $filename = __DIR__ . '/Fixtures/OptionalConstructorArgsClass.php'; |
|
212 | + $filename = __DIR__.'/Fixtures/OptionalConstructorArgsClass.php'; |
|
213 | 213 | $extractor = new Traverse\Extractor(); |
214 | 214 | |
215 | 215 | $parameters = $extractor->extractFromFilename($filename); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | $i = new Injector(); |
242 | 242 | |
243 | - $filename = __DIR__ . '/ClassNode/ConflictResolver/Fixtures/ChildClass.php'; |
|
243 | + $filename = __DIR__.'/ClassNode/ConflictResolver/Fixtures/ChildClass.php'; |
|
244 | 244 | $printed = $i->injectDependencies( |
245 | 245 | file_get_contents($filename), |
246 | 246 | $this->getDefinition( |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | $i = new Injector(); |
25 | 25 | |
26 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
26 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
27 | 27 | $r = $i->injectDependencies( |
28 | 28 | file_get_contents($filename), |
29 | 29 | $this->getDefinition( |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | ) |
37 | 37 | ); |
38 | 38 | |
39 | - $this->assertStringContainsString(Fixtures\Test::class . ';', $r); |
|
39 | + $this->assertStringContainsString(Fixtures\Test::class.';', $r); |
|
40 | 40 | $this->assertRegExp('/@var Test[\s|\r\n]/', $r); |
41 | 41 | $this->assertStringContainsString('@param Test $test', $r); |
42 | 42 | |
43 | - $this->assertStringContainsString(Fixtures\SubFolder\Test::class . ' as Test2;', $r); |
|
44 | - $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class . ';', $r); |
|
43 | + $this->assertStringContainsString(Fixtures\SubFolder\Test::class.' as Test2;', $r); |
|
44 | + $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class.';', $r); |
|
45 | 45 | $this->assertRegExp('/@var Test2[\s|\r\n]/', $r); |
46 | 46 | $this->assertStringContainsString('@param Test2 $test2', $r); |
47 | 47 | |
48 | - $this->assertStringContainsString(Fixtures\ATest3::class . ';', $r); |
|
48 | + $this->assertStringContainsString(Fixtures\ATest3::class.';', $r); |
|
49 | 49 | $this->assertRegExp('/@var ATest3[\s|\r\n]/', $r); |
50 | 50 | $this->assertStringContainsString('@param ATest3 $test3', $r); |
51 | 51 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $i = new Injector(); |
59 | 59 | |
60 | - $filename = __DIR__ . '/Fixtures/TestClassWithImports.php'; |
|
60 | + $filename = __DIR__.'/Fixtures/TestClassWithImports.php'; |
|
61 | 61 | $r = $i->injectDependencies( |
62 | 62 | file_get_contents($filename), |
63 | 63 | $this->getDefinition( |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | ) |
71 | 71 | ); |
72 | 72 | |
73 | - $this->assertStringContainsString(Fixtures\Test::class . ' as FTest;', $r); |
|
74 | - $this->assertStringNotContainsString(Fixtures\Test::class . ';', $r); |
|
73 | + $this->assertStringContainsString(Fixtures\Test::class.' as FTest;', $r); |
|
74 | + $this->assertStringNotContainsString(Fixtures\Test::class.';', $r); |
|
75 | 75 | $this->assertRegExp('/@var FTest[\s|\r\n]/', $r); |
76 | 76 | $this->assertStringContainsString('@param FTest $test', $r); |
77 | 77 | |
78 | - $this->assertStringContainsString(Fixtures\SubFolder\Test::class . ' as TestAlias;', $r); |
|
79 | - $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class . ';', $r); |
|
78 | + $this->assertStringContainsString(Fixtures\SubFolder\Test::class.' as TestAlias;', $r); |
|
79 | + $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class.';', $r); |
|
80 | 80 | $this->assertRegExp('/@var TestAlias[\s|\r\n]/', $r); |
81 | 81 | $this->assertStringContainsString('@param TestAlias $test2', $r); |
82 | 82 | |
83 | - $this->assertStringContainsString(Fixtures\ATest3::class . ' as ATest;', $r); |
|
84 | - $this->assertStringNotContainsString(Fixtures\ATest3::class . ';', $r); |
|
83 | + $this->assertStringContainsString(Fixtures\ATest3::class.' as ATest;', $r); |
|
84 | + $this->assertStringNotContainsString(Fixtures\ATest3::class.';', $r); |
|
85 | 85 | $this->assertRegExp('/@var ATest[\s|\r\n]/', $r); |
86 | 86 | $this->assertStringContainsString('@param ATest $test3', $r); |
87 | 87 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | $i = new Injector(); |
95 | 95 | |
96 | - $filename = __DIR__ . '/Fixtures/ChildClass.php'; |
|
96 | + $filename = __DIR__.'/Fixtures/ChildClass.php'; |
|
97 | 97 | $r = $i->injectDependencies( |
98 | 98 | file_get_contents($filename), |
99 | 99 | $this->getDefinition( |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | ) |
107 | 107 | ); |
108 | 108 | |
109 | - $this->assertStringContainsString(Fixtures\Test::class . ';', $r); |
|
109 | + $this->assertStringContainsString(Fixtures\Test::class.';', $r); |
|
110 | 110 | $this->assertRegExp('/@var Test[\s|\r\n]/', $r); |
111 | 111 | $this->assertStringContainsString('@param Test $test', $r); |
112 | 112 | |
113 | - $this->assertStringContainsString(Fixtures\SubFolder\Test::class . ' as Test2;', $r); |
|
114 | - $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class . ';', $r); |
|
113 | + $this->assertStringContainsString(Fixtures\SubFolder\Test::class.' as Test2;', $r); |
|
114 | + $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class.';', $r); |
|
115 | 115 | $this->assertRegExp('/@var Test2[\s|\r\n]/', $r); |
116 | 116 | $this->assertStringContainsString('@param Test2 $test2', $r); |
117 | 117 | |
118 | - $this->assertStringContainsString(Fixtures\ATest3::class . ' as ATestAlias;', $r); |
|
119 | - $this->assertStringNotContainsString(Fixtures\ATest3::class . ';', $r); |
|
118 | + $this->assertStringContainsString(Fixtures\ATest3::class.' as ATestAlias;', $r); |
|
119 | + $this->assertStringNotContainsString(Fixtures\ATest3::class.';', $r); |
|
120 | 120 | $this->assertRegExp('/@var ATestAlias[\s|\r\n]/', $r); |
121 | 121 | $this->assertStringContainsString('@param ATestAlias $test3', $r); |
122 | 122 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $i = new Injector(); |
127 | 127 | |
128 | - $filename = __DIR__ . '/Fixtures/DuplicatePropertyClass.php'; |
|
128 | + $filename = __DIR__.'/Fixtures/DuplicatePropertyClass.php'; |
|
129 | 129 | $r = $i->injectDependencies( |
130 | 130 | file_get_contents($filename), |
131 | 131 | $this->getDefinition( |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ) |
137 | 137 | ); |
138 | 138 | |
139 | - $this->assertStringContainsString(Fixtures\Test::class . ';', $r); |
|
139 | + $this->assertStringContainsString(Fixtures\Test::class.';', $r); |
|
140 | 140 | $this->assertRegExp('/@var Test[\s|\r\n]/', $r); |
141 | 141 | $this->assertStringContainsString('@param Test $test', $r); |
142 | 142 | $this->assertStringContainsString('__construct(Test $test)', $r); |
@@ -45,9 +45,12 @@ discard block |
||
45 | 45 | $classFilename = (new \ReflectionClass($class))->getFileName(); |
46 | 46 | |
47 | 47 | // looking for proper view error location |
48 | - if ($e->getFile() !== $classFilename) { |
|
49 | - foreach ($e->getTrace() as $trace) { |
|
50 | - if (isset($trace['file']) && $trace['file'] === $classFilename) { |
|
48 | + if ($e->getFile() !== $classFilename) |
|
49 | + { |
|
50 | + foreach ($e->getTrace() as $trace) |
|
51 | + { |
|
52 | + if (isset($trace['file']) && $trace['file'] === $classFilename) |
|
53 | + { |
|
51 | 54 | $line = $trace['line']; |
52 | 55 | break; |
53 | 56 | } |
@@ -55,7 +58,8 @@ discard block |
||
55 | 58 | } |
56 | 59 | |
57 | 60 | $userStack = []; |
58 | - foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack) { |
|
61 | + foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack) |
|
62 | + { |
|
59 | 63 | $userStack[] = [ |
60 | 64 | 'file' => $stack['file'], |
61 | 65 | 'line' => $stack['line'], |
@@ -65,7 +69,8 @@ discard block |
||
65 | 69 | 'args' => [$data], |
66 | 70 | ]; |
67 | 71 | |
68 | - if ($stack['file'] === $filename) { |
|
72 | + if ($stack['file'] === $filename) |
|
73 | + { |
|
69 | 74 | // no need to jump over root template |
70 | 75 | break; |
71 | 76 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | public function __construct( |
13 | 13 | private readonly SourceMap $sourcemap, |
14 | 14 | private readonly int $lineOffset |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function mapException(\Throwable $e, string $class, string $filename, array $data): \Throwable |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | $classFilename = (new \ReflectionClass($class))->getFileName(); |
22 | 22 | |
23 | 23 | // looking for proper view error location |
24 | - if ($e->getFile() !== $classFilename) { |
|
25 | - foreach ($e->getTrace() as $trace) { |
|
26 | - if (isset($trace['file']) && $trace['file'] === $classFilename) { |
|
24 | + if ($e->getFile() !== $classFilename){ |
|
25 | + foreach ($e->getTrace() as $trace){ |
|
26 | + if (isset($trace['file']) && $trace['file'] === $classFilename){ |
|
27 | 27 | $line = $trace['line']; |
28 | 28 | break; |
29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | $userStack = []; |
34 | - foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack) { |
|
34 | + foreach ($this->sourcemap->getStack($line - $this->lineOffset) as $stack){ |
|
35 | 35 | $userStack[] = [ |
36 | 36 | 'file' => $stack['file'], |
37 | 37 | 'line' => $stack['line'], |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'args' => [$data], |
42 | 42 | ]; |
43 | 43 | |
44 | - if ($stack['file'] === $filename) { |
|
44 | + if ($stack['file'] === $filename){ |
|
45 | 45 | // no need to jump over root template |
46 | 46 | break; |
47 | 47 | } |
@@ -56,7 +56,8 @@ |
||
56 | 56 | */ |
57 | 57 | public function load(string $path): Source |
58 | 58 | { |
59 | - if ($this->context === null) { |
|
59 | + if ($this->context === null) |
|
60 | + { |
|
60 | 61 | throw new EngineException('Unable to use StemplerLoader without given context.'); |
61 | 62 | } |
62 | 63 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function __construct( |
24 | 24 | private readonly LoaderInterface $loader, |
25 | 25 | array $processors |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | $this->processors = $processors; |
28 | 28 | } |
29 | 29 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function load(string $path): Source |
42 | 42 | { |
43 | - if ($this->context === null) { |
|
43 | + if ($this->context === null){ |
|
44 | 44 | throw new EngineException('Unable to use StemplerLoader without given context.'); |
45 | 45 | } |
46 | 46 |
@@ -59,7 +59,8 @@ |
||
59 | 59 | $this->context |
60 | 60 | ); |
61 | 61 | |
62 | - if ($sourcemap === null) { |
|
62 | + if ($sourcemap === null) |
|
63 | + { |
|
63 | 64 | return $e; |
64 | 65 | } |
65 | 66 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | protected StemplerEngine $engine, |
21 | 21 | protected ViewSource $view, |
22 | 22 | protected ContextInterface $context |
23 | - ) { |
|
23 | + ){ |
|
24 | 24 | $this->container = $engine->getContainer(); |
25 | 25 | } |
26 | 26 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $this->context |
35 | 35 | ); |
36 | 36 | |
37 | - if ($sourcemap === null) { |
|
37 | + if ($sourcemap === null){ |
|
38 | 38 | return $e; |
39 | 39 | } |
40 | 40 |
@@ -67,15 +67,18 @@ discard block |
||
67 | 67 | public function isFresh(string $key): bool |
68 | 68 | { |
69 | 69 | $mapFilename = $this->mapFilename($key); |
70 | - if (!$this->files->exists($mapFilename)) { |
|
70 | + if (!$this->files->exists($mapFilename)) |
|
71 | + { |
|
71 | 72 | return false; |
72 | 73 | } |
73 | 74 | |
74 | 75 | $time = $this->files->time($this->filename($key)); |
75 | 76 | |
76 | 77 | $files = (array)include $mapFilename; |
77 | - foreach ($files as $file) { |
|
78 | - if ($this->files->time($file) > $time) { |
|
78 | + foreach ($files as $file) |
|
79 | + { |
|
80 | + if ($this->files->time($file) > $time) |
|
81 | + { |
|
79 | 82 | // some partial has changed |
80 | 83 | return false; |
81 | 84 | } |
@@ -92,12 +95,14 @@ discard block |
||
92 | 95 | public function delete(string $key): void |
93 | 96 | { |
94 | 97 | $filename = $this->filename($key); |
95 | - if ($this->files->exists($filename)) { |
|
98 | + if ($this->files->exists($filename)) |
|
99 | + { |
|
96 | 100 | $this->files->delete($filename); |
97 | 101 | } |
98 | 102 | |
99 | 103 | $mapFilename = $this->mapFilename($key); |
100 | - if ($this->files->exists($mapFilename)) { |
|
104 | + if ($this->files->exists($mapFilename)) |
|
105 | + { |
|
101 | 106 | $this->files->delete($mapFilename); |
102 | 107 | } |
103 | 108 | } |
@@ -110,7 +115,8 @@ discard block |
||
110 | 115 | public function load(string $key): void |
111 | 116 | { |
112 | 117 | $filename = $this->filename($key); |
113 | - if ($this->files->exists($filename)) { |
|
118 | + if ($this->files->exists($filename)) |
|
119 | + { |
|
114 | 120 | include_once $filename; |
115 | 121 | } |
116 | 122 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | public function __construct( |
13 | 13 | private readonly string $directory, |
14 | 14 | private readonly FilesInterface $files = new Files() |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | public function isFresh(string $key): bool |
44 | 44 | { |
45 | 45 | $mapFilename = $this->mapFilename($key); |
46 | - if (!$this->files->exists($mapFilename)) { |
|
46 | + if (!$this->files->exists($mapFilename)){ |
|
47 | 47 | return false; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $time = $this->files->time($this->filename($key)); |
51 | 51 | |
52 | 52 | $files = (array)include $mapFilename; |
53 | - foreach ($files as $file) { |
|
54 | - if ($this->files->time($file) > $time) { |
|
53 | + foreach ($files as $file){ |
|
54 | + if ($this->files->time($file) > $time){ |
|
55 | 55 | // some partial has changed |
56 | 56 | return false; |
57 | 57 | } |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | public function delete(string $key): void |
67 | 67 | { |
68 | 68 | $filename = $this->filename($key); |
69 | - if ($this->files->exists($filename)) { |
|
69 | + if ($this->files->exists($filename)){ |
|
70 | 70 | $this->files->delete($filename); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $mapFilename = $this->mapFilename($key); |
74 | - if ($this->files->exists($mapFilename)) { |
|
74 | + if ($this->files->exists($mapFilename)){ |
|
75 | 75 | $this->files->delete($mapFilename); |
76 | 76 | } |
77 | 77 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function load(string $key): void |
83 | 83 | { |
84 | 84 | $filename = $this->filename($key); |
85 | - if ($this->files->exists($filename)) { |
|
85 | + if ($this->files->exists($filename)){ |
|
86 | 86 | include_once $filename; |
87 | 87 | } |
88 | 88 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | { |
58 | 58 | $s = $this->getStempler(); |
59 | 59 | |
60 | - try { |
|
60 | + try{ |
|
61 | 61 | $s->get('echo', new ViewContext())->render(); |
62 | - } catch (RenderException $e) { |
|
62 | + }catch (RenderException $e){ |
|
63 | 63 | $t = $e->getUserTrace()[0]; |
64 | 64 | |
65 | 65 | $this->assertSame(2, $t['line']); |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | { |
72 | 72 | $s = $this->getStempler(); |
73 | 73 | |
74 | - try { |
|
74 | + try{ |
|
75 | 75 | $s->get('other:echo-in', new ViewContext())->render(); |
76 | - } catch (RenderException $e) { |
|
76 | + }catch (RenderException $e){ |
|
77 | 77 | $t = $e->getUserTrace(); |
78 | 78 | $this->assertCount(2, $t); |
79 | 79 | |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | { |
90 | 90 | $twig = $this->getStempler(); |
91 | 91 | |
92 | - try { |
|
92 | + try{ |
|
93 | 93 | $twig->get('other:bad', new ViewContext()); |
94 | - } catch (CompileException $e) { |
|
94 | + }catch (CompileException $e){ |
|
95 | 95 | $this->assertStringContainsString('bad.dark.php', $e->getFile()); |
96 | 96 | } |
97 | 97 | } |
@@ -57,9 +57,12 @@ discard block |
||
57 | 57 | { |
58 | 58 | $s = $this->getStempler(); |
59 | 59 | |
60 | - try { |
|
60 | + try |
|
61 | + { |
|
61 | 62 | $s->get('echo', new ViewContext())->render(); |
62 | - } catch (RenderException $e) { |
|
63 | + } |
|
64 | + catch (RenderException $e) |
|
65 | + { |
|
63 | 66 | $t = $e->getUserTrace()[0]; |
64 | 67 | |
65 | 68 | $this->assertSame(2, $t['line']); |
@@ -71,9 +74,12 @@ discard block |
||
71 | 74 | { |
72 | 75 | $s = $this->getStempler(); |
73 | 76 | |
74 | - try { |
|
77 | + try |
|
78 | + { |
|
75 | 79 | $s->get('other:echo-in', new ViewContext())->render(); |
76 | - } catch (RenderException $e) { |
|
80 | + } |
|
81 | + catch (RenderException $e) |
|
82 | + { |
|
77 | 83 | $t = $e->getUserTrace(); |
78 | 84 | $this->assertCount(2, $t); |
79 | 85 | |
@@ -89,9 +95,12 @@ discard block |
||
89 | 95 | { |
90 | 96 | $twig = $this->getStempler(); |
91 | 97 | |
92 | - try { |
|
98 | + try |
|
99 | + { |
|
93 | 100 | $twig->get('other:bad', new ViewContext()); |
94 | - } catch (CompileException $e) { |
|
101 | + } |
|
102 | + catch (CompileException $e) |
|
103 | + { |
|
95 | 104 | $this->assertStringContainsString('bad.dark.php', $e->getFile()); |
96 | 105 | } |
97 | 106 | } |
@@ -35,13 +35,13 @@ |
||
35 | 35 | |
36 | 36 | public function testCache(): void |
37 | 37 | { |
38 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
38 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
39 | 39 | |
40 | 40 | $s = $this->getStempler(); |
41 | 41 | $this->assertSame('test', $s->get('test', new ViewContext())->render([])); |
42 | - $this->assertCount(2, $this->files->getFiles(__DIR__ . '/cache/', '*.php')); |
|
42 | + $this->assertCount(2, $this->files->getFiles(__DIR__.'/cache/', '*.php')); |
|
43 | 43 | |
44 | 44 | $s->reset('test', new ViewContext()); |
45 | - $this->assertCount(0, $this->files->getFiles(__DIR__ . '/../cache/', '*.php')); |
|
45 | + $this->assertCount(0, $this->files->getFiles(__DIR__.'/../cache/', '*.php')); |
|
46 | 46 | } |
47 | 47 | } |