Skip to content

Commit 88cb0f6

Browse files
committed
suppress invalid BC warnings
1 parent ed2438d commit 88cb0f6

File tree

2 files changed

+51
-4
lines changed

2 files changed

+51
-4
lines changed

.github/bc-test.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
3+
#
4+
# This file is a hack to suppress warnings from Roave BC check
5+
#
6+
7+
#composer require roave/backward-compatibility-check --no-update
8+
#composer install
9+
10+
# Capture output to variable AND print it
11+
exec 4711>&1
12+
OUTPUT=$(./vendor/bin/roave-backward-compatibility-check 2>&1 | tee /dev/fd/4711)
13+
14+
# Remove rows we want to suppress
15+
OUTPUT=`echo "$OUTPUT" | sed '/The return type of Github\\\HttpClient\\\Plugin\\\Authentication#handleRequest() changed from no type to Http\\\Promise\\\Promise/'d`
16+
OUTPUT=`echo "$OUTPUT" | sed '/The return type of Github\\\HttpClient\\\Plugin\\\Authentication#handleRequest() changed from no type to Http\\\Promise\\\Promise/'d`
17+
OUTPUT=`echo "$OUTPUT" | sed '/The parameter $exception of Github\\\HttpClient\\\Plugin\\\History#addFailure() changed from Http\\\Client\\\Exception to a non-contravariant Psr\\\Http\\\Client\\\ClientExceptionInterface/'d`
18+
OUTPUT=`echo "$OUTPUT" | sed '/The parameter $exception of Github\\\HttpClient\\\Plugin\\\History#addFailure() changed from Http\\\Client\\\Exception to Psr\\\Http\\\Client\\\ClientExceptionInterface/'d`
19+
OUTPUT=`echo "$OUTPUT" | sed '/The return type of Github\\\HttpClient\\\Plugin\\\PathPrepend#handleRequest() changed from no type to Http\\\Promise\\\Promise/'d`
20+
OUTPUT=`echo "$OUTPUT" | sed '/The return type of Github\\\HttpClient\\\Plugin\\\GithubExceptionThrower#handleRequest() changed from no type to Http\\\Promise\\\Promise/'d`
21+
OUTPUT=`echo "$OUTPUT" | sed '/Method getMessage() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
22+
OUTPUT=`echo "$OUTPUT" | sed '/Method getCode() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
23+
OUTPUT=`echo "$OUTPUT" | sed '/Method getFile() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
24+
OUTPUT=`echo "$OUTPUT" | sed '/Method getLine() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
25+
OUTPUT=`echo "$OUTPUT" | sed '/Method getTrace() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
26+
OUTPUT=`echo "$OUTPUT" | sed '/Method getPrevious() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
27+
OUTPUT=`echo "$OUTPUT" | sed '/Method getTraceAsString() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
28+
OUTPUT=`echo "$OUTPUT" | sed '/Method __toString() was added to interface Github\\\Exception\\\ExceptionInterface/'d`
29+
30+
# Number of rows we found with "[BC]" in them
31+
BC_BREAKS=`echo "$OUTPUT" | grep -o '\[BC\]' | wc -l | awk '{ print $1 }'`
32+
33+
# The last row of the output is "X backwards-incompatible changes detected". Find X.
34+
STATED_BREAKS=`echo "$OUTPUT" | tail -n 1 | awk -F' ' '{ print $1 }'`
35+
36+
# If
37+
# We found "[BC]" in the command output after we removed suppressed lines
38+
# OR
39+
# We have suppressed X number of BC breaks. If $STATED_BREAKS is larger than X
40+
# THEN
41+
# exit 1
42+
43+
if [ $BC_BREAKS -gt 0 ] || [ $STATED_BREAKS -gt 13 ]; then
44+
echo "EXIT 1"
45+
exit 1
46+
fi
47+
48+
# No BC breaks found
49+
echo "EXIT 0"
50+
exit 0

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ matrix:
1919
include:
2020
- php: 7.2
2121
name: Backward compatibillity check
22-
env: DEPENDENCIES="roave/backward-compatibility-check" TEST_COMMAND="./vendor/bin/roave-backward-compatibility-check"
23-
24-
before_install:
25-
- if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi;
22+
env: TEST_COMMAND="./.github/bc-test.sh"
2623

2724
install:
2825
- travis_retry composer install --no-interaction

0 commit comments

Comments
 (0)