Skip to content

Commit

Permalink
Merge pull request #979 from cakephp/array-list
Browse files Browse the repository at this point in the history
Fix up bake templates around array list
  • Loading branch information
othercorey committed Feb 29, 2024
2 parents d4fa79c + a30549f commit 0c7f444
Show file tree
Hide file tree
Showing 27 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/Utility/SubsetSchemaCollection.php
Expand Up @@ -33,13 +33,13 @@ class SubsetSchemaCollection implements CollectionInterface
protected CollectionInterface $collection;

/**
* @var array<string>
* @var list<string>
*/
protected array $tables = [];

/**
* @param \Cake\Database\Schema\CollectionInterface $collection The wrapped collection
* @param array<string> $tables The subset of tables.
* @param list<string> $tables The subset of tables.
*/
public function __construct(CollectionInterface $collection, array $tables)
{
Expand All @@ -60,7 +60,7 @@ public function getInnerCollection(): CollectionInterface
/**
* Get the list of tables in this schema collection.
*
* @return array<string>
* @return list<string>
*/
public function listTables(): array
{
Expand Down
2 changes: 1 addition & 1 deletion templates/bake/Model/entity.twig
Expand Up @@ -59,7 +59,7 @@ class {{ name }} extends Entity{{ fileBuilder.classBuilder.implements ? ' implem
/**
* Fields that are excluded from JSON versions of the entity.
*
* @var array<string>
* @var list<string>
*/
protected array $_hidden = {{ Bake.exportVar(hidden, 1)|raw }};
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/bake/tests/test_case.twig
Expand Up @@ -67,7 +67,7 @@ class {{ className }}Test extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = {{ Bake.exportVar(fixtures|values, 1)|raw }};
{% if construction or methods %}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Command/AllCommandTest.php
Expand Up @@ -29,15 +29,15 @@ class AllCommandTest extends TestCase
/**
* fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Products',
'plugin.Bake.ProductVersions',
];

/**
* @var array<string>
* @var list<string>
*/
protected array $tables = ['products', 'product_versions'];

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Command/ControllerAllCommandTest.php
Expand Up @@ -30,15 +30,15 @@ class ControllerAllCommandTest extends TestCase
/**
* fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.BakeArticles',
'plugin.Bake.BakeComments',
];

/**
* @var array<string>
* @var list<string>
*/
protected array $tables = ['bake_articles', 'bake_comments'];

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Command/ControllerCommandTest.php
Expand Up @@ -31,7 +31,7 @@ class ControllerCommandTest extends TestCase
/**
* fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.BakeArticles',
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Command/FixtureAllCommandTest.php
Expand Up @@ -30,15 +30,15 @@ class FixtureAllCommandTest extends TestCase
/**
* fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Articles',
'plugin.Bake.Comments',
];

/**
* @var array<string>
* @var list<string>
*/
protected array $tables = ['articles', 'comments'];

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Command/FixtureCommandTest.php
Expand Up @@ -35,7 +35,7 @@ class FixtureCommandTest extends TestCase
/**
* fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Articles',
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Command/ModelAllCommandTest.php
Expand Up @@ -30,15 +30,15 @@ class ModelAllCommandTest extends TestCase
/**
* fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.TodoTasks',
'plugin.Bake.TodoItems',
];

/**
* @var array<string>
* @var list<string>
*/
protected array $tables = ['todo_tasks', 'todo_items'];

Expand Down
Expand Up @@ -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<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Categories',
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Command/ModelCommandTest.php
Expand Up @@ -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<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Articles',
Expand Down Expand Up @@ -2312,7 +2312,7 @@ class TodoItem implements IdentityInterface
protected const MY_CONST = 1;
protected array $_accessible = [
// should not overwritten
// should not get overwritten
];
/**
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Command/TemplateAllCommandTest.php
Expand Up @@ -30,15 +30,15 @@ class TemplateAllCommandTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Articles',
'plugin.Bake.Comments',
];

/**
* @var array<string>
* @var list<string>
*/
protected array $tables = ['articles', 'comments'];

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Command/TemplateCommandTest.php
Expand Up @@ -35,7 +35,7 @@ class TemplateCommandTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Articles',
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/TestCase.php
Expand Up @@ -32,7 +32,7 @@ abstract class TestCase extends BaseTestCase
protected $generatedFile = '';

/**
* @var array<string>
* @var list<string>
*/
protected $generatedFiles = [];

Expand Down Expand Up @@ -84,7 +84,7 @@ protected function _loadTestPlugin($name)
/**
* Assert that a list of files exist.
*
* @param array<string> $files The list of files to check.
* @param list<string> $files The list of files to check.
* @param string $message The message to use if a check fails.
*/
protected function assertFilesExist(array $files, $message = '')
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Utility/Model/AssociationFilterTest.php
Expand Up @@ -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<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.Authors',
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Utility/TableScannerTest.php
Expand Up @@ -23,7 +23,7 @@
class TableScannerTest extends TestCase
{
/**
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.TodoTasks',
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/Helper/BakeHelperTest.php
Expand Up @@ -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<string>
* @var list<string>
*/
protected array $fixtures = [
'plugin.Bake.BakeArticles',
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeEntityCustomHidden.php
Expand Up @@ -22,7 +22,7 @@ class User extends Entity
/**
* Fields that are excluded from JSON versions of the entity.
*
* @var array<string>
* @var list<string>
*/
protected array $_hidden = [
'foo',
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeEntityFullContext.php
Expand Up @@ -40,7 +40,7 @@ class User extends Entity
/**
* Fields that are excluded from JSON versions of the entity.
*
* @var array<string>
* @var list<string>
*/
protected array $_hidden = [
'password',
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeEntityHidden.php
Expand Up @@ -22,7 +22,7 @@ class User extends Entity
/**
* Fields that are excluded from JSON versions of the entity.
*
* @var array<string>
* @var list<string>
*/
protected array $_hidden = [
'password',
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Model/testBakeEntityWithPlugin.php
Expand Up @@ -40,7 +40,7 @@ class User extends Entity
/**
* Fields that are excluded from JSON versions of the entity.
*
* @var array<string>
* @var list<string>
*/
protected array $_hidden = [
'password',
Expand Down
4 changes: 2 additions & 2 deletions tests/comparisons/Model/testBakeUpdateEntity.php
Expand Up @@ -35,14 +35,14 @@ class TodoItem extends Entity implements IdentityInterface
/**
* Fields that are excluded from JSON versions of the entity.
*
* @var array<string>
* @var list<string>
*/
protected array $_hidden = [
'user_id',
];

protected array $_accessible = [
// should not overwritten
// should not get overwritten
];

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Test/testBakeControllerTest.php
Expand Up @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'app.Posts',
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Test/testBakeFixturesParam.php
Expand Up @@ -21,7 +21,7 @@ class AuthorsTableTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'app.Posts',
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Test/testBakeModelTest.php
Expand Up @@ -21,7 +21,7 @@ class ArticlesTableTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'app.Articles',
Expand Down
2 changes: 1 addition & 1 deletion tests/comparisons/Test/testBakePrefixControllerTest.php
Expand Up @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'app.Posts',
Expand Down
Expand Up @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'app.Posts',
Expand Down

0 comments on commit 0c7f444

Please sign in to comment.