Skip to content

Commit dcf4c44

Browse files
committed
add ide helper
1 parent 4cbaeea commit dcf4c44

17 files changed

Lines changed: 166 additions & 26 deletions

File tree

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"cakephp/bake": "^3.0.0",
2121
"cakephp/cakephp-codesniffer": "^5.0",
2222
"cakephp/debug_kit": "^5.0.0",
23+
"dereuromark/cakephp-ide-helper": "dev-master",
2324
"josegonzalez/dotenv": "^4.0",
2425
"phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.1"
2526
},
@@ -58,6 +59,8 @@
5859
],
5960
"cs-check": "phpcs --colors -p",
6061
"cs-fix": "phpcbf --colors -p",
61-
"test": "phpunit --colors=always"
62+
"test": "phpunit --colors=always",
63+
"annotate": "bin/cake annotate all",
64+
"illuminate": "bin/cake illuminate code"
6265
}
6366
}

composer.lock

Lines changed: 89 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/app.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,4 +479,11 @@
479479
'Migrations' => [
480480
'add_timestamps_use_datetime' => true,
481481
],
482+
483+
'IdeHelper' => [
484+
'tableBehaviors' => true,
485+
'arrayAsGenerics' => true,
486+
'objectAsGenerics' => true,
487+
'assocsAsGenerics' => true,
488+
],
482489
];

config/plugins.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@
3737
'Tags',
3838
'ADmad/SocialAuth',
3939
'Authentication',
40+
'IdeHelper',
4041
];

