Conversation
a48b99b to
7d98bbe
Compare
7d98bbe to
e194919
Compare
87bf2cd to
a83714b
Compare
40c7f0b to
be36f28
Compare
The base branch was changed.
a83714b to
1538b72
Compare
src/Query.php
Outdated
| * @return $this | ||
| */ | ||
| public function peekAhead($peekAhead = true) | ||
| public function peekAhead($peekAhead = true): static |
There was a problem hiding this comment.
I've checked out all usages, the only cases where this could end up not being a bool are in some controllers like this one:
https://github.com/Icinga/icingaweb2-module-x509/blob/81b7e5b6611e5a0c09bb19faca194583a79b462c/application/controllers/UsageController.php#L88
Where view->compact is passed, which could technically return null or some other type. The ActionController always initializes this property with a bool in the constructor and all reassignments also use bool values. When testing the affected controllers in the UI everything worked fine aswell, so I suppose we can type the parameter as bool.
src/Query.php
Outdated
| @@ -704,7 +700,7 @@ public function peekAhead($peekAhead = true) | |||
| * | |||
| * @return \Generator | |||
There was a problem hiding this comment.
You can simplify this to Generator.
src/Relation.php
Outdated
| * @return \Generator | ||
| */ | ||
| public function resolve() | ||
| public function resolve(): \Generator |
There was a problem hiding this comment.
Add use statement and simplify both PHPDoc and return type to Generator.
src/Relation/BelongsToMany.php
Outdated
| } | ||
|
|
||
| public function resolve() | ||
| public function resolve(): \Generator |
src/UnionQuery.php
Outdated
| * @return ?Query[] | ||
| */ | ||
| public function getUnions() | ||
| public function getUnions(): ?array |
There was a problem hiding this comment.
This method does not return null, does it?
| $this->assertSame($targetClass, $relation->getTargetClass()); | ||
| } | ||
|
|
||
| public function testSetTargetClassThrowsInvalidArgumentExceptionIfNotString() |
There was a problem hiding this comment.
This test can be removed because we are no longer testing an implementation detail, but PHP itself.
| /** @var Model The target model */ | ||
| protected $model; | ||
| /** @var ?Model The target model */ | ||
| protected ?Model $model; |
There was a problem hiding this comment.
I think it always makes sense to initialize nullable properties with null, as you do everywhere else. Even here, where the constructor sets the property.
| * @return Model | ||
| */ | ||
| public function getModel() | ||
| public function getModel(): Model |
6a3071e to
45aa085
Compare
There was a problem hiding this comment.
- I think we can define return types for
PersistBehavior|RetrieveBehaviorinterfaces, as they are not overridden by any other module. - Please use
[...]instead oflist() - Please import the class instead of using qualifier in
PropertiesWithDefaults (line 10-11). - Please remove the unused variable
$errinMillisecondTimestamp.
Note for myself:
The following classes and interfaces have not yet been modernized, as they are overridden by some modules (TBD):
Classes:
- PropertyBehavior
- Binary|BoolCast|MillisecondTimestamp
- Model
- UnionModel
- ResultSet
- Relation (partially)
- Query (Partially)
Interfaces:
- QueryAwareBehavior
- RewriteColumnBehavior
- RewriteFilterBehavior
ad48a0e to
25b8768
Compare
sukhwinder33445
left a comment
There was a problem hiding this comment.
Looks good.
Please use backticks in the commits to highlight function, class, interface, etc. names.
28bd4f2 to
1a6a329
Compare
Add types and missing return statements for implementations of: * `QueryAwarebehavior` * `RewriteFilterbehavior` To ensure compatibility with Icinga/ipl-orm#155. Add types to `ContactForm::isValidEent()` as required by Icinga/ipl-stdlib#68
e1d1c36 to
9734f88
Compare
Add strict type declarations to properties, function/method signatures, where types are unambiguous and no inheritance or interface contract is affected.
59f2fe9 to
9b944e8
Compare
sukhwinder33445
left a comment
There was a problem hiding this comment.
Looks good to me.
@lippserd, please take a look.
9b944e8 to
2bcbda8
Compare
Where functions are already adjusted and `throws` tags are missing they are added
2bcbda8 to
cee39f3
Compare
selfwithstatic.TypeErrorinstead.Code that requires compatibility changes in modules is not modernized by this PR.