Skip to content

Commit

Permalink
[#12] ColumnWithoutAnnotation: columns suffixed _id should be typed…
Browse files Browse the repository at this point in the history
… with `int`;
  • Loading branch information
rentalhost committed Jun 1, 2017
1 parent 5b72764 commit 979b100
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@ class Eloquent_IdString extends EloquentSimulation

(new Eloquent_IdInt)->id;
(new Eloquent_IdString)->id;

/**
* @property int $id
* @property int $user_id
*/
class Eloquent_IdSuffix extends EloquentSimulation
{
}

(new Eloquent_IdSuffix)->user_id;
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ class <weak_warning descr="@property $id was not annotated">Eloquent_IdString</w
(new Eloquent_IdInt)-><weak_warning descr="@property $id was not annotated">id</weak_warning>;
(new Eloquent_IdString)-><weak_warning descr="@property $id was not annotated">id</weak_warning>;
class <weak_warning descr="@property $id was not annotated">Eloquent_IdSuffix</weak_warning> extends EloquentSimulation
{
}
(new Eloquent_IdSuffix)-><weak_warning descr="@property $user_id was not annotated">user_id</weak_warning>;
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ static void validatePropertyAnnotation(
final PsiElement issueReference,
final String propertyName
) {
if (propertyName.endsWith("_id")) {
validatePropertyAnnotation(problemsHolder, phpClass, issueReference, propertyName, "int");
return;
}

if (propertyName.endsWith("_at")) {
validatePropertyAnnotation(problemsHolder, phpClass, issueReference, propertyName, "\\Carbon\\Carbon");
return;
Expand Down

0 comments on commit 979b100

Please sign in to comment.