Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up bake templates around array list #979

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Utility/SubsetSchemaCollection.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'app.Posts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PostsControllerTest extends TestCase
/**
* Fixtures
*
* @var array<string>
* @var list<string>
*/
protected array $fixtures = [
'app.Posts',
Expand Down