Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting critical problems found by PHPStan #14290

Closed
szepeviktor opened this issue Mar 30, 2019 · 5 comments
Closed

Correcting critical problems found by PHPStan #14290

szepeviktor opened this issue Mar 30, 2019 · 5 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@szepeviktor
Copy link
Contributor

szepeviktor commented Mar 30, 2019

Do you have time to review my PRs based on this report? I wouldn't like to be the 68th PR.

$ phpstan analyze -l 0 -a phpstan.php core/ config/ misc/
 ------ -----------------------------------------------------------------------------------------------------------
  Line   config/environment/test.php
 ------ -----------------------------------------------------------------------------------------------------------
  56     Instantiated class Piwik\Tests\Framework\Mock\TestConfig not found.
  69     Instantiated class Piwik\Tests\Framework\Mock\FakeAccess not found.
  72     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  72     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  73     Access to static property $idSitesView on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  73     Access to static property $idSitesView on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  74     Access to static property $idSitesWrite on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  74     Access to static property $idSitesWrite on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  75     Access to static property $idSitesAdmin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  75     Access to static property $idSitesAdmin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  76     Access to static property $identity on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  76     Access to static property $identity on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  78     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  78     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  79     Access to static property $idSitesWrite on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  79     Access to static property $idSitesWrite on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  80     Access to static property $idSitesAdmin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  80     Access to static property $idSitesAdmin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  81     Access to static property $identity on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  81     Access to static property $identity on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  83     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  83     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  84     Access to static property $idSitesAdmin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  84     Access to static property $idSitesAdmin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  85     Access to static property $identity on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  85     Access to static property $identity on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  87     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  87     Access to static property $superUser on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  88     Access to static property $superUserLogin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  88     Access to static property $superUserLogin on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  91     Access to static property $idSitesCapabilities on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
  91     Access to static property $idSitesCapabilities on an unknown class Piwik\Tests\Framework\Mock\FakeAccess.
 ------ -----------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------
  Line   config/environment/ui-test.php
 ------ -----------------------------------------------------------------------------------------------------
  59     Call to static method getJavaScriptAddEvent() on an unknown class Piwik\Tests\Framework\XssTesting.
 ------ -----------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------
  Line   core/API/DataTablePostProcessor.php
 ------ ---------------------------------------------------
  317    Anonymous function has an unused use $allColumns.
 ------ ---------------------------------------------------

 ------ ----------------------------------------------------------------------------------------
  Line   core/API/Request.php
 ------ ----------------------------------------------------------------------------------------
  216    Return typehint of method Piwik\API\Request::process() has invalid type Piwik\API\Map.
 ------ ----------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------
  Line   core/API/ResponseBuilder.php
 ------ -----------------------------------------------------------
  43     Function Piwik_ShouldPrintBackTraceWithMessage not found.
 ------ -----------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------
  Line   core/Access.php
 ------ -------------------------------------------------------------------------------------------------------
  618    Parameter $function of method Piwik\Access::doAsSuperUser() has invalid typehint type Piwik\callback.
 ------ -------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------------
  Line   core/Application/Kernel/PluginList.php
 ------ -----------------------------------------------------------------------------------------------------------------------------
  101    Return typehint of method Piwik\Application\Kernel\PluginList::sortPlugins() has invalid type string.
  140    Return typehint of method Piwik\Application\Kernel\PluginList::sortPluginsAndRespectDependencies() has invalid type string.
 ------ -----------------------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------
  Line   core/ArchiveProcessor/PluginsArchiver.php
 ------ ----------------------------------------------------------------------------------------------
  62     Access to an undefined property Piwik\ArchiveProcessor\PluginsArchiver::$isTemporaryArchive.
  63     Access to an undefined property Piwik\ArchiveProcessor\PluginsArchiver::$archiveWriter.
  191    Access to an undefined property Piwik\ArchiveProcessor\PluginsArchiver::$archiveWriter.
  192    Access to an undefined property Piwik\ArchiveProcessor\PluginsArchiver::$archiveWriter.
  193    Access to an undefined property Piwik\ArchiveProcessor\PluginsArchiver::$archiveWriter.
  314    Access to an undefined property Piwik\ArchiveProcessor\PluginsArchiver::$isTemporaryArchive.
 ------ ----------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------
  Line   core/AssetManager.php
 ------ ------------------------------------------------------------------------------------------
  68     Piwik\AssetManager::__construct() does not call parent constructor from Piwik\Singleton.
 ------ ------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------
  Line   core/AssetManager/UIAssetMerger.php
 ------ --------------------------------------------------------------------------------------
  183    Access to an undefined property Piwik\AssetManager\UIAssetMerger::$cacheBusterValue.
 ------ --------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------
  Line   core/Columns/Join/ActionNameJoin.php
 ------ ------------------------------------------------------------------------------------------------------------
  19     Piwik\Columns\Join\ActionNameJoin::__construct() does not call parent constructor from Piwik\Columns\Join.
  21     Result of method Piwik\Columns\Join::__construct() (void) is used.
 ------ ------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------
  Line   core/Columns/Join/GoalNameJoin.php
 ------ ----------------------------------------------------------------------------------------------------------
  19     Piwik\Columns\Join\GoalNameJoin::__construct() does not call parent constructor from Piwik\Columns\Join.
  21     Result of method Piwik\Columns\Join::__construct() (void) is used.
 ------ ----------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------
  Line   core/Columns/Join/SiteNameJoin.php
 ------ ----------------------------------------------------------------------------------------------------------
  19     Piwik\Columns\Join\SiteNameJoin::__construct() does not call parent constructor from Piwik\Columns\Join.
  21     Result of method Piwik\Columns\Join::__construct() (void) is used.
 ------ ----------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------
  Line   core/Cookie.php
 ------ ----------------------------------------------------------
  95     Access to an undefined property Piwik\Cookie::$keyStore.
  332    Access to an undefined property Piwik\Cookie::$keyStore.
  340    Access to an undefined property Piwik\Cookie::$keyStore.
  357    Access to an undefined property Piwik\Cookie::$keyStore.
 ------ ----------------------------------------------------------

 ------ --------------------------------------------------------------------------------------
  Line   core/DataAccess/ArchiveWriter.php
 ------ --------------------------------------------------------------------------------------
  66     Access to an undefined property Piwik\DataAccess\ArchiveWriter::$idArchive.
  67     Access to an undefined property Piwik\DataAccess\ArchiveWriter::$idSite.
  68     Access to an undefined property Piwik\DataAccess\ArchiveWriter::$segment.
  69     Access to an undefined property Piwik\DataAccess\ArchiveWriter::$period.
  72     Access to an undefined property Piwik\DataAccess\ArchiveWriter::$doneFlag.
  73     Access to an undefined property Piwik\DataAccess\ArchiveWriter::$isArchiveTemporary.
  75     Access to an undefined property Piwik\DataAccess\ArchiveWriter::$dateStart.
  116    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$idArchive.
  134    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$doneFlag.
  152    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$idArchive.
  163    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$doneFlag.
  170    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$isArchiveTemporary.
  174    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$doneFlag.
  246    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$idSite.
  247    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$dateStart.
  248    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$period.
  249    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$period.
  259    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$dateStart.
  264    Access to an undefined property Piwik\DataAccess\ArchiveWriter::$dateStart.
 ------ --------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------
  Line   core/DataAccess/LogQueryBuilder/JoinTables.php
 ------ ---------------------------------------------------------------------------------------------------------------
  61     Piwik\DataAccess\LogQueryBuilder\JoinTables::__construct() does not call parent constructor from ArrayObject.
 ------ ---------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------
  Line   core/DataArray.php
 ------ -------------------------------------------------------------------------------------
  257    Method Piwik\DataArray::doSumEventsMetrics() invoked with 3 parameters, 2 required.
 ------ -------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------
  Line   core/DataTable/BaseFilter.php
 ------ ---------------------------------------------------------------------------------
  42     Constructor of class Piwik\DataTable\BaseFilter has an unused parameter $table.
 ------ ---------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php
 ------ -------------------------------------------------------------------------------------------------------------
  86     Constructor of class Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal has an unused parameter $enable.
  88     Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$processOnlyIdGoal.
  89     Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$isEcommerce.
  93     Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$goalsToProcess.
  118    Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$processOnlyIdGoal.
  120    Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$processOnlyIdGoal.
  121    Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$isEcommerce.
  122    Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$processOnlyIdGoal.
  131    Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$processOnlyIdGoal.
  139    Access to an undefined property Piwik\DataTable\Filter\AddColumnsProcessedMetricsGoal::$isEcommerce.
 ------ -------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/AddSegmentByRangeLabel.php
 ------ ------------------------------------------------------------------------------------------
  39     Access to an undefined property Piwik\DataTable\Filter\AddSegmentByRangeLabel::$segment.
 ------ ------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/AddSummaryRow.php
 ------ -----------------------------------------------------------------------------------------
  38     Access to an undefined property Piwik\DataTable\Filter\AddSummaryRow::$labelSummaryRow.
  49     Access to an undefined property Piwik\DataTable\Filter\AddSummaryRow::$labelSummaryRow.
 ------ -----------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/ColumnCallbackDeleteRow.php
 ------ -----------------------------------------------------------------------------------------------------------------------
  42     Parameter $function of method Piwik\DataTable\Filter\ColumnCallbackDeleteRow::__construct() has invalid typehint type
         Piwik\DataTable\Filter\callback.
  55     Access to an undefined property Piwik\DataTable\Filter\ColumnCallbackDeleteRow::$columnsToFilter.
  68     Access to an undefined property Piwik\DataTable\Filter\ColumnCallbackDeleteRow::$columnsToFilter.
 ------ -----------------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/ExcludeLowPopulation.php
 ------ -----------------------------------------------------------------------------------------------
  69     Access to an undefined property Piwik\DataTable\Filter\ExcludeLowPopulation::$columnToFilter.
 ------ -----------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------
  Line   core/DataTable/Filter/Limit.php
 ------ --------------------------------------------------------------------------------
  38     Access to an undefined property Piwik\DataTable\Filter\Limit::$offset.
  39     Access to an undefined property Piwik\DataTable\Filter\Limit::$limit.
  40     Access to an undefined property Piwik\DataTable\Filter\Limit::$keepSummaryRow.
  52     Access to an undefined property Piwik\DataTable\Filter\Limit::$keepSummaryRow.
  57     Access to an undefined property Piwik\DataTable\Filter\Limit::$offset.
  58     Access to an undefined property Piwik\DataTable\Filter\Limit::$offset.
  61     Access to an undefined property Piwik\DataTable\Filter\Limit::$limit.
  62     Access to an undefined property Piwik\DataTable\Filter\Limit::$limit.
 ------ --------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/RangeCheck.php
 ------ -------------------------------------------------------------------------------------
  33     Access to an undefined property Piwik\DataTable\Filter\RangeCheck::$columnToFilter.
  49     Access to an undefined property Piwik\DataTable\Filter\RangeCheck::$columnToFilter.
  52     Access to an undefined property Piwik\DataTable\Filter\RangeCheck::$columnToFilter.
  55     Access to an undefined property Piwik\DataTable\Filter\RangeCheck::$columnToFilter.
  57     Access to an undefined property Piwik\DataTable\Filter\RangeCheck::$columnToFilter.
  65     Access to an undefined property Piwik\DataTable\Filter\RangeCheck::$columnToFilter.
  67     Access to an undefined property Piwik\DataTable\Filter\RangeCheck::$columnToFilter.
 ------ -------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/ReplaceSummaryRowLabel.php
 ------ -------------------------------------------------------------------------------------------
  45     Access to an undefined property Piwik\DataTable\Filter\ReplaceSummaryRowLabel::$newLabel.
  57     Access to an undefined property Piwik\DataTable\Filter\ReplaceSummaryRowLabel::$newLabel.
  61     Access to an undefined property Piwik\DataTable\Filter\ReplaceSummaryRowLabel::$newLabel.
 ------ -------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/Sort.php
 ------ -------------------------------------------------------------------------------------------------------------------
  49     Parameter $doSortBySecondaryColumn of method Piwik\DataTable\Filter\Sort::__construct() has invalid typehint type
         Piwik\DataTable\Filter\callback.
 ------ -------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------
  Line   core/DataTable/Filter/Truncate.php
 ------ ---------------------------------------------------------------------------------------------------
  56     Access to an undefined property Piwik\DataTable\Filter\Truncate::$truncateAfter.
  60     Access to an undefined property Piwik\DataTable\Filter\Truncate::$labelSummaryRow.
  61     Access to an undefined property Piwik\DataTable\Filter\Truncate::$columnToSortByBeforeTruncating.
  62     Access to an undefined property Piwik\DataTable\Filter\Truncate::$filterRecursive.
  72     Access to an undefined property Piwik\DataTable\Filter\Truncate::$truncateAfter.
  77     Access to an undefined property Piwik\DataTable\Filter\Truncate::$labelSummaryRow.
  79     Access to an undefined property Piwik\DataTable\Filter\Truncate::$filterRecursive.
  93     Access to an undefined property Piwik\DataTable\Filter\Truncate::$truncateAfter.
  97     Access to an undefined property Piwik\DataTable\Filter\Truncate::$columnToSortByBeforeTruncating.
  105    Access to an undefined property Piwik\DataTable\Filter\Truncate::$truncateAfter.
  119    Access to an undefined property Piwik\DataTable\Filter\Truncate::$truncateAfter.
 ------ ---------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------
  Line   core/DataTable/Row.php
 ------ ---------------------------------------------------------------------------------------
  66     Piwik\DataTable\Row::__construct() does not call parent constructor from ArrayObject.
 ------ ---------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------
  Line   core/DataTable/Row/DataTableSummaryRow.php
 ------ -------------------------------------------------------------------------------------------------------------------
  35     Piwik\DataTable\Row\DataTableSummaryRow::__construct() does not call parent constructor from Piwik\DataTable\Row.
 ------ -------------------------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------
  Line   core/Db/Adapter/Pdo/Mssql.php
 ------ --------------------------------------------------------------------------------
  82     Call to an undefined static method Piwik\Db\Adapter\Pdo\Mssql::FormatErrors().
  98     Access to undefined constant PDO::SQLSRV_ENCODING_UTF8.
 ------ --------------------------------------------------------------------------------

 ------ -----------------------------------------------
  Line   core/ExceptionHandler.php
 ------ -----------------------------------------------
  128    Function Piwik_GetErrorMessagePage not found.
 ------ -----------------------------------------------

 ------ ----------------------------------------------------------------------
  Line   core/FileIntegrity.php
 ------ ----------------------------------------------------------------------
  203    Access to static property $files on an unknown class Piwik\Manifest.
  248    Access to static property $files on an unknown class Piwik\Manifest.
  265    Access to static property $files on an unknown class Piwik\Manifest.
  319    Access to static property $files on an unknown class Piwik\Manifest.
 ------ ----------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------
  Line   core/Log.php
 ------ ---------------------------------------------------------------------------------
  110    Piwik\Log::__construct() does not call parent constructor from Piwik\Singleton.
 ------ ---------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------
  Line   core/Period/Range.php
 ------ ---------------------------------------------------------------------------------------
  57     Piwik\Period\Range::__construct() does not call parent constructor from Piwik\Period.
 ------ ---------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------
  Line   core/Piwik.php
 ------ ------------------------------------------------------------------------------------------------------
  838    Parameter $function of method Piwik\Piwik::doAsSuperUser() has invalid typehint type Piwik\callback.
 ------ ------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------
  Line   core/Plugin/Archiver.php
 ------ ----------------------------------------------------------------------
  76     Access to an undefined property Piwik\Plugin\Archiver::$maximumRows.
 ------ ----------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------------------------
  Line   core/Plugin/ComponentFactory.php
 ------ ---------------------------------------------------------------------------------------------------------------------------------
  77     Parameter $predicate of method Piwik\Plugin\ComponentFactory::getComponentIf() has invalid typehint type Piwik\Plugin\callback.
 ------ ---------------------------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------
  Line   core/Plugin/ControllerAdmin.php
 ------ ------------------------------------------------
  249    Undefined variable: $deprecatedMajorPhpVersion
  251    Undefined variable: $deprecatedMajorPhpVersion
 ------ ------------------------------------------------

 ------ -----------------------------------------------------------
  Line   core/Plugin/Visualization.php
 ------ -----------------------------------------------------------
  203    Function Piwik_ShouldPrintBackTraceWithMessage not found.
 ------ -----------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------
  Line   core/Profiler.php
 ------ -----------------------------------------------------------------------------------------------------------------------
  233    Function Piwik\xhprof_error not found while trying to analyse it - autoloading is probably not configured properly.
  233    Inner named functions are not supported by PHPStan. Consider refactoring to an anonymous function, class method, or a
         top-level-defined function. See issue #165 (https://github.com/phpstan/phpstan/issues/165) for more details.
  252    Function tideways_xhprof_enable not found.
  261    Function tideways_xhprof_disable not found.
 ------ -----------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------
  Line   core/QuickForm2.php
 ------ ---------------------------------------------------------------
  82     Access to an undefined property Piwik\QuickForm2::$_elements.
  84     Access to an undefined property Piwik\QuickForm2::$_elements.
  91     Access to an undefined property Piwik\QuickForm2::$_elements.
  93     Access to an undefined property Piwik\QuickForm2::$_elements.
 ------ ---------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------------------
  Line   core/ReportRenderer/Pdf.php
 ------ ------------------------------------------------------------------------------------------------------------------------------
         Piwik\Container\ContainerDoesNotExistException (The root container has not been created yet.) thrown while autoloading class
         Piwik\ReportRenderer\Pdf.
 ------ ------------------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------------
  Line   core/Scheduler/Schedule/Schedule.php
 ------ ---------------------------------------------------------------------------------------------------------------------
  210    Class Piwik\Scheduler\Schedule\Monthly does not have a constructor and must be instantiated without any parameters.
 ------ ---------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------
  Line   core/Segment/SegmentExpression.php
 ------ ---------------------------------------------------------------------------
  58     Access to an undefined property Piwik\Segment\SegmentExpression::$string.
  64     Access to an undefined property Piwik\Segment\SegmentExpression::$string.
  392    Access to an undefined property Piwik\Segment\SegmentExpression::$string.
 ------ ---------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------
  Line   core/Tracker/Db/Mysqli.php
 ------ -----------------------------------------------------------------------------------
  44     Constructor of class Piwik\Tracker\Db\Mysqli has an unused parameter $driverName.
  289    Access to an undefined property Piwik\Tracker\Db\Mysqli::$paramNb.
  298    Access to an undefined property Piwik\Tracker\Db\Mysqli::$paramNb.
  298    Access to an undefined property Piwik\Tracker\Db\Mysqli::$params.
  299    Access to an undefined property Piwik\Tracker\Db\Mysqli::$paramNb.
 ------ -----------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------
  Line   core/Tracker/GoalManager.php
 ------ -----------------------------------------------------------------------------------------------------------
  151    Return typehint of method Piwik\Tracker\GoalManager::detectGoalMatch() has invalid type Piwik\Tracker\if.
 ------ -----------------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------
  Line   core/Tracker/Request.php
 ------ --------------------------------------------------------------------
  72     Access to an undefined property Piwik\Tracker\Request::$timestamp.
  463    Access to an undefined property Piwik\Tracker\Request::$timestamp.
  468    Access to an undefined property Piwik\Tracker\Request::$timestamp.
  487    Access to an undefined property Piwik\Tracker\Request::$timestamp.
  493    Access to an undefined property Piwik\Tracker\Request::$timestamp.
 ------ --------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------
  Line   core/Tracker/TableLogAction/Cache.php
 ------ --------------------------------------------------------------------------------------
  41     Access to an undefined property Piwik\Tracker\TableLogAction\Cache::$limitActionIds.
  158    Access to an undefined property Piwik\Tracker\TableLogAction\Cache::$limitActionIds.
 ------ --------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------
  Line   core/Tracker/VisitExcluded.php
 ------ --------------------------------------------------------------------------
  38     Access to an undefined property Piwik\Tracker\VisitExcluded::$request.
  41     Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  45     Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  48     Access to an undefined property Piwik\Tracker\VisitExcluded::$userAgent.
  49     Access to an undefined property Piwik\Tracker\VisitExcluded::$ip.
  76     Access to an undefined property Piwik\Tracker\VisitExcluded::$request.
  95     Access to an undefined property Piwik\Tracker\VisitExcluded::$request.
  176    Access to an undefined property Piwik\Tracker\VisitExcluded::$request.
  178    Access to an undefined property Piwik\Tracker\VisitExcluded::$userAgent.
  188    Access to an undefined property Piwik\Tracker\VisitExcluded::$ip.
  278    Access to an undefined property Piwik\Tracker\VisitExcluded::$ip.
  290    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  291    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  294    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  295    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  295    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  297    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  298    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  318    Access to an undefined property Piwik\Tracker\VisitExcluded::$request.
  322    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  325    Access to an undefined property Piwik\Tracker\VisitExcluded::$idSite.
  349    Access to an undefined property Piwik\Tracker\VisitExcluded::$userAgent.
  365    Access to an undefined property Piwik\Tracker\VisitExcluded::$request.
 ------ --------------------------------------------------------------------------

 ------ ----------------------------------------
  Line   core/Twig.php
 ------ ----------------------------------------
  69     Function twig_escape_filter not found.
  354    Function twig_escape_filter not found.
  363    Function twig_escape_filter not found.
 ------ ----------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------------
  Line   core/bootstrap.php
 ------ ----------------------------------------------------------------------------------------------------------------------
  37     Function disableEaccelerator not found.
  54     Function disableEaccelerator not found while trying to analyse it - autoloading is probably not configured properly.
 ------ ----------------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------------------
  Line   core/testMinimumPhpVersion.php
 ------ ------------------------------------------------------------------------------------------------------------------------------
  85     Function Piwik_ShouldPrintBackTraceWithMessage not found while trying to analyse it - autoloading is probably not configured
         properly.
  112    Function Piwik_GetErrorMessagePage not found while trying to analyse it - autoloading is probably not configured properly.
  175    Function Piwik_ShouldPrintBackTraceWithMessage not found.
  194    Function Piwik_GetErrorMessagePage not found.
 ------ ------------------------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------
  Line   misc/cron/updatetoken.php
 ------ -----------------------------------------------------------------------------------------------------------------------
  40     Instantiated class Piwik\Tests\Framework\TestingEnvironmentManipulator not found.
  40     Instantiated class Piwik\Tests\Framework\TestingEnvironmentVariables not found.
  43     Function Piwik\getPiwikDomain not found while trying to analyse it - autoloading is probably not configured properly.
  55     Function getPiwikDomain not found.
 ------ -----------------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------
  Line   misc/others/uninstall-delete-piwik-directory.php
 ------ ------------------------------------------------------------------------------------------------------------------
  13     Function unlinkRecursive not found while trying to analyse it - autoloading is probably not configured properly.
  21     Function unlinkRecursive not found.
  29     Function unlinkRecursive not found.
 ------ ------------------------------------------------------------------------------------------------------------------


 [ERROR] Found 208 errors
