Skip to content

Commit 6f33d01

Browse files
Run phan checks in travis
Use PECL to install and enable nikic/php-ast (0.1.5)
1 parent 25088ab commit 6f33d01

File tree

4 files changed

+4
-65
lines changed

4 files changed

+4
-65
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ install:
1515
- composer --prefer-dist install
1616

1717
script:
18+
- vendor/bin/phan
1819
- ./test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Using it as an error-tolerant substitute for php-ast (e.g. for use in IDEs)
3939
Running unit tests
4040
------------------
4141

42-
To run unit tests, you must install [nikic/php-ast](https://github.com/nikic/php-ast)
42+
To run unit tests, you must install [nikic/php-ast](https://github.com/nikic/php-ast). A version supporting AST versions 40 and/or 50 should be installed (`~0.1.5` is preferred)
4343

4444
- Then run `vendor/bin/phpunit`
4545

src/ASTConverter/Bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
__DIR__.'/../../../../../vendor/autoload.php', // autoloader is in parent project
1414
] as $file) {
1515
if (file_exists($file)) {
16-
echo "Found the autoloader at $file\n";
1716
require_once($file);
1817
break;
1918
}

tests/setup.sh

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,6 @@
11
#!/usr/bin/env bash
2-
# php-ast installation and configuration script, taken from Etsy/Phan
3-
4-
function build {
5-
phpize
6-
./configure
7-
make
8-
}
9-
10-
function cleanBuild {
11-
make clean
12-
build
13-
}
14-
15-
function install {
16-
make install
17-
echo "extension=ast.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
18-
}
19-
20-
# Ensure the build directory exists
21-
[[ -d "build" ]] || mkdir build
22-
23-
# Ensure that the PHP version hasn't changed under us. If it has, we'll have to
24-
# rebuild the extension.
25-
if [[ -e "build/phpversion.txt" ]]; then
26-
if ! diff -q build/phpversion.txt <(php -r "echo PHP_VERSION_ID;"); then
27-
# Something has changed, so nuke the build/ast directory if it exists.
28-
echo "New version of PHP detected. Removing build/ast so we can do a fresh build."
29-
rm -rf build/ast
30-
fi
31-
fi
32-
33-
# Ensure that we have a copy of the ast extension source code.
34-
if [[ ! -e "build/ast/config.m4" ]]; then
35-
# If build/ast exists, but build/ast/config.m4 doesn't, nuke it and start over.
36-
[[ ! -d "build/ast" ]] || rm -rf build/ast
37-
git clone --depth 1 https://github.com/nikic/php-ast.git build/ast
38-
fi
39-
40-
# Install the ast extension
41-
pushd ./build/ast
42-
# If we don't have ast.so, we have to build it.
43-
if [[ ! -e "modules/ast.so" ]]; then
44-
echo "No cached extension found. Building..."
45-
build
46-
else
47-
# If there are new commits, we need to rebuild the extension.
48-
git fetch origin master
49-
newCommits=$(git rev-list HEAD...origin/master --count)
50-
if [[ "$newCommits" != "0" ]]; then
51-
echo "New commits found upstream. Updating and rebuilding..."
52-
git pull origin master
53-
cleanBuild
54-
else
55-
echo "Using cached extension."
56-
fi
57-
fi
58-
59-
# No matter what, we still have to move the .so into place and enable it.
60-
install
61-
popd
62-
63-
# Note the PHP version for later builds.
64-
php -r "echo PHP_VERSION_ID;" > build/phpversion.txt
2+
# This has been tested with 0.1.5 but not any other versions
3+
pecl install -f ast-0.1.5
654

665
# Disable xdebug, since we aren't currently gathering code coverage data and
676
# having xdebug slows down Composer a bit.

0 commit comments

Comments
 (0)