src/Controller/AppController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
* will inherit them.
2626
*
2727
* @link https://book.cakephp.org/5/en/controllers.html#the-app-controller
28+
* @property \Search\Controller\Component\SearchComponent $Search
29+
* @property \Authentication\Controller\Component\AuthenticationComponent $Authentication
2830
*/
2931
class AppController extends Controller
3032
{

src/Controller/ErrorController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
*/
2626
class ErrorController extends AppController
2727
{
28+
protected ?string $defaultTable = '';
29+
2830
/**
2931
* Initialization hook method.
3032
*

src/Controller/PagesController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
*/
3232
class PagesController extends AppController
3333
{
34+
protected ?string $defaultTable = '';
35+
3436
/**
3537
* @return void
3638
*/

src/Model/Entity/Package.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
* @property string|null $latest_stable_version
1818
* @property \Cake\I18n\Date|null $latest_stable_release_date
1919
*
20-
* @property \Tags\Model\Entity\Tag[] $tags
21-
*
22-
* @property \Tags\Model\Entity\Tag[] $cake_php_tags
20+
* @property array<\Tags\Model\Entity\Tag> $cake_php_tags
2321
* @property array<int, array<\Tags\Model\Entity\Tag>> $cake_php_tag_groups
24-
* @property \Tags\Model\Entity\Tag[] $php_tags
22+
* @property array<\Tags\Model\Entity\Tag> $php_tags
2523
* @property array<int, array<\Tags\Model\Entity\Tag>> $php_tag_groups
24+
* @property array<\Tags\Model\Entity\Tagged> $tagged
25+
* @property array<\Tags\Model\Entity\Tag> $tags
26+
* @property \Tags\Model\Entity\Tagged $_joinData
2627
*/
2728
class Package extends Entity
2829
{
@@ -42,6 +43,7 @@ class Package extends Entity
4243

4344
/**
4445
* @return array<\Tags\Model\Entity\Tag>
46+
* @see \App\Model\Entity\Package::$cake_php_tags
4547
*/
4648
protected function _getCakePhpTags(): array
4749
{
@@ -50,6 +52,7 @@ protected function _getCakePhpTags(): array
5052

5153
/**
5254
* @return array<int, array<\Tags\Model\Entity\Tag>>
55+
* @see \App\Model\Entity\Package::$cake_php_tag_groups
5356
*/
5457
protected function _getCakePhpTagGroups(): array
5558
{
@@ -58,6 +61,7 @@ protected function _getCakePhpTagGroups(): array
5861

5962
/**
6063
* @return array<\Tags\Model\Entity\Tag>
64+
* @see \App\Model\Entity\Package::$php_tags
6165
*/
6266
protected function _getPhpTags(): array
6367
{
@@ -66,6 +70,7 @@ protected function _getPhpTags(): array
6670

6771
/**
6872
* @return array<int, array<\Tags\Model\Entity\Tag>>
73+
* @see \App\Model\Entity\Package::$php_tag_groups
6974
*/
7075
protected function _getPhpTagGroups(): array
7176
{
@@ -118,4 +123,19 @@ protected function groupVersionTags(array $tags, string $prefix): array
118123

119124
return $groups;
120125
}
126+
127+
public const FIELD_ID = 'id';
128+
public const FIELD_PACKAGE = 'package';
129+
public const FIELD_DESCRIPTION = 'description';
130+
public const FIELD_REPO_URL = 'repo_url';
131+
public const FIELD_DOWNLOADS = 'downloads';
132+
public const FIELD_STARS = 'stars';
133+
public const FIELD_LATEST_STABLE_VERSION = 'latest_stable_version';
134+
public const FIELD_LATEST_STABLE_RELEASE_DATE = 'latest_stable_release_date';
135+
public const FIELD_CAKE_PHP_TAGS = 'cake_php_tags';
136+
public const FIELD_CAKE_PHP_TAG_GROUPS = 'cake_php_tag_groups';
137+
public const FIELD_PHP_TAGS = 'php_tags';
138+
public const FIELD_PHP_TAG_GROUPS = 'php_tag_groups';
139+
public const FIELD_TAGGED = 'tagged';
140+
public const FIELD_TAGS = 'tags';
121141
}

src/Model/Entity/User.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* @property string|null $last_name
1414
* @property string $email
1515
* @property string $username
16+
* @property bool $is_cakephp_dev
1617
* @property \Cake\I18n\DateTime $created
1718
* @property \Cake\I18n\DateTime|null $modified
1819
*
@@ -33,4 +34,14 @@ class User extends Entity
3334
'*' => true,
3435
'id' => false,
3536
];
37+
38+
public const FIELD_ID = 'id';
39+
public const FIELD_FIRST_NAME = 'first_name';
40+
public const FIELD_LAST_NAME = 'last_name';
41+
public const FIELD_EMAIL = 'email';
42+
public const FIELD_USERNAME = 'username';
43+
public const FIELD_CREATED = 'created';
44+
public const FIELD_MODIFIED = 'modified';
45+
public const FIELD_SOCIAL_PROFILE = 'social_profile';
46+
public const FIELD_IS_CAKEPHP_DEV = 'is_cakephp_dev';
3647
}

src/Model/Table/PackagesTable.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,20 @@
1515
* @method \App\Model\Entity\Package newEntity(array $data, array $options = [])
1616
* @method array<\App\Model\Entity\Package> newEntities(array $data, array $options = [])
1717
* @method \App\Model\Entity\Package get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args)
18-
* @method \App\Model\Entity\Package findOrCreate($search, ?callable $callback = null, array $options = [])
18+
* @method \App\Model\Entity\Package findOrCreate(\Cake\ORM\Query\SelectQuery|callable|array $search, ?callable $callback = null, array $options = [])
1919
* @method \App\Model\Entity\Package patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
2020
* @method array<\App\Model\Entity\Package> patchEntities(iterable $entities, array $data, array $options = [])
2121
* @method \App\Model\Entity\Package|false save(\Cake\Datasource\EntityInterface $entity, array $options = [])
2222
* @method \App\Model\Entity\Package saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = [])
23-
* @method iterable<\App\Model\Entity\Package>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package>|false saveMany(iterable $entities, array $options = [])
24-
* @method iterable<\App\Model\Entity\Package>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package> saveManyOrFail(iterable $entities, array $options = [])
25-
* @method iterable<\App\Model\Entity\Package>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package>|false deleteMany(iterable $entities, array $options = [])
26-
* @method iterable<\App\Model\Entity\Package>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package> deleteManyOrFail(iterable $entities, array $options = [])
23+
* @method \Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package>|false saveMany(iterable $entities, array $options = [])
24+
* @method \Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package> saveManyOrFail(iterable $entities, array $options = [])
25+
* @method \Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package>|false deleteMany(iterable $entities, array $options = [])
26+
* @method \Cake\Datasource\ResultSetInterface<\App\Model\Entity\Package> deleteManyOrFail(iterable $entities, array $options = [])
27+
* @property \Cake\ORM\Association\HasMany<\Tags\Model\Table\TaggedTable> $Tagged
28+
* @property \Cake\ORM\Association\BelongsToMany<\Tags\Model\Table\TagsTable> $Tags
29+
* @mixin \Search\Model\Behavior\SearchBehavior
30+
* @mixin \Tags\Model\Behavior\TagBehavior
31+
* @extends \Cake\ORM\Table<array{Search: \Search\Model\Behavior\SearchBehavior, Tag: \Tags\Model\Behavior\TagBehavior}>
2732
*/
2833
class PackagesTable extends Table
2934
{

0 commit comments

Comments
 (0)