diff --git a/src/Extension/FluentCMSMainExtension.php b/src/Extension/FluentCMSMainExtension.php index f276af7a..396a7b8e 100644 --- a/src/Extension/FluentCMSMainExtension.php +++ b/src/Extension/FluentCMSMainExtension.php @@ -22,7 +22,8 @@ * * @see FluentSiteTreeExtension::updateSavePublishActions() * @see CopyLocaleAction::handleAction() - * @property CMSMain $owner + * + * @extends Extension */ class FluentCMSMainExtension extends Extension { diff --git a/src/Extension/FluentChangesExtension.php b/src/Extension/FluentChangesExtension.php index 715f13ea..07fc8d61 100644 --- a/src/Extension/FluentChangesExtension.php +++ b/src/Extension/FluentChangesExtension.php @@ -8,7 +8,7 @@ /** * Adds locale-specific extensions to ChangeSet * - * @property ChangeSetItem $owner + * @extends DataExtension */ class FluentChangesExtension extends DataExtension { @@ -26,7 +26,6 @@ public function updateChangeType(&$type, $draftVersion, $liveVersion) } // Mark any fluent object as modified if otherwise treated as null - /** @var ChangeSetItem $owner */ $owner = $this->owner; foreach ($owner->Object()->getExtensionInstances() as $extension) { if ($extension instanceof FluentExtension) { diff --git a/src/Extension/FluentDateTimeExtension.php b/src/Extension/FluentDateTimeExtension.php index ddef0e78..87526556 100644 --- a/src/Extension/FluentDateTimeExtension.php +++ b/src/Extension/FluentDateTimeExtension.php @@ -8,7 +8,7 @@ use TractorCow\Fluent\Model\Locale; /** - * @property DBDatetime $owner + * @extends Extension */ class FluentDateTimeExtension extends Extension { diff --git a/src/Extension/FluentDirectorExtension.php b/src/Extension/FluentDirectorExtension.php index 6f461b1f..9fb27b78 100644 --- a/src/Extension/FluentDirectorExtension.php +++ b/src/Extension/FluentDirectorExtension.php @@ -14,7 +14,7 @@ /** * Fluent extension for {@link \SilverStripe\Control\Director} to apply routing rules for locales * - * @property Director $owner + * @extends Extension */ class FluentDirectorExtension extends Extension { @@ -138,7 +138,6 @@ protected function getExplicitRoutes($originalRules) { $queryParam = static::config()->get('query_param'); $rules = []; - /** @var Locale $localeObj */ foreach (Locale::getCached() as $localeObj) { $locale = $localeObj->getLocale(); $url = $localeObj->getURLSegment(); diff --git a/src/Extension/FluentExtension.php b/src/Extension/FluentExtension.php index 737c7c2d..4a472792 100644 --- a/src/Extension/FluentExtension.php +++ b/src/Extension/FluentExtension.php @@ -46,7 +46,8 @@ * - data_exclude * - data_include * - * @property FluentExtension|DataObject $owner + * @template T of DataObject + * @extends DataExtension */ class FluentExtension extends DataExtension { @@ -998,13 +999,12 @@ protected function getManipulationRecordID($updates) /** * Templatable list of all locale information for this record * - * @return ArrayList|RecordLocale[] + * @return ArrayList */ public function Locales() { $data = []; foreach (Locale::getCached() as $localeObj) { - /** @var Locale $localeObj */ $data[] = $this->owner->LocaleInformation($localeObj->getLocale()); } return ArrayList::create($data); diff --git a/src/Extension/FluentFilteredExtension.php b/src/Extension/FluentFilteredExtension.php index c665c1b1..eeb1c8b0 100644 --- a/src/Extension/FluentFilteredExtension.php +++ b/src/Extension/FluentFilteredExtension.php @@ -17,8 +17,9 @@ use TractorCow\Fluent\State\FluentState; /** - * @property FluentFilteredExtension|DataObject $owner * @method DataList|Locale[] FilteredLocales() + * + * @extends DataExtension */ class FluentFilteredExtension extends DataExtension { diff --git a/src/Extension/FluentGridFieldExtension.php b/src/Extension/FluentGridFieldExtension.php index c8da4a86..2a2ca326 100644 --- a/src/Extension/FluentGridFieldExtension.php +++ b/src/Extension/FluentGridFieldExtension.php @@ -18,7 +18,7 @@ /** * Supports GridFieldDetailForm_ItemRequest with extra actions * - * @property GridFieldDetailForm_ItemRequest $owner + * @extends Extension */ class FluentGridFieldExtension extends Extension { diff --git a/src/Extension/FluentIsolatedExtension.php b/src/Extension/FluentIsolatedExtension.php index 8e09f243..b2e83dd0 100644 --- a/src/Extension/FluentIsolatedExtension.php +++ b/src/Extension/FluentIsolatedExtension.php @@ -17,8 +17,9 @@ * Note: You cannot use this extension on any object with the other fluent extensions * * @property int $LocaleID - * @property FluentIsolatedExtension|DataObject $owner * @method Locale Locale() + * + * @extends DataExtension */ class FluentIsolatedExtension extends DataExtension { diff --git a/src/Extension/FluentLeftAndMainExtension.php b/src/Extension/FluentLeftAndMainExtension.php index 1aa9c406..8135059d 100644 --- a/src/Extension/FluentLeftAndMainExtension.php +++ b/src/Extension/FluentLeftAndMainExtension.php @@ -14,7 +14,7 @@ use TractorCow\Fluent\Extension\Traits\FluentBadgeTrait; /** - * @property LeftAndMain $owner + * @extends Extension */ class FluentLeftAndMainExtension extends Extension { diff --git a/src/Extension/FluentMemberExtension.php b/src/Extension/FluentMemberExtension.php index cdd52f7d..276b87b9 100644 --- a/src/Extension/FluentMemberExtension.php +++ b/src/Extension/FluentMemberExtension.php @@ -5,11 +5,15 @@ use SilverStripe\ORM\ArrayList; use SilverStripe\ORM\DataExtension; use SilverStripe\Security\Group; +use SilverStripe\Security\Member; use SilverStripe\Security\Member_GroupSet; use SilverStripe\Security\Permission; use TractorCow\Fluent\Model\Locale; use TractorCow\Fluent\State\FluentState; +/** + * @extends DataExtension + */ class FluentMemberExtension extends DataExtension { /** @@ -46,7 +50,7 @@ public function updateGroups(Member_GroupSet &$groups) /** * Get list of locales that the user has CMS access in * - * @return Locale[]|ArrayList + * @return ArrayList */ public function getCMSAccessLocales() { @@ -74,7 +78,6 @@ public function getCMSAccessLocales() protected function getLocalePermissionsForGroup(Group $group) { $localePermissions = []; - /** @var Permission $permission */ foreach ($group->Permissions() as $permission) { $prefix = Locale::CMS_ACCESS_FLUENT_LOCALE; $begin = substr($permission->Code, 0, strlen($prefix)); diff --git a/src/Extension/FluentReadVersionsExtension.php b/src/Extension/FluentReadVersionsExtension.php index ee51f984..92a95232 100644 --- a/src/Extension/FluentReadVersionsExtension.php +++ b/src/Extension/FluentReadVersionsExtension.php @@ -12,7 +12,7 @@ /** * Available since SilverStripe 4.3.x * - * @property ReadVersions $owner + * @extends Extension */ class FluentReadVersionsExtension extends Extension { diff --git a/src/Extension/FluentSiteTreeExtension.php b/src/Extension/FluentSiteTreeExtension.php index e3cfec18..0eedf5dc 100644 --- a/src/Extension/FluentSiteTreeExtension.php +++ b/src/Extension/FluentSiteTreeExtension.php @@ -27,7 +27,7 @@ /** * Fluent extension for SiteTree * - * @property FluentSiteTreeExtension|SiteTree $owner + * @extends FluentVersionedExtension */ class FluentSiteTreeExtension extends FluentVersionedExtension { diff --git a/src/Extension/FluentVersionedExtension.php b/src/Extension/FluentVersionedExtension.php index 1aa6f8d4..83ddc7df 100644 --- a/src/Extension/FluentVersionedExtension.php +++ b/src/Extension/FluentVersionedExtension.php @@ -24,7 +24,8 @@ * Important: If adding this to a custom object, this extension must be added AFTER the versioned extension. * Use yaml `after` to enforce this * - * @property DataObject|FluentVersionedExtension $owner + * @template T of DataObject&Versioned + * @extends FluentExtension */ class FluentVersionedExtension extends FluentExtension implements Resettable { @@ -156,7 +157,6 @@ protected function augmentDatabaseRequireTable($localisedTable, $fields, $indexe */ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) { - /** @var Locale|null $locale */ $locale = $this->getDataQueryLocale($dataQuery); if (!$locale) { return; @@ -228,7 +228,6 @@ protected function addLocaleFallbackChain(SQLSelect $query, $tableName, Locale $ $baseTable = $this->owner->baseTable(); foreach ($locale->getChain() as $joinLocale) { - /** @var Locale $joinLocale */ $joinAlias = $this->getLocalisedTable($tableName, $joinLocale->Locale); $versionTable = $baseTable . self::SUFFIX_VERSIONS; @@ -386,7 +385,6 @@ public function existsInLocale($locale = null) */ public function stagesDifferInLocale($locale = null): bool { - /** @var DataObject|Versioned|FluentExtension|FluentVersionedExtension $record */ $record = $this->owner; $id = $record->ID ?: $record->OldID; $class = get_class($record); @@ -518,7 +516,6 @@ public static function reset() { static::$idsInLocaleCache = []; - /** @var FluentVersionedExtension $singleton */ $singleton = singleton(static::class); $singleton->flushVersionsCache(); } @@ -575,7 +572,6 @@ public static function prepoulateIdsInLocale($locale, $dataObjectClass, $populat // Populate both the draft and live stages foreach ($tables as $table) { - /** @var SQLSelect $select */ $select = SQLSelect::create( ['"RecordID"'], '"' . $table . '"', diff --git a/src/Extension/Traits/FluentBadgeTrait.php b/src/Extension/Traits/FluentBadgeTrait.php index 8666725b..f47d7802 100644 --- a/src/Extension/Traits/FluentBadgeTrait.php +++ b/src/Extension/Traits/FluentBadgeTrait.php @@ -42,7 +42,6 @@ protected function addFluentBadge($badgeField, DataObject $record) */ public function getBadge(DataObject $record) { - /** @var Locale $currentLocale */ $currentLocale = Locale::getCurrentLocale(); if (!$currentLocale) { return null; diff --git a/src/Extension/Traits/FluentObjectTrait.php b/src/Extension/Traits/FluentObjectTrait.php index 3ba8139d..54076df5 100644 --- a/src/Extension/Traits/FluentObjectTrait.php +++ b/src/Extension/Traits/FluentObjectTrait.php @@ -16,8 +16,6 @@ /** * Shared functionality between both FluentExtension and FluentFilteredExtension - * - * @property DataObject $owner */ trait FluentObjectTrait { @@ -41,7 +39,7 @@ abstract public function updateLocalisationTabConfig( /** * Gets list of all Locale dataobjects, linked to this record * - * @return ArrayList|Locale[] + * @return ArrayList * @see Locale::RecordLocale() */ public function LinkedLocales() @@ -90,7 +88,9 @@ public function augmentDataQueryCreation( */ protected function updateFluentCMSFields(FieldList $fields) { - if (!$this->owner->ID) { + /** @var DataObject $owner */ + $owner = $this->owner; + if (!$owner->ID) { return; } @@ -102,7 +102,6 @@ protected function updateFluentCMSFields(FieldList $fields) // Generate gridfield for handling localisations $config = GridFieldConfig_Base::create(); - /** @var GridFieldDataColumns $columns */ $columns = $config->getComponentByType(GridFieldDataColumns::class); $summaryColumns = [ 'Title' => 'Title', @@ -110,11 +109,11 @@ protected function updateFluentCMSFields(FieldList $fields) ]; // Let extensions override columns - $this->owner->extend('updateLocalisationTabColumns', $summaryColumns); + $owner->extend('updateLocalisationTabColumns', $summaryColumns); $columns->setDisplayFields($summaryColumns); // Let extensions override components - $this->owner->extend('updateLocalisationTabConfig', $config); + $owner->extend('updateLocalisationTabConfig', $config); // Add gridfield to tab / fields $gridField = GridField::create( diff --git a/src/Forms/CopyLocaleAction.php b/src/Forms/CopyLocaleAction.php index e61be6a7..69103ea0 100644 --- a/src/Forms/CopyLocaleAction.php +++ b/src/Forms/CopyLocaleAction.php @@ -116,7 +116,6 @@ protected function appliesToRecord(DataObject $record, Locale $locale) throw new LogicException("Error loading locale"); } - /** @var RecordLocale $fromRecordLocale */ $fromRecordLocale = RecordLocale::create($record, $fromLocale); return $fromRecordLocale->IsDraft(); } diff --git a/src/Forms/VisibleLocalesColumn.php b/src/Forms/VisibleLocalesColumn.php index c54f1535..356a6816 100644 --- a/src/Forms/VisibleLocalesColumn.php +++ b/src/Forms/VisibleLocalesColumn.php @@ -68,7 +68,6 @@ public function getColumnContent($gridField, $record, $columnName) } $label = ''; - /** @var Locale $locale */ foreach (Locale::getLocales() as $locale) { $label .= $this->generateBadgeHTML($record, $locale); } diff --git a/src/Middleware/DetectLocaleMiddleware.php b/src/Middleware/DetectLocaleMiddleware.php index e2cb6fa9..86dd09b8 100644 --- a/src/Middleware/DetectLocaleMiddleware.php +++ b/src/Middleware/DetectLocaleMiddleware.php @@ -286,7 +286,6 @@ protected function getDomainLocale() // If the current domain has exactly one locale, the locale is non-ambiguous $locales = Locale::getCached()->filter('DomainID', $domainObj->ID); if ($locales->count() == 1) { - /** @var Locale $localeObject */ $localeObject = $locales->first(); if ($localeObject) { return $localeObject->getLocale(); @@ -313,7 +312,6 @@ protected function getDetectedLocale(HTTPRequest $request) return null; } - /** @var LocaleDetector $detector */ $detector = Injector::inst()->get(LocaleDetector::class); $localeObj = $detector->detectLocale($request); if ($localeObj) { @@ -358,7 +356,6 @@ protected function validateAllowedLocale(FluentState $state) // If limited to one or more locales, check that the current locale is in // this list $allowedLocales = $member->getCMSAccessLocales(); - /** @var Locale $firstAllowedLocale */ $firstAllowedLocale = $allowedLocales->first(); if ($firstAllowedLocale && !$allowedLocales->find('Locale', $state->getLocale())) { // Force state to the first allowed locale diff --git a/src/Model/CachableModel.php b/src/Model/CachableModel.php index 5aca0b2d..c90c61f1 100644 --- a/src/Model/CachableModel.php +++ b/src/Model/CachableModel.php @@ -15,9 +15,8 @@ */ trait CachableModel { - /** - * @return ArrayList|static[] + * @return ArrayList */ public static function getCached() { diff --git a/src/Model/Delete/UsesDeletePolicy.php b/src/Model/Delete/UsesDeletePolicy.php index f41a1151..f403cac8 100644 --- a/src/Model/Delete/UsesDeletePolicy.php +++ b/src/Model/Delete/UsesDeletePolicy.php @@ -30,7 +30,6 @@ public function updateDeleteTables(&$queriedTables) } $queriedTables = []; - /** @var DeletePolicy $policy */ $policy = Injector::inst()->create(DeletePolicy::class, $this->owner); $policy->delete($this->owner); } diff --git a/src/Model/Domain.php b/src/Model/Domain.php index 331732b1..13370c46 100644 --- a/src/Model/Domain.php +++ b/src/Model/Domain.php @@ -83,7 +83,6 @@ public function getCMSFields() // Don't show "Is Default" column, as this is not locale-specific default $localeConfig = GridFieldConfig_RelationEditor::create(); - /** @var GridFieldDataColumns $detailRow */ $detailRow = $localeConfig->getComponentByType(GridFieldDataColumns::class); $detailRow->setDisplayFields([ 'Title' => 'Title', @@ -184,7 +183,7 @@ public static function getByDomain($domain) /** * Get locales for this domain * - * @return ArrayList|Locale[] + * @return ArrayList */ public function getLocales() { diff --git a/src/Model/Locale.php b/src/Model/Locale.php index 40b0eff3..b1f28e55 100644 --- a/src/Model/Locale.php +++ b/src/Model/Locale.php @@ -43,8 +43,8 @@ * @property int $DomainID * @property bool $UseDefaultCode * @property string $Timezone - * @method HasManyList|FallbackLocale[] FallbackLocales() - * @method ManyManyList|Locale[] Fallbacks() + * @method HasManyList FallbackLocales() + * @method ManyManyList Fallbacks() * @method Domain Domain() Raw SQL Domain (unfiltered by domain mode) */ class Locale extends DataObject implements PermissionProvider @@ -128,7 +128,7 @@ public function populateDefaults() ]; /** - * @var ArrayList + * @var ArrayList */ protected $chain = null; @@ -486,7 +486,7 @@ public function getIsOnlyLocale() * * @param string|null|true $domain If provided, locales for the given domain will be returned. * If true, then the current state domain will be used (if in domain mode). - * @return ArrayList|Locale[] + * @return ArrayList */ public static function getLocales($domain = null) { @@ -516,7 +516,7 @@ public function onAfterWrite() /** * Get chain of all locales that should be preferred when this locale is current * - * @return ArrayList + * @return ArrayList */ public function getChain() { @@ -589,7 +589,7 @@ public function getBaseURL() /** * Get other locales that appear alongside this (including self) * - * @return ArrayList + * @return ArrayList */ public function getSiblingLocales() { diff --git a/src/Model/RecordLocale.php b/src/Model/RecordLocale.php index 4f25c130..4374727c 100644 --- a/src/Model/RecordLocale.php +++ b/src/Model/RecordLocale.php @@ -372,7 +372,6 @@ public function getSourceLocale(): ?Locale return $this->getLocaleObject(); } - /** @var Locale $fallback */ foreach ($this->getLocaleObject()->Fallbacks() as $fallback) { if (!$record->existsInLocale($fallback->Locale)) { continue; diff --git a/src/State/BrowserLocaleDetector.php b/src/State/BrowserLocaleDetector.php index 88e6241f..c4716310 100644 --- a/src/State/BrowserLocaleDetector.php +++ b/src/State/BrowserLocaleDetector.php @@ -60,7 +60,6 @@ public function detectLocale(HTTPRequest $request) foreach ($prioritisedLocales as $priority => $parsedLocales) { foreach ($parsedLocales as $browserLocale) { foreach ($locales as $localeObj) { - /** @var Locale $localeObj */ if ($localeObj->isLocale($browserLocale)) { return $localeObj; } diff --git a/src/Task/ConvertTranslatableTask.php b/src/Task/ConvertTranslatableTask.php index 217ed5d1..95ee3241 100644 --- a/src/Task/ConvertTranslatableTask.php +++ b/src/Task/ConvertTranslatableTask.php @@ -130,8 +130,6 @@ function () { )); foreach ($instances as $instance) { - /** @var DataObject $instance */ - // Get the Locale column directly from the base table, since the SS ORM will not include it $instanceLocale = SQLSelect::create() ->setFrom("\"{$baseTable}\"") diff --git a/src/Task/InitialPageLocalisationTask.php b/src/Task/InitialPageLocalisationTask.php index 07724630..393f8e37 100644 --- a/src/Task/InitialPageLocalisationTask.php +++ b/src/Task/InitialPageLocalisationTask.php @@ -37,7 +37,6 @@ public function run($request) $publish = (bool) $request->getVar('publish'); $limit = (int) $request->getVar('limit'); - /** @var Locale $globalLocale */ $globalLocale = Locale::get() ->filter(['IsGlobalDefault' => 1]) ->sort('ID', 'ASC')