| 
									
										
										
										
											2020-07-31 17:24:18 +02:00
										 |  |  | #!/usr/bin/env bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-29 18:50:35 +01:00
										 |  |  | # | 
					
						
							|  |  |  | # phpstan.sh | 
					
						
							|  |  |  | # Copyright (c) 2021 james@firefly-iii.org | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # This file is part of Firefly III (https://github.com/firefly-iii). | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  | # it under the terms of the GNU Affero General Public License as | 
					
						
							|  |  |  | # published by the Free Software Foundation, either version 3 of the | 
					
						
							|  |  |  | # License, or (at your option) any later version. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  | # GNU Affero General Public License for more details. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  | # along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-31 19:10:02 +02:00
										 |  |  | # Install composer packages | 
					
						
							| 
									
										
										
										
											2021-04-06 17:00:00 +02:00
										 |  |  | #composer install --no-scripts --no-ansi | 
					
						
							| 
									
										
										
										
											2020-07-31 19:28:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 12:21:41 +01:00
										 |  |  | SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-01 05:49:45 +02:00
										 |  |  | # enable test .env file. | 
					
						
							| 
									
										
										
										
											2022-10-30 12:02:56 +01:00
										 |  |  | # cp .ci/.env.ci .env | 
					
						
							| 
									
										
										
										
											2020-07-31 17:24:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-31 19:10:02 +02:00
										 |  |  | # Do static code analysis. | 
					
						
							| 
									
										
										
										
											2023-11-04 11:41:21 +01:00
										 |  |  | if [[ $GITHUB_ACTIONS = "" ]] | 
					
						
							|  |  |  | then | 
					
						
							| 
									
										
										
										
											2023-11-04 17:26:38 +01:00
										 |  |  |     ./vendor/bin/phpstan analyse -c .ci/phpstan.neon --error-format=table > phpstan-report.txt | 
					
						
							| 
									
										
										
										
											2023-11-04 12:14:10 +01:00
										 |  |  |     EXIT_CODE=$? | 
					
						
							| 
									
										
										
										
											2023-11-05 08:15:17 +01:00
										 |  |  |     echo "The PHPstan report can be found in phpstan-report.txt. Exit code is $EXIT_CODE." | 
					
						
							| 
									
										
										
										
											2023-11-04 12:16:58 +01:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2023-11-04 11:38:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-04 12:14:10 +01:00
										 |  |  | if [[ $GITHUB_ACTIONS = "true" ]] | 
					
						
							|  |  |  | then | 
					
						
							| 
									
										
										
										
											2023-11-04 17:26:38 +01:00
										 |  |  |     ./vendor/bin/phpstan analyse -c .ci/phpstan.neon --no-progress --error-format=github | 
					
						
							| 
									
										
										
										
											2023-11-04 12:14:10 +01:00
										 |  |  |     EXIT_CODE=$? | 
					
						
							| 
									
										
										
										
											2023-11-04 19:06:47 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # temporary exit code 0 | 
					
						
							| 
									
										
										
										
											2023-11-05 08:15:17 +01:00
										 |  |  |     # EXIT_CODE=0 | 
					
						
							| 
									
										
										
										
											2023-11-04 12:14:10 +01:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2023-11-04 11:38:48 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | exit $EXIT_CODE |