Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions build/controllers/PhpDocController.php
Original file line number Diff line number Diff line change
Expand Up @@ -774,13 +774,22 @@ protected function generateClassPropertyDocs($fileName)
$className = $namespace . '\\' . $class['name'];

$gets = $this->match(
'#\* @return (?<type>[\w\\|\\\\\\[\\]]+)(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
'[\s\n]{2,}(\#\[\\\\*.+\])*[\s\n]{2,}public function (?<kind>get)(?<name>\w+)\((?:,? ?\$\w+ ?= ?[^,]+)*\)#',
$class['content'], true);
'#\* @return (?<type>[\w\\|\\\\\\[\\]]+)'
. '(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)((\*\n)|(\*\s.+))*\*/'
. '[\s\n]{2,}(\#\[\\\\*.+\])*[\s\n]{2,}'
. 'public function (?<kind>get)(?<name>\w+)\((?:,? ?\$\w+ ?= ?[^,]+)*\)(\:\s*[\w\\|\\\\\\[\\]]+)?#',
$class['content'],
true
);

$sets = $this->match(
'#\* @param (?<type>[\w\\|\\\\\\[\\]]+) \$\w+(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/' .
'[\s\n]{2,}(\#\[\\\\*.+\])*[\s\n]{2,}public function (?<kind>set)(?<name>\w+)\(\$\w+(?:, ?\$\w+ ?= ?[^,]+)*\)#',
$class['content'], true);
'#\* @param (?<type>[\w\\|\\\\\\[\\]]+) \$\w+'
. '(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)((\*\n)|(\*\s.+))*\*/'
. '[\s\n]{2,}(\#\[\\\\*.+\])*[\s\n]{2,}'
. 'public function (?<kind>set)(?<name>\w+)\(([\w\\|\\\\\\[\\]]+\s*)?\$\w+(?:, ?\$\w+ ?= ?[^,]+)*\)(\:\s*[\w\\|\\\\\\[\\]]+)?#',
$class['content'],
true
);

$acrs = array_merge($gets, $sets);
$manuallyAddedProperties = self::MANUALLY_ADDED_PROPERTIES[$className] ?? [];
Expand Down
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Yii Framework 2 Change Log
- Enh #20514: Add `@property` annotations for `yii\console\Controller` (max-s-lab)
- Bug #20515: Fix `@param` annotations in `BetweenColumnsCondition`, `InCondition` and `LikeCondition` (max-s-lab)
- Bug #20516: Fix `@template` annotations in `ActiveRecord` (max-s-lab)
- Bug #19506: Fix `@property` annotations in `yii\console\widgets\Table`, `yii\di\Container` and `yii\web\Session` (max-s-lab)
- Enh #20525: Add `@template` annotations for all actions (max-s-lab)
- Bug #20524: Fix PHPStan/Psalm annotations in `Yii::createObject` (max-s-lab)

Expand Down
3 changes: 3 additions & 0 deletions framework/console/widgets/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
* ],
* ]);
*
* @property-write array $chars Table chars.
* @property-write array $headers Table headers.
* @property-write string $listPrefix List prefix.
* @property-write array $rows Table rows.
* @property-write int $screenWidth Screen width.
*
* @author Daniel Gomez Pan <[email protected]>
Expand Down
6 changes: 4 additions & 2 deletions framework/di/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
*
* For more details and usage information on Container, see the [guide article on di-containers](guide:concept-di-container).
*
* @property-read array $definitions The list of the object definitions or the loaded shared objects (type or
* ID => definition or instance).
* @property array $definitions The list of the object definitions or the loaded shared objects (type or ID =>
* definition or instance).
* @property-write bool $resolveArrays Whether to attempt to resolve elements in array dependencies.
* @property-write array $singletons Array of singleton definitions. See [[setDefinitions()]] for allowed
* formats of array.
*
* @author Qiang Xue <[email protected]>
* @since 2.0
Expand Down
4 changes: 2 additions & 2 deletions framework/web/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
* For more details and usage information on Session, see the [guide article on sessions](guide:runtime-sessions-cookies).
*
* @property-read array $allFlashes Flash messages (key => message or key => [message1, message2]).
* @property-read string $cacheLimiter Current cache limiter.
* @property-read array $cookieParams The session cookie parameters.
* @property string $cacheLimiter Current cache limiter.
* @property array $cookieParams The session cookie parameters.
* @property-read int $count The number of session variables.
* @property-write string $flash The key identifying the flash message. Note that flash messages and normal
* session variables share the same name space. If you have a normal session variable using the same name, its
Expand Down
Loading