diff --git a/.github/workflows/dispatch-ci.yml b/.github/workflows/dispatch-ci.yml new file mode 100644 index 00000000..3a331652 --- /dev/null +++ b/.github/workflows/dispatch-ci.yml @@ -0,0 +1,16 @@ +name: Dispatch CI + +on: + # At 8:40 PM UTC, only on Saturday and Sunday + schedule: + - cron: '40 20 * * 6,0' + +jobs: + dispatch-ci: + name: Dispatch CI + # Only run cron on the tractorcow-farm account + if: (github.event_name == 'schedule' && github.repository_owner == 'tractorcow-farm') || (github.event_name != 'schedule') + runs-on: ubuntu-latest + steps: + - name: Dispatch CI + uses: silverstripe/gha-dispatch-ci@v1 diff --git a/.github/workflows/update-js.yml b/.github/workflows/update-js.yml new file mode 100644 index 00000000..f225311f --- /dev/null +++ b/.github/workflows/update-js.yml @@ -0,0 +1,17 @@ +name: Update JS + +on: + workflow_dispatch: + # Run on a schedule of once per quarter + schedule: + - cron: '40 20 1 */3 *' + +jobs: + update-js: + name: Update JS + # Only run cron on the tractorcow-farm account + if: (github.event_name == 'schedule' && github.repository_owner == 'tractorcow-farm') || (github.event_name != 'schedule') + runs-on: ubuntu-latest + steps: + - name: Update JS + uses: silverstripe/gha-update-js@v1 diff --git a/composer.json b/composer.json index d3cad270..e3b38a1c 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,9 @@ "silverstripe/cms": "Localise pages" }, "require-dev": { - "silverstripe/recipe-testing": "^3" + "silverstripe/recipe-testing": "^3", + "silverstripe/standards": "^1", + "phpstan/extension-installer": "^1.3" }, "extra": { "branch-alias": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..beb9de3c --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,3 @@ +parameters: + paths: + - src diff --git a/src/Extension/FluentFilteredExtension.php b/src/Extension/FluentFilteredExtension.php index eeb1c8b0..b7dac66c 100644 --- a/src/Extension/FluentFilteredExtension.php +++ b/src/Extension/FluentFilteredExtension.php @@ -5,9 +5,9 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\GridField\GridFieldConfig; use SilverStripe\ORM\DataExtension; -use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataQuery; +use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\Versioned\Versioned; use TractorCow\Fluent\Extension\Traits\FluentObjectTrait; @@ -17,7 +17,7 @@ use TractorCow\Fluent\State\FluentState; /** - * @method DataList|Locale[] FilteredLocales() + * @method ManyManyList FilteredLocales() * * @extends DataExtension */ diff --git a/src/Model/Domain.php b/src/Model/Domain.php index 13370c46..1888a401 100644 --- a/src/Model/Domain.php +++ b/src/Model/Domain.php @@ -21,7 +21,7 @@ /** * @property string $Domain * @property int $DefaultLocaleID - * @method HasManyList Locales() + * @method HasManyList Locales() */ class Domain extends DataObject { diff --git a/src/Model/Locale.php b/src/Model/Locale.php index b1f28e55..e97715db 100644 --- a/src/Model/Locale.php +++ b/src/Model/Locale.php @@ -23,7 +23,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\HasManyList; -use SilverStripe\ORM\ManyManyList; +use SilverStripe\ORM\ManyManyThroughList; use SilverStripe\Security\Member; use SilverStripe\Security\Permission; use SilverStripe\Security\PermissionProvider; @@ -44,7 +44,7 @@ * @property bool $UseDefaultCode * @property string $Timezone * @method HasManyList FallbackLocales() - * @method ManyManyList Fallbacks() + * @method ManyManyThroughList Fallbacks() * @method Domain Domain() Raw SQL Domain (unfiltered by domain mode) */ class Locale extends DataObject implements PermissionProvider