Skip to content

Commit

Permalink
Move to PSR-12
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Aug 19, 2021
1 parent b7a3dca commit c5f16cb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ We accept contributions via Pull Requests on [GitHub](https://github.com/stauden

## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).
- **[PSR-12 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).

- **Add tests** - Your patch won't be accepted if it doesn't have tests.

Expand Down
2 changes: 1 addition & 1 deletion src/Relations/BelongsToThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BelongsToThrough extends Relation
*
* @var string
*/
const THROUGH_KEY = 'laravel_through_key';
public const THROUGH_KEY = 'laravel_through_key';

/**
* The "through" parent model instances.
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/BelongsToThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function belongsToThrough($related, $through, $localKey = null, $prefix =
}

foreach ($foreignKeyLookup as $model => $foreignKey) {
$instance = new $model;
$instance = new $model();

if ($foreignKey) {
$foreignKeys[$instance->getTable()] = $foreignKey;
Expand All @@ -64,7 +64,7 @@ protected function belongsToThroughParentInstance($model)
$segments = preg_split('/\s+as\s+/i', $model);

/** @var \Illuminate\Database\Eloquent\Model $instance */
$instance = new $segments[0];
$instance = new $segments[0]();

if (isset($segments[1])) {
$instance->setTable($instance->getTable().' as '.$segments[1]);
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function setUp(): void
{
parent::setUp();

$db = new DB;
$db = new DB();
$db->addConnection([
'driver' => 'sqlite',
'database' => ':memory:',
Expand Down

0 comments on commit c5f16cb

Please sign in to comment.