From 25754e115834e5131effb871bb3496bc7231d076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Werner=20M=2E=20Krau=C3=9F?= Date: Thu, 1 Jun 2017 15:10:07 +0200 Subject: [PATCH] fixing code analysis: updating phpdoc --- code/controller/SubsiteXHRController.php | 2 ++ code/extensions/ErrorPageSubsite.php | 3 +++ code/extensions/FileSubsites.php | 3 +++ code/extensions/GroupSubsites.php | 2 ++ code/extensions/LeftAndMainSubsites.php | 10 +++++++++- code/extensions/SiteConfigSubsites.php | 2 ++ code/extensions/SiteTreeSubsites.php | 17 +++++++++++++---- code/model/Subsite.php | 23 ++++++++++++++++------- tests/php/BaseSubsiteTest.php | 9 ++++++--- tests/php/LeftAndMainSubsitesTest.php | 3 +++ tests/php/SubsiteAdminFunctionalTest.php | 2 ++ tests/php/WildcardDomainFieldTest.php | 3 +++ 12 files changed, 64 insertions(+), 15 deletions(-) diff --git a/code/controller/SubsiteXHRController.php b/code/controller/SubsiteXHRController.php index bb9a331..7dcc8c5 100644 --- a/code/controller/SubsiteXHRController.php +++ b/code/controller/SubsiteXHRController.php @@ -16,6 +16,8 @@ class SubsiteXHRController extends LeftAndMain /** * Relax the access permissions, so anyone who has access to any CMS subsite can access this controller. + * @param null $member + * @return bool */ public function canView($member = null) { diff --git a/code/extensions/ErrorPageSubsite.php b/code/extensions/ErrorPageSubsite.php index b11c3c0..60c5800 100644 --- a/code/extensions/ErrorPageSubsite.php +++ b/code/extensions/ErrorPageSubsite.php @@ -18,6 +18,9 @@ class ErrorPageSubsite extends DataExtension * * FIXME since {@link Subsite::currentSubsite()} partly relies on Session, viewing other sub-site (including main site) between * opening ErrorPage in the CMS and publish ErrorPage causes static error page to get generated incorrectly. + * @param $statusCode + * @param null $locale + * @return string */ public function alternateFilepathForErrorcode($statusCode, $locale = null) { diff --git a/code/extensions/FileSubsites.php b/code/extensions/FileSubsites.php index c10a197..6118b59 100644 --- a/code/extensions/FileSubsites.php +++ b/code/extensions/FileSubsites.php @@ -43,6 +43,7 @@ class FileSubsites extends DataExtension /** * Add subsites-specific fields to the folder editor. + * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { @@ -76,6 +77,8 @@ class FileSubsites extends DataExtension /** * Update any requests to limit the results to the current site + * @param SQLSelect $query + * @param DataQuery|null $dataQuery */ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) { diff --git a/code/extensions/GroupSubsites.php b/code/extensions/GroupSubsites.php index 5d6a112..d9728d2 100644 --- a/code/extensions/GroupSubsites.php +++ b/code/extensions/GroupSubsites.php @@ -134,6 +134,8 @@ class GroupSubsites extends DataExtension implements PermissionProvider /** * Update any requests to limit the results to the current site + * @param SQLSelect $query + * @param DataQuery|null $dataQuery */ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) { diff --git a/code/extensions/LeftAndMainSubsites.php b/code/extensions/LeftAndMainSubsites.php index 9d02cc5..d47836b 100644 --- a/code/extensions/LeftAndMainSubsites.php +++ b/code/extensions/LeftAndMainSubsites.php @@ -60,7 +60,11 @@ class LeftAndMainSubsites extends Extension /** * Find all subsites accessible for current user on this controller. * - * @return ArrayList of {@link Subsite} instances. + * @param bool $includeMainSite + * @param string $mainSiteTitle + * @param null $member + * @return ArrayList of Subsite instances. + * instances. */ public function sectionSites($includeMainSite = true, $mainSiteTitle = 'Main site', $member = null) { @@ -190,6 +194,10 @@ class LeftAndMainSubsites extends Extension /** * Helper for testing if the subsite should be adjusted. + * @param $adminClass + * @param $recordSubsiteID + * @param $currentSubsiteID + * @return bool */ public function shouldChangeSubsite($adminClass, $recordSubsiteID, $currentSubsiteID) { diff --git a/code/extensions/SiteConfigSubsites.php b/code/extensions/SiteConfigSubsites.php index 8729224..bdf8bc4 100644 --- a/code/extensions/SiteConfigSubsites.php +++ b/code/extensions/SiteConfigSubsites.php @@ -23,6 +23,8 @@ class SiteConfigSubsites extends DataExtension /** * Update any requests to limit the results to the current site + * @param SQLSelect $query + * @param DataQuery|null $dataQuery */ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) { diff --git a/code/extensions/SiteTreeSubsites.php b/code/extensions/SiteTreeSubsites.php index 776ab6f..6028dc6 100644 --- a/code/extensions/SiteTreeSubsites.php +++ b/code/extensions/SiteTreeSubsites.php @@ -176,7 +176,8 @@ class SiteTreeSubsites extends DataExtension * - Is in a group which has access to the subsite this page belongs to * - Is in a group with edit permissions on the "main site" * - * @return boolean + * @param null $member + * @return bool */ public function canEdit($member = null) { @@ -205,7 +206,8 @@ class SiteTreeSubsites extends DataExtension } /** - * @return boolean + * @param null $member + * @return bool */ public function canDelete($member = null) { @@ -217,7 +219,8 @@ class SiteTreeSubsites extends DataExtension } /** - * @return boolean + * @param null $member + * @return bool */ public function canAddChildren($member = null) { @@ -229,7 +232,8 @@ class SiteTreeSubsites extends DataExtension } /** - * @return boolean + * @param null $member + * @return bool */ public function canPublish($member = null) { @@ -288,6 +292,7 @@ class SiteTreeSubsites extends DataExtension /** * Called by ContentController::init(); + * @param $controller */ public static function contentcontrollerInit($controller) { @@ -312,6 +317,8 @@ class SiteTreeSubsites extends DataExtension /** * Use the CMS domain for iframed CMS previews to prevent single-origin violations * and SSL cert problems. + * @param null $action + * @return string */ public function alternatePreviewLink($action = null) { @@ -324,6 +331,8 @@ class SiteTreeSubsites extends DataExtension /** * Inject the subsite ID into the content so it can be used by frontend scripts. + * @param $tags + * @return string */ public function MetaTags(&$tags) { diff --git a/code/model/Subsite.php b/code/model/Subsite.php index 2aa6c2a..68d3bb1 100644 --- a/code/model/Subsite.php +++ b/code/model/Subsite.php @@ -203,6 +203,7 @@ class Subsite extends DataObject * and all subdomains on *.example.org on another. * * @param $host The host to find the subsite for. If not specified, $_SERVER['HTTP_HOST'] is used. + * @param bool $checkPermissions * @return int Subsite ID */ public static function getSubsiteIDForDomain($host = null, $checkPermissions = true) @@ -279,6 +280,7 @@ class Subsite extends DataObject /** * Disable the sub-site filtering; queries will select from all subsites + * @param bool $disabled */ public static function disable_subsite_filter($disabled = true) { @@ -297,7 +299,10 @@ class Subsite extends DataObject /** * Return all subsites, regardless of permissions (augmented with main site). * - * @return SS_List List of {@link Subsite} objects (DataList or ArrayList). + * @param bool $includeMainSite + * @param string $mainSiteTitle + * @return SS_List List of Subsite objects (DataList or ArrayList). + * objects (DataList or ArrayList). */ public static function all_sites($includeMainSite = true, $mainSiteTitle = 'Main site') { @@ -362,10 +367,11 @@ class Subsite extends DataObject * Sites will only be included if they have a Title. * * @param $permCode array|string Either a single permission code or an array of permission codes. - * @param $includeMainSite If true, the main site will be included if appropriate. - * @param $mainSiteTitle The label to give to the main site + * @param bool|If $includeMainSite If true, the main site will be included if appropriate. + * @param The|string $mainSiteTitle The label to give to the main site * @param $member - * @return DataList of {@link Subsite} instances + * @return DataList of Subsite instances + * instances */ public static function accessible_sites( $permCode, @@ -516,8 +522,8 @@ class Subsite extends DataObject * @todo Allow permission inheritance through group hierarchy. * * @param Member Member to check against. Defaults to currently logged in member - * @param Array Permission code strings. Defaults to "ADMIN". - * @return boolean + * @param array $permissionCodes + * @return bool */ public static function hasMainSitePermission($member = null, $permissionCodes = ['ADMIN']) { @@ -623,7 +629,8 @@ class Subsite extends DataObject /** * @todo Possible security issue, don't grant edit permissions to everybody. - * @return boolean + * @param bool $member + * @return bool */ public function canEdit($member = false) { @@ -910,6 +917,8 @@ JS; /** * Duplicate this subsite + * @param bool $doWrite + * @return DataObject */ public function duplicate($doWrite = true) { diff --git a/tests/php/BaseSubsiteTest.php b/tests/php/BaseSubsiteTest.php index 478dd2d..9326dab 100644 --- a/tests/php/BaseSubsiteTest.php +++ b/tests/php/BaseSubsiteTest.php @@ -16,9 +16,12 @@ class BaseSubsiteTest extends SapphireTest Subsite::$force_subsite = null; } - /** - * Avoid subsites filtering on fixture fetching. - */ + /** + * Avoid subsites filtering on fixture fetching. + * @param string $class + * @param string $id + * @return \SilverStripe\ORM\DataObject + */ public function objFromFixture($class, $id) {Subsite::disable_subsite_filter(true); $obj = parent::objFromFixture($class, $id); diff --git a/tests/php/LeftAndMainSubsitesTest.php b/tests/php/LeftAndMainSubsitesTest.php index 7a5eff5..1090d3e 100644 --- a/tests/php/LeftAndMainSubsitesTest.php +++ b/tests/php/LeftAndMainSubsitesTest.php @@ -17,6 +17,9 @@ class LeftAndMainSubsitesTest extends FunctionalTest /** * Avoid subsites filtering on fixture fetching. + * @param string $class + * @param string $id + * @return \SilverStripe\ORM\DataObject */ public function objFromFixture($class, $id) { diff --git a/tests/php/SubsiteAdminFunctionalTest.php b/tests/php/SubsiteAdminFunctionalTest.php index 8f6b6ed..c06fc40 100644 --- a/tests/php/SubsiteAdminFunctionalTest.php +++ b/tests/php/SubsiteAdminFunctionalTest.php @@ -19,6 +19,8 @@ class SubsiteAdminFunctionalTest extends FunctionalTest /** * Helper: FunctionalTest is only able to follow redirection once, we want to go all the way. + * @param $url + * @return \SilverStripe\Control\HTTPResponse */ public function getAndFollowAll($url) { diff --git a/tests/php/WildcardDomainFieldTest.php b/tests/php/WildcardDomainFieldTest.php index 6ea98eb..f4c0e8f 100644 --- a/tests/php/WildcardDomainFieldTest.php +++ b/tests/php/WildcardDomainFieldTest.php @@ -14,6 +14,7 @@ class WildcardDomainFieldTest extends SapphireTest { * Check that valid domains are accepted * * @dataProvider validDomains + * @param $domain */ public function testValidDomains($domain) { $field = new WildcardDomainField('DomainField'); @@ -24,6 +25,7 @@ class WildcardDomainFieldTest extends SapphireTest { * Check that valid domains are accepted * * @dataProvider invalidDomains + * @param $domain */ public function testInvalidDomains($domain) { $field = new WildcardDomainField('DomainField'); @@ -34,6 +36,7 @@ class WildcardDomainFieldTest extends SapphireTest { * Check that valid domains are accepted * * @dataProvider validWildcards + * @param $domain */ public function testValidWildcards($domain) { $field = new WildcardDomainField('DomainField');