From a30549fef87e59e64218b899c50392d4751b04e5 Mon Sep 17 00:00:00 2001 From: mscherer Date: Thu, 29 Feb 2024 03:51:24 +0100 Subject: [PATCH] Fix up bake templates around array list --- src/Utility/SubsetSchemaCollection.php | 6 +++--- templates/bake/Model/entity.twig | 2 +- templates/bake/tests/test_case.twig | 2 +- tests/TestCase/Command/AllCommandTest.php | 4 ++-- tests/TestCase/Command/ControllerAllCommandTest.php | 4 ++-- tests/TestCase/Command/ControllerCommandTest.php | 2 +- tests/TestCase/Command/FixtureAllCommandTest.php | 4 ++-- tests/TestCase/Command/FixtureCommandTest.php | 2 +- tests/TestCase/Command/ModelAllCommandTest.php | 4 ++-- .../Command/ModelCommandAssociationDetectionTest.php | 2 +- tests/TestCase/Command/ModelCommandTest.php | 4 ++-- tests/TestCase/Command/TemplateAllCommandTest.php | 4 ++-- tests/TestCase/Command/TemplateCommandTest.php | 2 +- tests/TestCase/TestCase.php | 4 ++-- tests/TestCase/Utility/Model/AssociationFilterTest.php | 2 +- tests/TestCase/Utility/TableScannerTest.php | 2 +- tests/TestCase/View/Helper/BakeHelperTest.php | 2 +- tests/comparisons/Model/testBakeEntityCustomHidden.php | 2 +- tests/comparisons/Model/testBakeEntityFullContext.php | 2 +- tests/comparisons/Model/testBakeEntityHidden.php | 2 +- tests/comparisons/Model/testBakeEntityWithPlugin.php | 2 +- tests/comparisons/Model/testBakeUpdateEntity.php | 4 ++-- tests/comparisons/Test/testBakeControllerTest.php | 2 +- tests/comparisons/Test/testBakeFixturesParam.php | 2 +- tests/comparisons/Test/testBakeModelTest.php | 2 +- tests/comparisons/Test/testBakePrefixControllerTest.php | 2 +- .../Test/testBakePrefixControllerTestWithCliOption.php | 2 +- 27 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/Utility/SubsetSchemaCollection.php b/src/Utility/SubsetSchemaCollection.php index 3d38d245..29033215 100644 --- a/src/Utility/SubsetSchemaCollection.php +++ b/src/Utility/SubsetSchemaCollection.php @@ -33,13 +33,13 @@ class SubsetSchemaCollection implements CollectionInterface protected CollectionInterface $collection; /** - * @var array + * @var list */ protected array $tables = []; /** * @param \Cake\Database\Schema\CollectionInterface $collection The wrapped collection - * @param array $tables The subset of tables. + * @param list $tables The subset of tables. */ public function __construct(CollectionInterface $collection, array $tables) { @@ -60,7 +60,7 @@ public function getInnerCollection(): CollectionInterface /** * Get the list of tables in this schema collection. * - * @return array + * @return list */ public function listTables(): array { diff --git a/templates/bake/Model/entity.twig b/templates/bake/Model/entity.twig index 0885b7fc..2524788e 100644 --- a/templates/bake/Model/entity.twig +++ b/templates/bake/Model/entity.twig @@ -59,7 +59,7 @@ class {{ name }} extends Entity{{ fileBuilder.classBuilder.implements ? ' implem /** * Fields that are excluded from JSON versions of the entity. * - * @var array + * @var list */ protected array $_hidden = {{ Bake.exportVar(hidden, 1)|raw }}; {% endif %} diff --git a/templates/bake/tests/test_case.twig b/templates/bake/tests/test_case.twig index 471e2f96..87d36c75 100644 --- a/templates/bake/tests/test_case.twig +++ b/templates/bake/tests/test_case.twig @@ -67,7 +67,7 @@ class {{ className }}Test extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = {{ Bake.exportVar(fixtures|values, 1)|raw }}; {% if construction or methods %} diff --git a/tests/TestCase/Command/AllCommandTest.php b/tests/TestCase/Command/AllCommandTest.php index 094b41fb..ecacdf4f 100644 --- a/tests/TestCase/Command/AllCommandTest.php +++ b/tests/TestCase/Command/AllCommandTest.php @@ -29,7 +29,7 @@ class AllCommandTest extends TestCase /** * fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Products', @@ -37,7 +37,7 @@ class AllCommandTest extends TestCase ]; /** - * @var array + * @var list */ protected array $tables = ['products', 'product_versions']; diff --git a/tests/TestCase/Command/ControllerAllCommandTest.php b/tests/TestCase/Command/ControllerAllCommandTest.php index 6b22da81..15f4c112 100644 --- a/tests/TestCase/Command/ControllerAllCommandTest.php +++ b/tests/TestCase/Command/ControllerAllCommandTest.php @@ -30,7 +30,7 @@ class ControllerAllCommandTest extends TestCase /** * fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.BakeArticles', @@ -38,7 +38,7 @@ class ControllerAllCommandTest extends TestCase ]; /** - * @var array + * @var list */ protected array $tables = ['bake_articles', 'bake_comments']; diff --git a/tests/TestCase/Command/ControllerCommandTest.php b/tests/TestCase/Command/ControllerCommandTest.php index 9a90806b..b3474141 100644 --- a/tests/TestCase/Command/ControllerCommandTest.php +++ b/tests/TestCase/Command/ControllerCommandTest.php @@ -31,7 +31,7 @@ class ControllerCommandTest extends TestCase /** * fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.BakeArticles', diff --git a/tests/TestCase/Command/FixtureAllCommandTest.php b/tests/TestCase/Command/FixtureAllCommandTest.php index d590dfe0..429a589b 100644 --- a/tests/TestCase/Command/FixtureAllCommandTest.php +++ b/tests/TestCase/Command/FixtureAllCommandTest.php @@ -30,7 +30,7 @@ class FixtureAllCommandTest extends TestCase /** * fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Articles', @@ -38,7 +38,7 @@ class FixtureAllCommandTest extends TestCase ]; /** - * @var array + * @var list */ protected array $tables = ['articles', 'comments']; diff --git a/tests/TestCase/Command/FixtureCommandTest.php b/tests/TestCase/Command/FixtureCommandTest.php index 587b0614..6882ada0 100644 --- a/tests/TestCase/Command/FixtureCommandTest.php +++ b/tests/TestCase/Command/FixtureCommandTest.php @@ -35,7 +35,7 @@ class FixtureCommandTest extends TestCase /** * fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Articles', diff --git a/tests/TestCase/Command/ModelAllCommandTest.php b/tests/TestCase/Command/ModelAllCommandTest.php index 19e75801..96a852b4 100644 --- a/tests/TestCase/Command/ModelAllCommandTest.php +++ b/tests/TestCase/Command/ModelAllCommandTest.php @@ -30,7 +30,7 @@ class ModelAllCommandTest extends TestCase /** * fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.TodoTasks', @@ -38,7 +38,7 @@ class ModelAllCommandTest extends TestCase ]; /** - * @var array + * @var list */ protected array $tables = ['todo_tasks', 'todo_items']; diff --git a/tests/TestCase/Command/ModelCommandAssociationDetectionTest.php b/tests/TestCase/Command/ModelCommandAssociationDetectionTest.php index 80558cc8..b7725d5a 100644 --- a/tests/TestCase/Command/ModelCommandAssociationDetectionTest.php +++ b/tests/TestCase/Command/ModelCommandAssociationDetectionTest.php @@ -36,7 +36,7 @@ class ModelCommandAssociationDetectionTest extends TestCase * Don't sort this list alphabetically - otherwise there are table constraints * which fail when using postgres * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Categories', diff --git a/tests/TestCase/Command/ModelCommandTest.php b/tests/TestCase/Command/ModelCommandTest.php index 731cbd2a..0a97ae0c 100644 --- a/tests/TestCase/Command/ModelCommandTest.php +++ b/tests/TestCase/Command/ModelCommandTest.php @@ -43,7 +43,7 @@ class ModelCommandTest extends TestCase * Don't sort this list alphabetically - otherwise there are table constraints * which fail when using postgres * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Articles', @@ -2312,7 +2312,7 @@ class TodoItem implements IdentityInterface protected const MY_CONST = 1; protected array $_accessible = [ - // should not overwritten + // should not get overwritten ]; /** diff --git a/tests/TestCase/Command/TemplateAllCommandTest.php b/tests/TestCase/Command/TemplateAllCommandTest.php index d8ce1c46..34e06c98 100644 --- a/tests/TestCase/Command/TemplateAllCommandTest.php +++ b/tests/TestCase/Command/TemplateAllCommandTest.php @@ -30,7 +30,7 @@ class TemplateAllCommandTest extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Articles', @@ -38,7 +38,7 @@ class TemplateAllCommandTest extends TestCase ]; /** - * @var array + * @var list */ protected array $tables = ['articles', 'comments']; diff --git a/tests/TestCase/Command/TemplateCommandTest.php b/tests/TestCase/Command/TemplateCommandTest.php index c32a030f..0c3aac31 100644 --- a/tests/TestCase/Command/TemplateCommandTest.php +++ b/tests/TestCase/Command/TemplateCommandTest.php @@ -35,7 +35,7 @@ class TemplateCommandTest extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Articles', diff --git a/tests/TestCase/TestCase.php b/tests/TestCase/TestCase.php index f43635cd..a2844d68 100644 --- a/tests/TestCase/TestCase.php +++ b/tests/TestCase/TestCase.php @@ -32,7 +32,7 @@ abstract class TestCase extends BaseTestCase protected $generatedFile = ''; /** - * @var array + * @var list */ protected $generatedFiles = []; @@ -84,7 +84,7 @@ protected function _loadTestPlugin($name) /** * Assert that a list of files exist. * - * @param array $files The list of files to check. + * @param list $files The list of files to check. * @param string $message The message to use if a check fails. */ protected function assertFilesExist(array $files, $message = '') diff --git a/tests/TestCase/Utility/Model/AssociationFilterTest.php b/tests/TestCase/Utility/Model/AssociationFilterTest.php index c12a49f1..2e7dc0e8 100644 --- a/tests/TestCase/Utility/Model/AssociationFilterTest.php +++ b/tests/TestCase/Utility/Model/AssociationFilterTest.php @@ -30,7 +30,7 @@ class AssociationFilterTest extends TestCase * Don't sort this list alphabetically - otherwise there are table constraints * which fail when using postgres * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.Authors', diff --git a/tests/TestCase/Utility/TableScannerTest.php b/tests/TestCase/Utility/TableScannerTest.php index 7d7d7d9c..ea17744a 100644 --- a/tests/TestCase/Utility/TableScannerTest.php +++ b/tests/TestCase/Utility/TableScannerTest.php @@ -23,7 +23,7 @@ class TableScannerTest extends TestCase { /** - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.TodoTasks', diff --git a/tests/TestCase/View/Helper/BakeHelperTest.php b/tests/TestCase/View/Helper/BakeHelperTest.php index 64231373..d2d6d6ed 100644 --- a/tests/TestCase/View/Helper/BakeHelperTest.php +++ b/tests/TestCase/View/Helper/BakeHelperTest.php @@ -33,7 +33,7 @@ class BakeHelperTest extends TestCase * Don't sort this list alphabetically - otherwise there are table constraints * which fail when using postgres * - * @var array + * @var list */ protected array $fixtures = [ 'plugin.Bake.BakeArticles', diff --git a/tests/comparisons/Model/testBakeEntityCustomHidden.php b/tests/comparisons/Model/testBakeEntityCustomHidden.php index 31b0431f..7698be01 100644 --- a/tests/comparisons/Model/testBakeEntityCustomHidden.php +++ b/tests/comparisons/Model/testBakeEntityCustomHidden.php @@ -22,7 +22,7 @@ class User extends Entity /** * Fields that are excluded from JSON versions of the entity. * - * @var array + * @var list */ protected array $_hidden = [ 'foo', diff --git a/tests/comparisons/Model/testBakeEntityFullContext.php b/tests/comparisons/Model/testBakeEntityFullContext.php index 96ffd3ad..240761a8 100644 --- a/tests/comparisons/Model/testBakeEntityFullContext.php +++ b/tests/comparisons/Model/testBakeEntityFullContext.php @@ -40,7 +40,7 @@ class User extends Entity /** * Fields that are excluded from JSON versions of the entity. * - * @var array + * @var list */ protected array $_hidden = [ 'password', diff --git a/tests/comparisons/Model/testBakeEntityHidden.php b/tests/comparisons/Model/testBakeEntityHidden.php index 38e08d99..ef086579 100644 --- a/tests/comparisons/Model/testBakeEntityHidden.php +++ b/tests/comparisons/Model/testBakeEntityHidden.php @@ -22,7 +22,7 @@ class User extends Entity /** * Fields that are excluded from JSON versions of the entity. * - * @var array + * @var list */ protected array $_hidden = [ 'password', diff --git a/tests/comparisons/Model/testBakeEntityWithPlugin.php b/tests/comparisons/Model/testBakeEntityWithPlugin.php index a9192bba..4707f601 100644 --- a/tests/comparisons/Model/testBakeEntityWithPlugin.php +++ b/tests/comparisons/Model/testBakeEntityWithPlugin.php @@ -40,7 +40,7 @@ class User extends Entity /** * Fields that are excluded from JSON versions of the entity. * - * @var array + * @var list */ protected array $_hidden = [ 'password', diff --git a/tests/comparisons/Model/testBakeUpdateEntity.php b/tests/comparisons/Model/testBakeUpdateEntity.php index af07a7e7..e2ed113a 100644 --- a/tests/comparisons/Model/testBakeUpdateEntity.php +++ b/tests/comparisons/Model/testBakeUpdateEntity.php @@ -35,14 +35,14 @@ class TodoItem extends Entity implements IdentityInterface /** * Fields that are excluded from JSON versions of the entity. * - * @var array + * @var list */ protected array $_hidden = [ 'user_id', ]; protected array $_accessible = [ - // should not overwritten + // should not get overwritten ]; /** diff --git a/tests/comparisons/Test/testBakeControllerTest.php b/tests/comparisons/Test/testBakeControllerTest.php index c0fdf6f9..71561048 100644 --- a/tests/comparisons/Test/testBakeControllerTest.php +++ b/tests/comparisons/Test/testBakeControllerTest.php @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'app.Posts', diff --git a/tests/comparisons/Test/testBakeFixturesParam.php b/tests/comparisons/Test/testBakeFixturesParam.php index 8b34120d..e78cb54c 100644 --- a/tests/comparisons/Test/testBakeFixturesParam.php +++ b/tests/comparisons/Test/testBakeFixturesParam.php @@ -21,7 +21,7 @@ class AuthorsTableTest extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'app.Posts', diff --git a/tests/comparisons/Test/testBakeModelTest.php b/tests/comparisons/Test/testBakeModelTest.php index 5f946e2e..0a8f7702 100644 --- a/tests/comparisons/Test/testBakeModelTest.php +++ b/tests/comparisons/Test/testBakeModelTest.php @@ -21,7 +21,7 @@ class ArticlesTableTest extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'app.Articles', diff --git a/tests/comparisons/Test/testBakePrefixControllerTest.php b/tests/comparisons/Test/testBakePrefixControllerTest.php index 7763af3b..1920ddf8 100644 --- a/tests/comparisons/Test/testBakePrefixControllerTest.php +++ b/tests/comparisons/Test/testBakePrefixControllerTest.php @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'app.Posts', diff --git a/tests/comparisons/Test/testBakePrefixControllerTestWithCliOption.php b/tests/comparisons/Test/testBakePrefixControllerTestWithCliOption.php index 7763af3b..1920ddf8 100644 --- a/tests/comparisons/Test/testBakePrefixControllerTestWithCliOption.php +++ b/tests/comparisons/Test/testBakePrefixControllerTestWithCliOption.php @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase /** * Fixtures * - * @var array + * @var list */ protected array $fixtures = [ 'app.Posts',