Merge pull request #882 from phil-davis/implement-phpstan-level-0
Implement phpstan
This commit is contained in:
commit
6c2244ec20
15 changed files with 127 additions and 6 deletions
24
.travis.yml
24
.travis.yml
|
@ -11,9 +11,22 @@ matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
global:
|
||||||
|
- RUN_PHPSTAN="FALSE"
|
||||||
matrix:
|
matrix:
|
||||||
- LOWEST_DEPS=""
|
- PREFER_LOWEST=""
|
||||||
- LOWEST_DEPS="--prefer-lowest"
|
- PREFER_LOWEST="--prefer-lowest"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- if [ $RUN_PHPSTAN == "TRUE" ]; then composer require --dev phpstan/phpstan:^0.12; fi
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: 'PHPStan'
|
||||||
|
php: 7.4
|
||||||
|
env:
|
||||||
|
- RUN_PHPSTAN="TRUE"
|
||||||
|
fast_finish: true
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- mysql
|
- mysql
|
||||||
|
@ -24,11 +37,12 @@ before_script:
|
||||||
# - mysql -e 'create database sabredav'
|
# - mysql -e 'create database sabredav'
|
||||||
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
||||||
# - composer self-update
|
# - composer self-update
|
||||||
- composer update --prefer-source $LOWEST_DEPS
|
- composer update $PREFER_LOWEST
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- find Core -name "*.php" | xargs -n1 php -l
|
- if [ $RUN_PHPSTAN == "FALSE" ]; then find Core -name "*.php" | xargs -n1 php -l; fi
|
||||||
- ./vendor/bin/sabre-cs-fixer fix . --dry-run --diff
|
- if [ $RUN_PHPSTAN == "FALSE" ]; then ./vendor/bin/sabre-cs-fixer fix . --dry-run --diff; fi
|
||||||
|
- if [ $RUN_PHPSTAN == "TRUE" ]; then php vendor/bin/phpstan.phar analyse Core html; fi
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
|
|
@ -34,6 +34,11 @@ class PDOBasicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
|
||||||
*/
|
*/
|
||||||
protected $authRealm;
|
protected $authRealm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $currentUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the backend object.
|
* Creates the backend object.
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,6 +29,16 @@ namespace BaikalAdmin\Controller\Settings;
|
||||||
|
|
||||||
class Standard extends \Flake\Core\Controller {
|
class Standard extends \Flake\Core\Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Baikal\Model\Config\Standard
|
||||||
|
*/
|
||||||
|
private $oModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Formal\Form
|
||||||
|
*/
|
||||||
|
private $oForm;
|
||||||
|
|
||||||
function execute() {
|
function execute() {
|
||||||
$this->oModel = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php");
|
$this->oModel = new \Baikal\Model\Config\Standard(PROJECT_PATH_SPECIFIC . "config.php");
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,16 @@ namespace BaikalAdmin\Controller\Settings;
|
||||||
|
|
||||||
class System extends \Flake\Core\Controller {
|
class System extends \Flake\Core\Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Baikal\Model\Config\System
|
||||||
|
*/
|
||||||
|
private $oModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Formal\Form
|
||||||
|
*/
|
||||||
|
private $oForm;
|
||||||
|
|
||||||
function execute() {
|
function execute() {
|
||||||
$this->oModel = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php");
|
$this->oModel = new \Baikal\Model\Config\System(PROJECT_PATH_SPECIFIC . "config.system.php");
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,16 @@ class Users extends \Flake\Core\Controller {
|
||||||
|
|
||||||
protected $aMessages = [];
|
protected $aMessages = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Baikal\Model\User
|
||||||
|
*/
|
||||||
|
private $oModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Formal\Form
|
||||||
|
*/
|
||||||
|
private $oForm;
|
||||||
|
|
||||||
function execute() {
|
function execute() {
|
||||||
if ($this->actionEditRequested()) {
|
if ($this->actionEditRequested()) {
|
||||||
$this->actionEdit();
|
$this->actionEdit();
|
||||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Controller;
|
||||||
|
|
||||||
class Cli extends \Flake\Core\Render\Container {
|
class Cli extends \Flake\Core\Render\Container {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $aArgs;
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
$this->sys_init();
|
$this->sys_init();
|
||||||
$this->init();
|
$this->init();
|
||||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Controller;
|
||||||
|
|
||||||
class HtmlBlock extends \Flake\Core\Controller {
|
class HtmlBlock extends \Flake\Core\Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $sHtml;
|
||||||
|
|
||||||
function __construct($sHtml) {
|
function __construct($sHtml) {
|
||||||
$this->sHtml = $sHtml;
|
$this->sHtml = $sHtml;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,16 @@ namespace Flake\Controller;
|
||||||
|
|
||||||
class HtmlBlockTemplated extends \Flake\Core\Controller {
|
class HtmlBlockTemplated extends \Flake\Core\Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $sTemplatePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $aMarkers;
|
||||||
|
|
||||||
function __construct($sTemplatePath, $aMarkers = []) {
|
function __construct($sTemplatePath, $aMarkers = []) {
|
||||||
$this->sTemplatePath = $sTemplatePath;
|
$this->sTemplatePath = $sTemplatePath;
|
||||||
$this->aMarkers = $aMarkers;
|
$this->aMarkers = $aMarkers;
|
||||||
|
@ -42,4 +52,9 @@ class HtmlBlockTemplated extends \Flake\Core\Controller {
|
||||||
|
|
||||||
return $sHtml;
|
return $sHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function execute()
|
||||||
|
{
|
||||||
|
// TODO: Implement execute() method.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,11 @@ class Page extends \Flake\Core\Render\Container {
|
||||||
protected $sMetaDescription = "";
|
protected $sMetaDescription = "";
|
||||||
protected $sTemplatePath = "";
|
protected $sTemplatePath = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $sBaseUrl;
|
||||||
|
|
||||||
function __construct($sTemplatePath) {
|
function __construct($sTemplatePath) {
|
||||||
$this->sTemplatePath = $sTemplatePath;
|
$this->sTemplatePath = $sTemplatePath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Core;
|
||||||
|
|
||||||
abstract class Database extends \Flake\Core\FLObject {
|
abstract class Database extends \Flake\Core\FLObject {
|
||||||
|
|
||||||
|
private $debugOutput;
|
||||||
|
private $debug_lastBuiltQuery;
|
||||||
|
private $store_lastBuiltQuery;
|
||||||
|
private $oDb;
|
||||||
|
|
||||||
/* common stuff */
|
/* common stuff */
|
||||||
|
|
||||||
protected function messageAndDie($sMessage) {
|
protected function messageAndDie($sMessage) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ abstract class Db extends \Flake\Core\Model {
|
||||||
return $oRequester;
|
return $oRequester;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function &getByRequest(\FS\Core\Requester\Sql $oRequester) {
|
static function &getByRequest(\Flake\Core\Requester\Sql $oRequester) {
|
||||||
// renvoie une collection de la classe du modèle courant (this)
|
// renvoie une collection de la classe du modèle courant (this)
|
||||||
return $oRequester->execute();
|
return $oRequester->execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Core;
|
||||||
|
|
||||||
abstract class PostConnectionService extends \Flake\Core\FLObject {
|
abstract class PostConnectionService extends \Flake\Core\FLObject {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $aParams;
|
||||||
|
|
||||||
function __construct($aParams = []) {
|
function __construct($aParams = []) {
|
||||||
$this->aParams = $aParams;
|
$this->aParams = $aParams;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
namespace Flake\Core\Render;
|
namespace Flake\Core\Render;
|
||||||
|
|
||||||
class Zone extends \Flake\Core\FLObject {
|
class Zone extends \Flake\Core\FLObject {
|
||||||
|
private $oZonableObject;
|
||||||
|
private $sZone;
|
||||||
|
|
||||||
function __construct(&$oZonableObject, $sZone) {
|
function __construct(&$oZonableObject, $sZone) {
|
||||||
$this->oZonableObject = & $oZonableObject;
|
$this->oZonableObject = & $oZonableObject;
|
||||||
$this->sZone = $sZone;
|
$this->sZone = $sZone;
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
namespace Flake\Core;
|
namespace Flake\Core;
|
||||||
|
|
||||||
abstract class Requester extends \Flake\Core\FLObject {
|
abstract class Requester extends \Flake\Core\FLObject {
|
||||||
|
protected $sModelClass = '';
|
||||||
|
protected $sOrderField = '';
|
||||||
|
protected $sOrderDirection = 'ASC';
|
||||||
|
protected $iLimitStart = false;
|
||||||
|
protected $iLimitNumber = false;
|
||||||
|
|
||||||
function __construct($sModelClass) {
|
function __construct($sModelClass) {
|
||||||
$this->sModelClass = $sModelClass;
|
$this->sModelClass = $sModelClass;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +67,7 @@ abstract class Requester extends \Flake\Core\FLObject {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract function addClauseEquals($sField, $sValue);
|
||||||
abstract function execute();
|
abstract function execute();
|
||||||
abstract function count();
|
abstract function count();
|
||||||
}
|
}
|
||||||
|
|
22
phpstan.neon
Normal file
22
phpstan.neon
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
parameters:
|
||||||
|
level: 0
|
||||||
|
excludes_analyse:
|
||||||
|
- Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/generate-sprite.php
|
||||||
|
- Core/Resources/Web/BaikalAdmin/GlyphiconsPro/generate-sprite.php
|
||||||
|
- html/res/core/BaikalAdmin/GlyphiconsPro/generate-sprite.php
|
||||||
|
ignoreErrors:
|
||||||
|
-
|
||||||
|
message: '#Instantiated class Flake\\Core\\Exception not found.#'
|
||||||
|
path: Core/Frameworks/Flake/Util/Frameworks.php
|
||||||
|
-
|
||||||
|
message: '#Call to an undefined method Baikal\\Model\\Config\\Standard::getDefaultSystemConfig\(\).#'
|
||||||
|
path: Core/Frameworks/Baikal/Model/Config/Standard.php
|
||||||
|
-
|
||||||
|
message: '#Call to static method compileCss\(\) on an unknown class Frameworks\\LessPHP\\Delegate.#'
|
||||||
|
path: Core/Frameworks/Flake/Controller/Page.php
|
||||||
|
-
|
||||||
|
message: '#Access to undefined constant Flake\\Core\\Model::LABELFIELD.#'
|
||||||
|
path: Core/Frameworks/Flake/Core/Model.php
|
||||||
|
-
|
||||||
|
message: '#Declaration of Flake\\Core\\Datastructure\\Chain::push\(Flake\\Core\\Datastructure\\Chainable \$value\) should be compatible with SplDoublyLinkedList::push\(\$value\)#'
|
||||||
|
path: Core/Frameworks/Flake/Core/Datastructure/Chain.php
|
Loading…
Add table
Add a link
Reference in a new issue