Create PHPStan bootstrap file, integrate into Travis CI.
This commit is contained in:
parent
a174c3ba5b
commit
91c334ffff
|
@ -28,6 +28,7 @@ install:
|
||||||
- docker-compose -f docker-compose.sample.yml -f docker-compose.testing.yml run --user="azuracast" --rm web azuracast_install
|
- docker-compose -f docker-compose.sample.yml -f docker-compose.testing.yml run --user="azuracast" --rm web azuracast_install
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- docker-compose -f docker-compose.sample.yml -f docker-compose.testing.yml run --user="azuracast" --rm web /var/azuracast/www/vendor/bin/phpstan analyze
|
||||||
- docker-compose -f docker-compose.sample.yml -f docker-compose.testing.yml run --user="azuracast" --rm web /var/azuracast/www/vendor/bin/codecept run --no-interaction --coverage --coverage-xml --fail-fast
|
- docker-compose -f docker-compose.sample.yml -f docker-compose.testing.yml run --user="azuracast" --rm web /var/azuracast/www/vendor/bin/codecept run --no-interaction --coverage --coverage-xml --fail-fast
|
||||||
|
|
||||||
after_failure:
|
after_failure:
|
||||||
|
|
|
@ -198,12 +198,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/AzuraCast/nowplaying.git",
|
"url": "https://github.com/AzuraCast/nowplaying.git",
|
||||||
"reference": "58d38e04ccd6d1f9f4be7b276f7c7af1b3511bac"
|
"reference": "9100c1b242264d1ef81bb045b650b5391e7674ee"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/AzuraCast/nowplaying/zipball/58d38e04ccd6d1f9f4be7b276f7c7af1b3511bac",
|
"url": "https://api.github.com/repos/AzuraCast/nowplaying/zipball/9100c1b242264d1ef81bb045b650b5391e7674ee",
|
||||||
"reference": "58d38e04ccd6d1f9f4be7b276f7c7af1b3511bac",
|
"reference": "9100c1b242264d1ef81bb045b650b5391e7674ee",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -233,7 +233,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "A lightweight PHP adapter for viewing the current now playing data in Icecast and SHOUTcast 1/2. A part of the AzuraCast software suite.",
|
"description": "A lightweight PHP adapter for viewing the current now playing data in Icecast and SHOUTcast 1/2. A part of the AzuraCast software suite.",
|
||||||
"time": "2019-01-17T12:41:09+00:00"
|
"time": "2019-01-30T19:21:33+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beberlei/assert",
|
"name": "beberlei/assert",
|
||||||
|
|
19
docker.sh
19
docker.sh
|
@ -223,6 +223,7 @@ restore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
# DEVELOPER TOOL:
|
||||||
# Access the static console as a developer.
|
# Access the static console as a developer.
|
||||||
# Usage: ./docker.sh static [static_container_command]
|
# Usage: ./docker.sh static [static_container_command]
|
||||||
#
|
#
|
||||||
|
@ -231,6 +232,24 @@ static() {
|
||||||
docker-compose -f docker-compose.static.yml run --rm static $*
|
docker-compose -f docker-compose.static.yml run --rm static $*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# DEVELOPER TOOL:
|
||||||
|
#
|
||||||
|
#
|
||||||
|
dev-phpstan() {
|
||||||
|
docker-compose exec --user="azuracast" web vendor/bin/phpstan analyze $*
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# DEVELOPER TOOL:
|
||||||
|
# Run codeception for unit testing.
|
||||||
|
#
|
||||||
|
dev-codeception() {
|
||||||
|
docker-compose -f docker-compose.sample.yml -f docker-compose.testing.yml build web
|
||||||
|
docker-compose -f docker-compose.sample.yml -f docker-compose.testing.yml run --user="azuracast" --rm web /var/azuracast/www/vendor/bin/codecept run --no-interaction --coverage --coverage-xml --fail-fast
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Stop all Docker containers and remove related volumes.
|
# Stop all Docker containers and remove related volumes.
|
||||||
# Usage: ./docker.sh uninstall
|
# Usage: ./docker.sh uninstall
|
||||||
|
|
23
phpstan.neon
23
phpstan.neon
|
@ -4,28 +4,7 @@ parameters:
|
||||||
paths:
|
paths:
|
||||||
- src
|
- src
|
||||||
|
|
||||||
ignoreErrors:
|
bootstrap: %rootDir%/../../../util/phpstan.php
|
||||||
# These errors are reported because the gettext extension is not installed/enabled in CLI (see https://github.com/phpstan/phpstan/issues/604)
|
|
||||||
- '#Function __ not found.#'
|
|
||||||
- '#Function n__ not found.#'
|
|
||||||
|
|
||||||
# See https://github.com/phpstan/phpstan/issues/768
|
|
||||||
- '#Constant APP_IS_COMMAND_LINE not found.#'
|
|
||||||
- '#Constant APP_TESTING_MODE not found.#'
|
|
||||||
- '#Constant APP_INCLUDE_ROOT not found.#'
|
|
||||||
- '#Constant APP_APPLICATION_ENV not found.#'
|
|
||||||
- '#Constant APP_INSIDE_DOCKER not found.#'
|
|
||||||
- '#Constant APP_IN_PRODUCTION not found.#'
|
|
||||||
- '#Constant APP_INCLUDE_TEMP not found.#'
|
|
||||||
- '#Constant APP_DOCKER_REVISION not found.#'
|
|
||||||
|
|
||||||
# Seems to be a bug that is also present in PHPStorm. We should consider changing the code there
|
|
||||||
-
|
|
||||||
message: '#Variable \$key_identifier might not be defined.#'
|
|
||||||
path: %rootDir%/../../../src/Controller/Frontend/ApiKeysController.php
|
|
||||||
-
|
|
||||||
message: '#Variable \$key_verifier might not be defined.#'
|
|
||||||
path: %rootDir%/../../../src/Controller/Frontend/ApiKeysController.php
|
|
||||||
|
|
||||||
includes:
|
includes:
|
||||||
- vendor/phpstan/phpstan-doctrine/extension.neon
|
- vendor/phpstan/phpstan-doctrine/extension.neon
|
||||||
|
|
|
@ -69,6 +69,10 @@ class ApiKeysController
|
||||||
if ($_POST && $form->isValid($_POST)) {
|
if ($_POST && $form->isValid($_POST)) {
|
||||||
$data = $form->getValues();
|
$data = $form->getValues();
|
||||||
|
|
||||||
|
// Setting values here to avoid static analysis errors.
|
||||||
|
$key_identifier = null;
|
||||||
|
$key_verifier = null;
|
||||||
|
|
||||||
if ($new_record) {
|
if ($new_record) {
|
||||||
$record = new Entity\ApiKey($user);
|
$record = new Entity\ApiKey($user);
|
||||||
list($key_identifier, $key_verifier) = $record->generate();
|
list($key_identifier, $key_verifier) = $record->generate();
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPStan Bootstrap File
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Register gettext to avoid related errors
|
||||||
|
$translator = new \Gettext\Translator();
|
||||||
|
$translator->register();
|
||||||
|
|
||||||
|
// Define APP_ constants used by AzuraCast.
|
||||||
|
define('APP_IS_COMMAND_LINE', true);
|
||||||
|
define('APP_INCLUDE_ROOT', dirname(__DIR__));
|
||||||
|
define('APP_INCLUDE_TEMP', dirname(APP_INCLUDE_ROOT).'/www_tmp');
|
||||||
|
|
||||||
|
define('APP_INSIDE_DOCKER', true);
|
||||||
|
define('APP_DOCKER_REVISION', 1);
|
||||||
|
|
||||||
|
define('APP_TESTING_MODE', true);
|
||||||
|
define('SAMPLE_TIMESTAMP', rand(time() - 86400, time() + 86400));
|
||||||
|
|
||||||
|
define('APP_APPLICATION_ENV', 'testing');
|
||||||
|
define('APP_IN_PRODUCTION', false);
|
Loading…
Reference in New Issue