Skip to content

Commit 6e6d0b9

Browse files
committed
Simplify build
1 parent cf55f75 commit 6e6d0b9

File tree

4 files changed

+20
-133
lines changed

4 files changed

+20
-133
lines changed

build.xml

Lines changed: 4 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
<property name="phpunit.executable" value="vendor/bin/phpunit"/>
1818
</else>
1919
</if>
20-
<php expression="PHP_VERSION_ID &gt;= 70400 ?'true':'false'" returnProperty="isPHP74" level="verbose" />
21-
<php expression="PHP_VERSION_ID &gt;= 80000 ?'true':'false'" returnProperty="isPHP80" level="verbose" />
2220
<target name="check" depends="
2321
composer-validate,
2422
composer-install,
@@ -244,34 +242,7 @@
244242
</target>
245243

246244
<target name="phpstan">
247-
<touch file="${phpstan.config}"/>
248-
<append
249-
destFile="${phpstan.config}"
250-
text="includes: [ build/phpstan.neon"
251-
append="false"
252-
></append>
253-
<if>
254-
<equals arg1="${isPHP74}" arg2="true" />
255-
<then>
256-
<append
257-
destFile="${phpstan.config}"
258-
text=", build/ignore-gte-php7.4-errors.neon"
259-
></append>
260-
</then>
261-
</if>
262-
<if>
263-
<equals arg1="${isPHP80}" arg2="true" />
264-
<then>
265-
<append
266-
destFile="${phpstan.config}"
267-
text=", build/baseline-8.0.neon"
268-
></append>
269-
</then>
270-
</if>
271-
<append
272-
destFile="${phpstan.config}"
273-
text=" ]"
274-
></append>
245+
<delete file="${phpstan.config}"/>
275246
<exec
276247
executable="php"
277248
logoutput="true"
@@ -301,24 +272,6 @@
301272
text="includes: [ build/phpstan.neon"
302273
append="false"
303274
></append>
304-
<if>
305-
<equals arg1="${isPHP74}" arg2="true" />
306-
<then>
307-
<append
308-
destFile="${phpstan.config}"
309-
text=", build/ignore-gte-php7.4-errors.neon"
310-
></append>
311-
</then>
312-
</if>
313-
<if>
314-
<equals arg1="${isPHP80}" arg2="true" />
315-
<then>
316-
<append
317-
destFile="${phpstan.config}"
318-
text=", build/baseline-8.0.neon"
319-
></append>
320-
</then>
321-
</if>
322275
<append
323276
destFile="${phpstan.config}"
324277
text=", conf/staticReflection.neon"
@@ -352,34 +305,7 @@
352305
</target>
353306

354307
<target name="phpstan-result-cache">
355-
<touch file="${phpstan.config}"/>
356-
<append
357-
destFile="${phpstan.config}"
358-
text="includes: [ build/phpstan.neon"
359-
append="false"
360-
></append>
361-
<if>
362-
<equals arg1="${isPHP74}" arg2="true" />
363-
<then>
364-
<append
365-
destFile="${phpstan.config}"
366-
text=", build/ignore-gte-php7.4-errors.neon"
367-
></append>
368-
</then>
369-
</if>
370-
<if>
371-
<equals arg1="${isPHP80}" arg2="true" />
372-
<then>
373-
<append
374-
destFile="${phpstan.config}"
375-
text=", build/baseline-8.0.neon"
376-
></append>
377-
</then>
378-
</if>
379-
<append
380-
destFile="${phpstan.config}"
381-
text=" ]"
382-
></append>
308+
<delete file="${phpstan.config}"/>
383309
<exec
384310
executable="php"
385311
logoutput="true"
@@ -414,34 +340,7 @@
414340
</target>
415341

416342
<target name="phpstan-pro">
417-
<touch file="${phpstan.config}"/>
418-
<append
419-
destFile="${phpstan.config}"
420-
text="includes: [ build/phpstan.neon"
421-
append="false"
422-
></append>
423-
<if>
424-
<equals arg1="${isPHP74}" arg2="true" />
425-
<then>
426-
<append
427-
destFile="${phpstan.config}"
428-
text=", build/ignore-gte-php7.4-errors.neon"
429-
></append>
430-
</then>
431-
</if>
432-
<if>
433-
<equals arg1="${isPHP80}" arg2="true" />
434-
<then>
435-
<append
436-
destFile="${phpstan.config}"
437-
text=", build/baseline-8.0.neon"
438-
></append>
439-
</then>
440-
</if>
441-
<append
442-
destFile="${phpstan.config}"
443-
text=" ]"
444-
></append>
343+
<delete file="${phpstan.config}"/>
445344
<exec
446345
executable="php"
447346
logoutput="true"
@@ -456,35 +355,7 @@
456355
</target>
457356

458357
<target name="phpstan-generate-baseline">
459-
<touch file="${phpstan.config}"/>
460-
<append
461-
destFile="${phpstan.config}"
462-
text="includes: [ build/phpstan.neon"
463-
append="false"
464-
></append>
465-
<if>
466-
<equals arg1="${isPHP74}" arg2="true" />
467-
<then>
468-
<append
469-
destFile="${phpstan.config}"
470-
text=", build/ignore-gte-php7.4-errors.neon"
471-
></append>
472-
</then>
473-
</if>
474-
<if>
475-
<equals arg1="${isPHP80}" arg2="true" />
476-
<then>
477-
<append
478-
destFile="${phpstan.config}"
479-
text=", build/baseline-8.0.neon"
480-
></append>
481-
</then>
482-
</if>
483-
484-
<append
485-
destFile="${phpstan.config}"
486-
text=" ]"
487-
></append>
358+
<delete file="${phpstan.config}"/>
488359
<exec
489360
executable="php"
490361
logoutput="true"

build/ignore-by-php-version.neon.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types = 1);
2+
3+
use Nette\Neon\Neon;
4+
5+
$config = [];
6+
if (PHP_VERSION_ID >= 80000) {
7+
$config = array_merge($config, Neon::decode(file_get_contents(__DIR__ . '/baseline-8.0.neon')));
8+
}
9+
10+
if (PHP_VERSION_ID >= 70400) {
11+
$config = array_merge($config, Neon::decode(file_get_contents(__DIR__ . '/ignore-gte-php7.4-errors.neon')));
12+
}
13+
14+
return $config;

build/phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ includes:
66
- ../vendor/phpstan/phpstan-strict-rules/rules.neon
77
- ../conf/bleedingEdge.neon
88
- ../phpstan-baseline.neon
9+
- ignore-by-php-version.neon.php
910
parameters:
1011
level: 8
1112
paths:

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
includes: [ build/phpstan.neon ]

0 commit comments

Comments
 (0)