-phpdoc --title 'PHPMailer version %{version}' --target phpdoc --defaultpackagename PHPMailer -f 'class.*.php'
-# nuke smarty cache
-rm -rf phpdoc/????????????????????????????????
-rm -rf phpdoc/*/????????????????????????????????
+# syntax lint
+for f in $(find -name '*.php' -o -name '*.inc'); do
+
+%if "%{php_major_version}.%{php_minor_version}" < "5.4"
+ case $(basename $f) in
+ class.phpmaileroauthgoogle.php|get_oauth_token.php)
+ # needs php 5.4
+ continue
+ ;;
+ esac
+%endif
+
+%if "%{php_major_version}.%{php_minor_version}" < "5.3"
+ case $(basename $f) in
+ bootstrap.php|phpmailerTest.php)
+ # needs php 5.3
+ continue
+ ;;
+ esac
+%endif
+
+ %{__php} -n -l $f
+done
+
+%if %{with tests}
+cd test
+%{__php} $(which phpunit) .
+cd -
+%endif
+
+rm -rf phpdoc
+phpdoc --title 'PHPMailer version %{version}' --target phpdoc --defaultpackagename PHPMailer \
+ --directory . --ignore test/,examples/,extras/,test_script/,language/,phpdoc/ --sourcecode