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
|
||||
|
||||
env:
|
||||
global:
|
||||
- RUN_PHPSTAN="FALSE"
|
||||
matrix:
|
||||
- LOWEST_DEPS=""
|
||||
- LOWEST_DEPS="--prefer-lowest"
|
||||
- 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:
|
||||
- mysql
|
||||
|
@ -24,11 +37,12 @@ before_script:
|
|||
# - mysql -e 'create database sabredav'
|
||||
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
||||
# - composer self-update
|
||||
- composer update --prefer-source $LOWEST_DEPS
|
||||
- composer update $PREFER_LOWEST
|
||||
|
||||
script:
|
||||
- find Core -name "*.php" | xargs -n1 php -l
|
||||
- ./vendor/bin/sabre-cs-fixer fix . --dry-run --diff
|
||||
- if [ $RUN_PHPSTAN == "FALSE" ]; then find Core -name "*.php" | xargs -n1 php -l; fi
|
||||
- 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:
|
||||
directories:
|
||||
|
|
|
@ -34,6 +34,11 @@ class PDOBasicAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
|
|||
*/
|
||||
protected $authRealm;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $currentUser;
|
||||
|
||||
/**
|
||||
* Creates the backend object.
|
||||
*
|
||||
|
|
|
@ -29,6 +29,16 @@ namespace BaikalAdmin\Controller\Settings;
|
|||
|
||||
class Standard extends \Flake\Core\Controller {
|
||||
|
||||
/**
|
||||
* @var \Baikal\Model\Config\Standard
|
||||
*/
|
||||
private $oModel;
|
||||
|
||||
/**
|
||||
* @var \Formal\Form
|
||||
*/
|
||||
private $oForm;
|
||||
|
||||
function execute() {
|
||||
$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 {
|
||||
|
||||
/**
|
||||
* @var \Baikal\Model\Config\System
|
||||
*/
|
||||
private $oModel;
|
||||
|
||||
/**
|
||||
* @var \Formal\Form
|
||||
*/
|
||||
private $oForm;
|
||||
|
||||
function execute() {
|
||||
$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 = [];
|
||||
|
||||
/**
|
||||
* @var \Baikal\Model\User
|
||||
*/
|
||||
private $oModel;
|
||||
|
||||
/**
|
||||
* @var \Formal\Form
|
||||
*/
|
||||
private $oForm;
|
||||
|
||||
function execute() {
|
||||
if ($this->actionEditRequested()) {
|
||||
$this->actionEdit();
|
||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Controller;
|
|||
|
||||
class Cli extends \Flake\Core\Render\Container {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $aArgs;
|
||||
|
||||
function render() {
|
||||
$this->sys_init();
|
||||
$this->init();
|
||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Controller;
|
|||
|
||||
class HtmlBlock extends \Flake\Core\Controller {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sHtml;
|
||||
|
||||
function __construct($sHtml) {
|
||||
$this->sHtml = $sHtml;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,16 @@ namespace Flake\Controller;
|
|||
|
||||
class HtmlBlockTemplated extends \Flake\Core\Controller {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sTemplatePath;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $aMarkers;
|
||||
|
||||
function __construct($sTemplatePath, $aMarkers = []) {
|
||||
$this->sTemplatePath = $sTemplatePath;
|
||||
$this->aMarkers = $aMarkers;
|
||||
|
@ -42,4 +52,9 @@ class HtmlBlockTemplated extends \Flake\Core\Controller {
|
|||
|
||||
return $sHtml;
|
||||
}
|
||||
|
||||
function execute()
|
||||
{
|
||||
// TODO: Implement execute() method.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,11 @@ class Page extends \Flake\Core\Render\Container {
|
|||
protected $sMetaDescription = "";
|
||||
protected $sTemplatePath = "";
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sBaseUrl;
|
||||
|
||||
function __construct($sTemplatePath) {
|
||||
$this->sTemplatePath = $sTemplatePath;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Core;
|
|||
|
||||
abstract class Database extends \Flake\Core\FLObject {
|
||||
|
||||
private $debugOutput;
|
||||
private $debug_lastBuiltQuery;
|
||||
private $store_lastBuiltQuery;
|
||||
private $oDb;
|
||||
|
||||
/* common stuff */
|
||||
|
||||
protected function messageAndDie($sMessage) {
|
||||
|
|
|
@ -49,7 +49,7 @@ abstract class Db extends \Flake\Core\Model {
|
|||
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)
|
||||
return $oRequester->execute();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@ namespace Flake\Core;
|
|||
|
||||
abstract class PostConnectionService extends \Flake\Core\FLObject {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $aParams;
|
||||
|
||||
function __construct($aParams = []) {
|
||||
$this->aParams = $aParams;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
namespace Flake\Core\Render;
|
||||
|
||||
class Zone extends \Flake\Core\FLObject {
|
||||
private $oZonableObject;
|
||||
private $sZone;
|
||||
|
||||
function __construct(&$oZonableObject, $sZone) {
|
||||
$this->oZonableObject = & $oZonableObject;
|
||||
$this->sZone = $sZone;
|
||||
|
|
|
@ -28,6 +28,12 @@
|
|||
namespace Flake\Core;
|
||||
|
||||
abstract class Requester extends \Flake\Core\FLObject {
|
||||
protected $sModelClass = '';
|
||||
protected $sOrderField = '';
|
||||
protected $sOrderDirection = 'ASC';
|
||||
protected $iLimitStart = false;
|
||||
protected $iLimitNumber = false;
|
||||
|
||||
function __construct($sModelClass) {
|
||||
$this->sModelClass = $sModelClass;
|
||||
}
|
||||
|
@ -61,6 +67,7 @@ abstract class Requester extends \Flake\Core\FLObject {
|
|||
return $this;
|
||||
}
|
||||
|
||||
abstract function addClauseEquals($sField, $sValue);
|
||||
abstract function execute();
|
||||
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…
Reference in a new issue