Skip to content

Commit

Permalink
Update Psalm and fix issues found (#1486)
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug authored and asbiin committed Jul 8, 2018
1 parent bffe121 commit f8fe374
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/Helpers/MoneyHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MoneyHelper
* defined, then the amount will be returned without a currency symbol.
*
* @param int|null $amount Amount to format.
* @param App\Currency $currency Currency of amount.
* @param Currency $currency Currency of amount.
* @return string Amount formatted with currency symbol.
*/
public static function format($amount, Currency $currency = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function storeContactFieldType(Request $request)
/**
* Edit a newly created resource in storage.
*
* @param ContactFieldTypeRequest $request
* @param Request $request
* @param string $contactFieldTypeId
* @return \Illuminate\Http\Response
*/
Expand Down
1 change: 1 addition & 0 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use App\Models\Contact\Reminder;
use App\Models\Contact\ContactField;
use App\Models\Contact\ReminderRule;
use App\Models\Journal\JournalEntry;
use Illuminate\Support\Facades\Route;
use App\Models\Relationship\Relationship;
use Illuminate\Database\Eloquent\ModelNotFoundException;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"roave/security-advisories": "dev-master",
"symfony/css-selector": "~4.0",
"symfony/dom-crawler": "~4.0",
"vimeo/psalm": "^1.1"
"vimeo/psalm": "^2.0"
},
"suggest": {
"ext-apcu": "*"
Expand Down
33 changes: 17 additions & 16 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use App\Models\Contact\Address;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
Expand Down
2 changes: 2 additions & 0 deletions database/migrations/2018_05_20_121028_accept_terms.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use App\Models\User\User;
use Illuminate\Support\Facades\Log;
use Illuminate\Database\Migrations\Migration;

class AcceptTerms extends Migration
Expand All @@ -14,6 +15,7 @@ public function up()
{
User::chunk(200, function ($users) {
foreach ($users as $user) {
Log::info($user->id);
if ($user->account) {
$user->acceptPolicy();
}
Expand Down
4 changes: 2 additions & 2 deletions database/seeds/FakeContentTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public function run()
$progress->finish();

// create the second test, blank account
$this->blankAccount = Account::createDefault('Blank', 'State', 'blank@blank.com', 'blank');
$blankUser = $this->blankAccount->users()->first();
$blankAccount = Account::createDefault('Blank', 'State', 'blank@blank.com', 'blank');
$blankUser = $blankAccount->users()->first();
$this->confirmUser($blankUser);
}

Expand Down
25 changes: 23 additions & 2 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<directory name="app" />
<directory name="routes" />
<directory name="tests" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
Expand Down Expand Up @@ -76,7 +79,7 @@
<TooManyArguments errorLevel="info" />
<TypeDoesNotContainType errorLevel="info" />
<InvalidOperand errorLevel="info" />
<MoreSpecificImplementedReturnType errorLevel="info" />
<LessSpecificImplementedReturnType errorLevel="info" />
<MoreSpecificImplementedParamType errorLevel="info" />

<!-- level 6 issues - bad stuff here -->
Expand All @@ -87,7 +90,6 @@
<UnresolvableInclude errorLevel="info" />
<InvalidReturnStatement errorLevel="info" />
<InvalidReturnType errorLevel="info" />
<UndefinedThisPropertyAssignment errorLevel="info" />

<InvalidArgument errorLevel="info" />

Expand All @@ -99,5 +101,24 @@
<directory name="resources/views" />
</errorLevel>
</UndefinedGlobalVariable>

<UndefinedPropertyAssignment>
<errorLevel type="suppress">
<file name="app/Models/Contact/Contact.php" />
</errorLevel>
</UndefinedPropertyAssignment>

<UndefinedThisPropertyFetch>
<errorLevel type="suppress">
<file name="tests/DuskTestCase.php" />
</errorLevel>
</UndefinedThisPropertyFetch>

<UndefinedPropertyFetch>
<errorLevel type="suppress">
<file name="app/Models/Account/Event.php" />
<file name="app/Models/Contact/Contact.php" />
</errorLevel>
</UndefinedPropertyFetch>
</issueHandlers>
</psalm>

0 comments on commit f8fe374

Please sign in to comment.