@szepeviktor
Copy link
Contributor Author

szepeviktor commented Mar 30, 2019

Only PIWIK_* constants are in phpstan.php

These are PHPStan Level 0 (of 0-7), later we can go higher.

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Mar 30, 2019

phpstan.neon

# sed -e '16s#^#// #' -i plugins/ScheduledReports/config/tcpdf_config.php

parameters:
    level: max
    paths:
        - %currentWorkingDirectory%/core/
    #excludes_analyse:
    autoload_files:
        - %currentWorkingDirectory%/phpstan.php
        - %currentWorkingDirectory%/libs/upgradephp/upgrade.php
    #autoload_directories:
    ignoreErrors:
        - '#^PHPDoc tag @param#'
        - '#^Access to an undefined property Piwik\\#'

The two errors ignored above are very common, so it needs to be fixed First.

phpstan.php

<?php

if (!defined('PIWIK_DOCUMENT_ROOT')) {
    define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) == '/' ? '' : dirname(__FILE__));
}
if (!defined('PIWIK_INCLUDE_PATH')) {
    define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
}

if (!defined('PIWIK_PRINT_ERROR_BACKTRACE')) {
    define('PIWIK_PRINT_ERROR_BACKTRACE', false);
}
if (!defined('PIWIK_VENDOR_PATH')) {
    if (is_dir(PIWIK_INCLUDE_PATH . '/vendor')) {
        define('PIWIK_VENDOR_PATH', PIWIK_INCLUDE_PATH . '/vendor');
    } else {
        define('PIWIK_VENDOR_PATH', PIWIK_INCLUDE_PATH . '/../..');
    }
}

function disableEaccelerator() {}

@sgiehl
Copy link
Member

sgiehl commented Mar 30, 2019

Feel free to create PRs for code improvements. As long as they are not too big, we are happy to review and merge them.
Btw. please exclude all test files from your checks. It seems there are still some test config files included in the list above. e.g. config/environment/test.php or config/environment/ui-test.php

@szepeviktor
Copy link
Contributor Author

Thank you for the instructions!

@tsteur
Copy link
Member

tsteur commented Mar 30, 2019

Was going to say the same. If the PRs are small then we would review over the next weeks / months depending how many there are. In general we don't make changes to them just for the sake of an analysis tool unless you find a bug as it would be a time waster otherwise. Will close the issue and feel free to issue PRs

@tsteur tsteur closed this as completed Mar 30, 2019
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants