fixing code analysis: updating phpdoc

This commit is contained in:
Werner M. Krauß 2017-06-01 15:10:07 +02:00
parent 17010f39a3
commit 25754e1158
12 changed files with 64 additions and 15 deletions

View File

@ -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. * 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) public function canView($member = null)
{ {

View File

@ -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 * 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. * 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) public function alternateFilepathForErrorcode($statusCode, $locale = null)
{ {

View File

@ -43,6 +43,7 @@ class FileSubsites extends DataExtension
/** /**
* Add subsites-specific fields to the folder editor. * Add subsites-specific fields to the folder editor.
* @param FieldList $fields
*/ */
public function updateCMSFields(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 * 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) public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{ {

View File

@ -134,6 +134,8 @@ class GroupSubsites extends DataExtension implements PermissionProvider
/** /**
* Update any requests to limit the results to the current site * 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) public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{ {

View File

@ -60,7 +60,11 @@ class LeftAndMainSubsites extends Extension
/** /**
* Find all subsites accessible for current user on this controller. * 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 <a href='psi_element://Subsite'>Subsite</a> instances.
* instances.
*/ */
public function sectionSites($includeMainSite = true, $mainSiteTitle = 'Main site', $member = null) 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. * Helper for testing if the subsite should be adjusted.
* @param $adminClass
* @param $recordSubsiteID
* @param $currentSubsiteID
* @return bool
*/ */
public function shouldChangeSubsite($adminClass, $recordSubsiteID, $currentSubsiteID) public function shouldChangeSubsite($adminClass, $recordSubsiteID, $currentSubsiteID)
{ {

View File

@ -23,6 +23,8 @@ class SiteConfigSubsites extends DataExtension
/** /**
* Update any requests to limit the results to the current site * 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) public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{ {

View File

@ -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 which has access to the subsite this page belongs to
* - Is in a group with edit permissions on the "main site" * - Is in a group with edit permissions on the "main site"
* *
* @return boolean * @param null $member
* @return bool
*/ */
public function canEdit($member = null) 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) 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) 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) public function canPublish($member = null)
{ {
@ -288,6 +292,7 @@ class SiteTreeSubsites extends DataExtension
/** /**
* Called by ContentController::init(); * Called by ContentController::init();
* @param $controller
*/ */
public static function contentcontrollerInit($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 * Use the CMS domain for iframed CMS previews to prevent single-origin violations
* and SSL cert problems. * and SSL cert problems.
* @param null $action
* @return string
*/ */
public function alternatePreviewLink($action = null) 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. * Inject the subsite ID into the content so it can be used by frontend scripts.
* @param $tags
* @return string
*/ */
public function MetaTags(&$tags) public function MetaTags(&$tags)
{ {

View File

@ -203,6 +203,7 @@ class Subsite extends DataObject
* and all subdomains on *.example.org on another. * 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 $host The host to find the subsite for. If not specified, $_SERVER['HTTP_HOST'] is used.
* @param bool $checkPermissions
* @return int Subsite ID * @return int Subsite ID
*/ */
public static function getSubsiteIDForDomain($host = null, $checkPermissions = true) 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 * Disable the sub-site filtering; queries will select from all subsites
* @param bool $disabled
*/ */
public static function disable_subsite_filter($disabled = true) 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 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 <a href='psi_element://Subsite'>Subsite</a> objects (DataList or ArrayList).
* objects (DataList or ArrayList).
*/ */
public static function all_sites($includeMainSite = true, $mainSiteTitle = 'Main site') 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. * 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 $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 bool|If $includeMainSite If true, the main site will be included if appropriate.
* @param $mainSiteTitle The label to give to the main site * @param The|string $mainSiteTitle The label to give to the main site
* @param $member * @param $member
* @return DataList of {@link Subsite} instances * @return DataList of <a href='psi_element://Subsite'>Subsite</a> instances
* instances
*/ */
public static function accessible_sites( public static function accessible_sites(
$permCode, $permCode,
@ -516,8 +522,8 @@ class Subsite extends DataObject
* @todo Allow permission inheritance through group hierarchy. * @todo Allow permission inheritance through group hierarchy.
* *
* @param Member Member to check against. Defaults to currently logged in member * @param Member Member to check against. Defaults to currently logged in member
* @param Array Permission code strings. Defaults to "ADMIN". * @param array $permissionCodes
* @return boolean * @return bool
*/ */
public static function hasMainSitePermission($member = null, $permissionCodes = ['ADMIN']) 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. * @todo Possible security issue, don't grant edit permissions to everybody.
* @return boolean * @param bool $member
* @return bool
*/ */
public function canEdit($member = false) public function canEdit($member = false)
{ {
@ -910,6 +917,8 @@ JS;
/** /**
* Duplicate this subsite * Duplicate this subsite
* @param bool $doWrite
* @return DataObject
*/ */
public function duplicate($doWrite = true) public function duplicate($doWrite = true)
{ {

View File

@ -18,6 +18,9 @@ class BaseSubsiteTest extends SapphireTest
/** /**
* 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) public function objFromFixture($class, $id)
{Subsite::disable_subsite_filter(true); {Subsite::disable_subsite_filter(true);

View File

@ -17,6 +17,9 @@ class LeftAndMainSubsitesTest extends FunctionalTest
/** /**
* 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) public function objFromFixture($class, $id)
{ {

View File

@ -19,6 +19,8 @@ class SubsiteAdminFunctionalTest extends FunctionalTest
/** /**
* Helper: FunctionalTest is only able to follow redirection once, we want to go all the way. * 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) public function getAndFollowAll($url)
{ {

View File

@ -14,6 +14,7 @@ class WildcardDomainFieldTest extends SapphireTest {
* Check that valid domains are accepted * Check that valid domains are accepted
* *
* @dataProvider validDomains * @dataProvider validDomains
* @param $domain
*/ */
public function testValidDomains($domain) { public function testValidDomains($domain) {
$field = new WildcardDomainField('DomainField'); $field = new WildcardDomainField('DomainField');
@ -24,6 +25,7 @@ class WildcardDomainFieldTest extends SapphireTest {
* Check that valid domains are accepted * Check that valid domains are accepted
* *
* @dataProvider invalidDomains * @dataProvider invalidDomains
* @param $domain
*/ */
public function testInvalidDomains($domain) { public function testInvalidDomains($domain) {
$field = new WildcardDomainField('DomainField'); $field = new WildcardDomainField('DomainField');
@ -34,6 +36,7 @@ class WildcardDomainFieldTest extends SapphireTest {
* Check that valid domains are accepted * Check that valid domains are accepted
* *
* @dataProvider validWildcards * @dataProvider validWildcards
* @param $domain
*/ */
public function testValidWildcards($domain) { public function testValidWildcards($domain) {
$field = new WildcardDomainField('DomainField'); $field = new WildcardDomainField('DomainField');