[Slim4] Add PHP syntax checker (#4831)

This commit is contained in:
Yuriy Belenko 2019-12-19 08:07:10 +05:00 committed by William Cheng
parent fb0479a213
commit c6ec794293
3 changed files with 55 additions and 0 deletions

View File

@ -1048,6 +1048,7 @@
<module>samples/client/petstore/php/OpenAPIClient-php</module>
<module>samples/openapi3/client/petstore/php/OpenAPIClient-php</module>
<module>samples/server/petstore/php-slim</module>
<module>samples/server/petstore/php-slim4</module>
<module>samples/client/petstore/javascript</module>
<module>samples/client/petstore/javascript-es6</module>
<module>samples/openapi3/client/petstore/javascript-es6</module>

View File

@ -0,0 +1,11 @@
#!/bin/bash
# a simple script to perform a syntax check on php files using "php -l"
for i in $( find . -name "*.php" ); do
result=`php -l $i | grep "No syntax errors detected"`
exit_status=$?
if [ $exit_status -eq 1 ]; then
echo "Syntax errors with $i"
exit 1;
fi
done

View File

@ -0,0 +1,43 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.opoenapitools</groupId>
<artifactId>Slim4PetstoreServerTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Slim4 Petstore Server</name>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>syntax-check</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./php_syntax_checker.bash</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>