Skip to content

Commit 18b5f29

Browse files
.phpcs.xml config fix
1 parent ca7baa4 commit 18b5f29

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

.phpcs.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
77
</rule>
88

9+
<rule ref="PSR12.ControlStructures.BooleanOperatorPlacement">
10+
<properties>
11+
<property name="allowOnly" value="first"/>
12+
</properties>
13+
</rule>
14+
915
<rule ref="Generic.Files.LineLength">
1016
<properties>
1117
<property name="lineLimit" value="120"/>

app/Commands/FixCommand.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,13 @@ public function handle()
124124

125125
protected function runPint()
126126
{
127-
$configFile = tempnam(sys_get_temp_dir(), "pint");
128-
rename($configFile, $configFile .= '.json');
129-
file_put_contents($configFile, file_get_contents(base_path() . '/pint.json'));
127+
if (file_exists('pint.json')) {
128+
$configFile = 'pint.json';
129+
} else {
130+
$configFile = tempnam(sys_get_temp_dir(), "pint");
131+
rename($configFile, $configFile .= '.json');
132+
file_put_contents($configFile, file_get_contents(base_path() . '/pint.json'));
133+
}
130134

131135
$bin = tempnam(sys_get_temp_dir(), "pint");
132136
file_put_contents($bin, file_get_contents(base_path() . '/tools/pint'));
@@ -158,9 +162,13 @@ protected function runPint()
158162

159163
protected function runPHPCS()
160164
{
161-
$configFile = tempnam(sys_get_temp_dir(), "phpcs");
162-
rename($configFile, $configFile .= '.xml');
163-
file_put_contents($configFile, file_get_contents(base_path() . '/.phpcs.xml'));
165+
if (file_exists('.phpcs.xml')) {
166+
$configFile = './.phpcs.xml';
167+
} else {
168+
$configFile = tempnam(sys_get_temp_dir(), "phpcs");
169+
rename($configFile, $configFile .= '.xml');
170+
file_put_contents($configFile, file_get_contents(base_path() . '/.phpcs.xml'));
171+
}
164172

165173
$bin = tempnam(sys_get_temp_dir(), "phpcbf");
166174
file_put_contents($bin, file_get_contents(base_path() . '/tools/phpcbf'));

builds/ringier-code-style

70 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)