Skip to content

Commit

Permalink
Merge pull request 3liz#3936 from nworr/phpstan-fix-phpdoc-ignore-dao
Browse files Browse the repository at this point in the history
Fix phpdoc / update phpstan config to ignore Dao related method/properties
  • Loading branch information
rldhont authored Oct 23, 2023
2 parents 035bf17 + a933fcf commit dfd6d82
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 185 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function index()

// Create the form, or get the existing one if we are here because of
// a failed check
/** @var null|jFormsBase $form */
$form = jForms::get('admin~landing_page_content');
if (!$form) {
$form = jForms::create('admin~landing_page_content');
Expand Down Expand Up @@ -68,6 +69,8 @@ public function save()
{
try {
$form = jForms::fill('admin~landing_page_content');

/** @var null|jFormsBase $form */
if (!$form || !$form->check()) {
// no form... this was a direct call to the save action
// or content is invalid
Expand Down
28 changes: 9 additions & 19 deletions lizmap/modules/lizmap/lib/App/AppContextInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ public function getCoord();
*
* @param string $right the key of the right to check
* @param string $resource the id of a resource if any
* @param mixed $role
*
* @return bool true if the right is ok
*/
public function aclCheck($role, $resource = null);
public function aclCheck($right, $resource = null);

/**
* Retrieve the list of groups id, the current user is member of,
Expand Down Expand Up @@ -98,9 +97,6 @@ public function aclUserPrivateGroup($login = null);
* Retrieve the list of groups properties, the current user is member of,
* in the acl system.
*
* @param string $login login of the user. if not given, the current user
* is taken account
*
* @return array list of groups objects
*/
public function aclUserGroupsInfo();
Expand Down Expand Up @@ -183,8 +179,7 @@ public function logMessage($message, $cat = 'default');
* Log an Exception.
*
* @param \Exception $exception The exception to log
* @param string The category of the logged Exception
* @param mixed $cat
* @param string $cat The category of the logged Exception
*/
public function logException($exception, $cat = 'default');

Expand All @@ -200,13 +195,11 @@ public function createVirtualProfile($category, $name, $params);
/**
* Return the properties of a profile.
*
* @param string The profile category
* @param string the profile name
* @param bool If true and if the profile doesn't exist, throw an error
* instead of getting the default profile
* @param mixed $category
* @param mixed $name
* @param mixed $noDefault
*
* @param string $category The profile category
* @param string $name the profile name
* @param bool $noDefault If true and if the profile doesn't exist, throw an error
*
* @return array properties
*/
Expand All @@ -215,10 +208,8 @@ public function getProfile($category, $name = '', $noDefault = false);
/**
* Send an application event.
*
* @param string The name of the event
* @param array the parameters of the event
* @param mixed $eventName
* @param mixed $params
* @param string $eventName The name of the event
* @param array $params the parameters of the event
*
* @return object
*/
Expand Down Expand Up @@ -285,8 +276,7 @@ public function getUrl($selector);
* Returns the absolute Url.
*
* @param string $selector The Jelix selector of the Url
* @param array an associative array with the parameters of the Url
* @param mixed $params
* @param array $params an associative array with the parameters of the Url
*/
public function getFullUrl($selector, $params = array());

Expand Down
25 changes: 9 additions & 16 deletions lizmap/modules/lizmap/lib/App/JelixContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ public function getCoord()
*
* @param string $right the key of the right to check
* @param string $resource the id of a resource if any
* @param mixed $role
*
* @return bool The result of jAcl2::check()
*/
public function aclCheck($role, $resource = null)
public function aclCheck($right, $resource = null)
{
return \jAcl2::check($role, $resource);
return \jAcl2::check($right, $resource);
}

/**
Expand Down Expand Up @@ -217,8 +216,7 @@ public function logMessage($message, $cat = 'default')
* Log an Exception.
*
* @param \Exception $exception The exception to log
* @param string The category of the logged Exception
* @param mixed $cat
* @param string $cat The category of the logged Exception
*/
public function logException($exception, $cat = 'default')
{
Expand Down Expand Up @@ -254,13 +252,10 @@ public function createVirtualProfile($category, $name, $params)
/**
* Return the properties of a profile by calling jProfile::get().
*
* @param string The profile category
* @param string the profile name
* @param bool If true and if the profile doesn't exist, throw an error
* instead of getting the default profile
* @param mixed $category
* @param mixed $name
* @param mixed $noDefault
* @param string $category The profile category
* @param string $name the profile name
* @param bool $noDefault If true and if the profile doesn't exist, throw an error
* instead of getting the default profile
*
* @return array properties
*/
Expand All @@ -272,10 +267,8 @@ public function getProfile($category, $name = '', $noDefault = false)
/**
* Call jEvent::notify().
*
* @param string The name of the event
* @param array the parameters of the event
* @param mixed $name
* @param mixed $params
* @param string $name The name of the event
* @param array $params the parameters of the event
*
* @return \jEvent
*/
Expand Down
3 changes: 0 additions & 3 deletions lizmap/modules/view/controllers/lizMap.classic.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ class lizMapCtrl extends jController
/**
* Load the map page for the given project.
*
* @param string $repository name of the repository
* @param string $project name of the project
*
* @return jResponseHtml|jResponseRedirect with map and content for the chose Qgis project
*/
public function index()
Expand Down
147 changes: 0 additions & 147 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,41 +1,6 @@
parameters:
ignoreErrors:

-
message: "#^Access to an undefined property jEvent\\:\\:\\$tpl\\.$#"
count: 1
path: lizmap/modules/admin/classes/config.listener.php

-
message: "#^Call to an undefined method jDaoFactoryBase\\:\\:getDetailRange\\(\\)\\.$#"
count: 1
path: lizmap/modules/admin/controllers/logs.classic.php

-
message: "#^Call to an undefined method jDaoFactoryBase\\:\\:getSortedCounter\\(\\)\\.$#"
count: 1
path: lizmap/modules/admin/controllers/logs.classic.php

-
message: "#^Access to an undefined property jDaoRecordBase\\:\\:\\$id_aclgrp\\.$#"
count: 1
path: lizmap/modules/admin/controllers/maps.classic.php

-
message: "#^Access to an undefined property jDaoRecordBase\\:\\:\\$name\\.$#"
count: 1
path: lizmap/modules/admin/controllers/maps.classic.php

-
message: "#^Call to an undefined method jDaoFactoryBase\\:\\:findAllPublicGroup\\(\\)\\.$#"
count: 2
path: lizmap/modules/admin/controllers/maps.classic.php

-
message: "#^Call to an undefined method jDaoFactoryBase\\:\\:findAllSubject\\(\\)\\.$#"
count: 2
path: lizmap/modules/admin/controllers/maps.classic.php

-
message: "#^Comparison operation \"\\=\\=\" between 0\\|0\\.0\\|''\\|'0'\\|array\\{\\}\\|false\\|null and 0 results in an error\\.$#"
count: 1
Expand Down Expand Up @@ -365,25 +330,6 @@ parameters:
count: 1
path: lizmap/modules/lizmap/controllers/edition.classic.php

-
message: "#^Access to an undefined property jDaoRecordBase\\:\\:\\$login\\.$#"
count: 1
path: lizmap/modules/lizmap/controllers/geobookmark.classic.php

-
message: "#^Access to an undefined property jDaoRecordBase\\:\\:\\$map\\.$#"
count: 1
path: lizmap/modules/lizmap/controllers/geobookmark.classic.php

-
message: "#^Access to an undefined property jDaoRecordBase\\:\\:\\$name\\.$#"
count: 1
path: lizmap/modules/lizmap/controllers/geobookmark.classic.php

-
message: "#^Access to an undefined property jDaoRecordBase\\:\\:\\$params\\.$#"
count: 1
path: lizmap/modules/lizmap/controllers/geobookmark.classic.php

-
message: "#^Access to an undefined property jResponse\\:\\:\\$data\\.$#"
Expand Down Expand Up @@ -455,91 +401,6 @@ parameters:
count: 1
path: lizmap/modules/lizmap/install/upgrade_configjcommunity.php

-
message: "#^PHPDoc tag @param has invalid value \\(array an associative array with the parameters of the Url\\)\\: Unexpected token \"an\", expected variable at offset 125$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param has invalid value \\(array the parameters of the event\\)\\: Unexpected token \"the\", expected variable at offset 108$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: """
#^PHPDoc tag @param has invalid value \\(bool If true and if the profile doesn't exist, throw an error
instead of getting the default profile\\)\\: Unexpected token "If", expected variable at offset 153$#
"""
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param has invalid value \\(string The category of the logged Exception\\)\\: Unexpected token \"The\", expected variable at offset 114$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param has invalid value \\(string The name of the event\\)\\: Unexpected token \"The\", expected variable at offset 66$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param has invalid value \\(string The profile category\\)\\: Unexpected token \"The\", expected variable at offset 75$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param has invalid value \\(string the profile name\\)\\: Unexpected token \"the\", expected variable at offset 117$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$login$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$right$#"
count: 1
path: lizmap/modules/lizmap/lib/App/AppContextInterface.php

-
message: "#^PHPDoc tag @param has invalid value \\(array the parameters of the event\\)\\: Unexpected token \"the\", expected variable at offset 104$#"
count: 1
path: lizmap/modules/lizmap/lib/App/JelixContext.php

-
message: """
#^PHPDoc tag @param has invalid value \\(bool If true and if the profile doesn't exist, throw an error
instead of getting the default profile\\)\\: Unexpected token "If", expected variable at offset 180$#
"""
count: 1
path: lizmap/modules/lizmap/lib/App/JelixContext.php

-
message: "#^PHPDoc tag @param has invalid value \\(string The category of the logged Exception\\)\\: Unexpected token \"The\", expected variable at offset 114$#"
count: 1
path: lizmap/modules/lizmap/lib/App/JelixContext.php

-
message: "#^PHPDoc tag @param has invalid value \\(string The name of the event\\)\\: Unexpected token \"The\", expected variable at offset 62$#"
count: 1
path: lizmap/modules/lizmap/lib/App/JelixContext.php

-
message: "#^PHPDoc tag @param has invalid value \\(string The profile category\\)\\: Unexpected token \"The\", expected variable at offset 102$#"
count: 1
path: lizmap/modules/lizmap/lib/App/JelixContext.php

-
message: "#^PHPDoc tag @param has invalid value \\(string the profile name\\)\\: Unexpected token \"the\", expected variable at offset 144$#"
count: 1
path: lizmap/modules/lizmap/lib/App/JelixContext.php

-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$right$#"
count: 1
path: lizmap/modules/lizmap/lib/App/JelixContext.php

-
message: "#^Return type \\(Iterator\\) of method Lizmap\\\\App\\\\JelixContext\\:\\:aclUserGroupsInfo\\(\\) should be compatible with return type \\(array\\) of method Lizmap\\\\App\\\\AppContextInterface\\:\\:aclUserGroupsInfo\\(\\)$#"
Expand Down Expand Up @@ -786,12 +647,4 @@ parameters:
count: 1
path: lizmap/modules/view/controllers/lizMap.classic.php

-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$project$#"
count: 1
path: lizmap/modules/view/controllers/lizMap.classic.php

-
message: "#^PHPDoc tag @param references unknown parameter\\: \\$repository$#"
count: 1
path: lizmap/modules/view/controllers/lizMap.classic.php
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ parameters:
paths:
- lizmap/modules
tmpDir: .phpstan.cache
ignoreErrors:
- '#^Call to an undefined method jDaoFactoryBase#'
universalObjectCratesClasses:
- jDaoRecordBase
- jEvent

0 comments on commit dfd6d82

Please sign in to comment.