Skip to content

Commit 8691bf5

Browse files
committed
Implement contracts for many major components of the framework.
1 parent 9aafdd1 commit 8691bf5

131 files changed

Lines changed: 1105 additions & 462 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/illuminate-split-full.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ git subsplit publish src/Illuminate/Cache:git@github.com:illuminate/cache.git
44
git subsplit publish src/Illuminate/Config:git@github.com:illuminate/config.git
55
git subsplit publish src/Illuminate/Console:git@github.com:illuminate/console.git
66
git subsplit publish src/Illuminate/Container:git@github.com:illuminate/container.git
7+
git subsplit publish --heads="master" src/Illuminate/Contracts:git@github.com:illuminate/contracts.git
78
git subsplit publish src/Illuminate/Cookie:git@github.com:illuminate/cookie.git
89
git subsplit publish src/Illuminate/Database:git@github.com:illuminate/database.git
910
git subsplit publish src/Illuminate/Encryption:git@github.com:illuminate/encryption.git

build/illuminate-split.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Cache:git
44
git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Config:git@github.com:illuminate/config.git
55
git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Console:git@github.com:illuminate/console.git
66
git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Container:git@github.com:illuminate/container.git
7+
git subsplit publish --heads="master" --no-tags src/Illuminate/Contracts:git@github.com:illuminate/contracts.git
78
git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Cookie:git@github.com:illuminate/cookie.git
89
git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Database:git@github.com:illuminate/database.git
910
git subsplit publish --heads="master 4.1 4.2" --no-tags src/Illuminate/Encryption:git@github.com:illuminate/encryption.git

src/Illuminate/Auth/Console/stubs/controller.stub

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php namespace {{namespace}};
22

3-
use Illuminate\Auth\Guard;
43
use Illuminate\Routing\Controller;
4+
use Illuminate\Contracts\Auth\Authenticator;
55

66
use {{request.namespace}}Auth\LoginRequest;
77
use {{request.namespace}}Auth\RegisterRequest;
@@ -11,17 +11,17 @@ class AuthController extends Controller {
1111
/**
1212
* The authenticator implementation.
1313
*
14-
* @var Guard
14+
* @var Authenticator
1515
*/
1616
protected $auth;
1717

1818
/**
1919
* Create a new authentication controller instance.
2020
*
21-
* @param Guard $auth
21+
* @param Authenticator $auth
2222
* @return void
2323
*/
24-
public function __construct(Guard $auth)
24+
public function __construct(Authenticator $auth)
2525
{
2626
$this->auth = $auth;
2727

src/Illuminate/Auth/DatabaseUserProvider.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php namespace Illuminate\Auth;
22

33
use Illuminate\Database\Connection;
4-
use Illuminate\Hashing\HasherInterface;
4+
use Illuminate\Contracts\Auth\User as UserContract;
5+
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
56

67
class DatabaseUserProvider implements UserProviderInterface {
78

@@ -15,7 +16,7 @@ class DatabaseUserProvider implements UserProviderInterface {
1516
/**
1617
* The hasher implementation.
1718
*
18-
* @var \Illuminate\Hashing\HasherInterface
19+
* @var \Illuminate\Contracts\Hashing\Hasher
1920
*/
2021
protected $hasher;
2122

@@ -30,11 +31,11 @@ class DatabaseUserProvider implements UserProviderInterface {
3031
* Create a new database user provider.
3132
*
3233
* @param \Illuminate\Database\Connection $conn
33-
* @param \Illuminate\Hashing\HasherInterface $hasher
34+
* @param \Illuminate\Contracts\Hashing\Hasher $hasher
3435
* @param string $table
3536
* @return void
3637
*/
37-
public function __construct(Connection $conn, HasherInterface $hasher, $table)
38+
public function __construct(Connection $conn, HasherContract $hasher, $table)
3839
{
3940
$this->conn = $conn;
4041
$this->table = $table;
@@ -45,7 +46,7 @@ public function __construct(Connection $conn, HasherInterface $hasher, $table)
4546
* Retrieve a user by their unique identifier.
4647
*
4748
* @param mixed $identifier
48-
* @return \Illuminate\Auth\UserInterface|null
49+
* @return \Illuminate\Contracts\Auth\User|null
4950
*/
5051
public function retrieveById($identifier)
5152
{
@@ -62,7 +63,7 @@ public function retrieveById($identifier)
6263
*
6364
* @param mixed $identifier
6465
* @param string $token
65-
* @return \Illuminate\Auth\UserInterface|null
66+
* @return \Illuminate\Contracts\Auth\User|null
6667
*/
6768
public function retrieveByToken($identifier, $token)
6869
{
@@ -80,11 +81,11 @@ public function retrieveByToken($identifier, $token)
8081
/**
8182
* Update the "remember me" token for the given user in storage.
8283
*
83-
* @param \Illuminate\Auth\UserInterface $user
84+
* @param \Illuminate\Contracts\Auth\User $user
8485
* @param string $token
8586
* @return void
8687
*/
87-
public function updateRememberToken(UserInterface $user, $token)
88+
public function updateRememberToken(UserContract $user, $token)
8889
{
8990
$this->conn->table($this->table)
9091
->where('id', $user->getAuthIdentifier())
@@ -95,7 +96,7 @@ public function updateRememberToken(UserInterface $user, $token)
9596
* Retrieve a user by the given credentials.
9697
*
9798
* @param array $credentials
98-
* @return \Illuminate\Auth\UserInterface|null
99+
* @return \Illuminate\Contracts\Auth\User|null
99100
*/
100101
public function retrieveByCredentials(array $credentials)
101102
{
@@ -126,11 +127,11 @@ public function retrieveByCredentials(array $credentials)
126127
/**
127128
* Validate a user against the given credentials.
128129
*
129-
* @param \Illuminate\Auth\UserInterface $user
130+
* @param \Illuminate\Contracts\Auth\User $user
130131
* @param array $credentials
131132
* @return bool
132133
*/
133-
public function validateCredentials(UserInterface $user, array $credentials)
134+
public function validateCredentials(UserContract $user, array $credentials)
134135
{
135136
$plain = $credentials['password'];
136137

src/Illuminate/Auth/EloquentUserProvider.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php namespace Illuminate\Auth;
22

3-
use Illuminate\Hashing\HasherInterface;
3+
use Illuminate\Contracts\Auth\User as UserContract;
4+
use Illuminate\Contracts\Hashing\Hasher as HasherContract;
45

56
class EloquentUserProvider implements UserProviderInterface {
67

78
/**
89
* The hasher implementation.
910
*
10-
* @var \Illuminate\Hashing\HasherInterface
11+
* @var \Illuminate\Contracts\Hashing\Hasher
1112
*/
1213
protected $hasher;
1314

@@ -21,11 +22,11 @@ class EloquentUserProvider implements UserProviderInterface {
2122
/**
2223
* Create a new database user provider.
2324
*
24-
* @param \Illuminate\Hashing\HasherInterface $hasher
25+
* @param \Illuminate\Contracts\Hashing\Hasher $hasher
2526
* @param string $model
2627
* @return void
2728
*/
28-
public function __construct(HasherInterface $hasher, $model)
29+
public function __construct(HasherContract $hasher, $model)
2930
{
3031
$this->model = $model;
3132
$this->hasher = $hasher;
@@ -35,7 +36,7 @@ public function __construct(HasherInterface $hasher, $model)
3536
* Retrieve a user by their unique identifier.
3637
*
3738
* @param mixed $identifier
38-
* @return \Illuminate\Auth\UserInterface|null
39+
* @return \Illuinate\Contracts\Auth\User|null
3940
*/
4041
public function retrieveById($identifier)
4142
{
@@ -47,7 +48,7 @@ public function retrieveById($identifier)
4748
*
4849
* @param mixed $identifier
4950
* @param string $token
50-
* @return \Illuminate\Auth\UserInterface|null
51+
* @return \Illuinate\Contracts\Auth\User|null
5152
*/
5253
public function retrieveByToken($identifier, $token)
5354
{
@@ -62,11 +63,11 @@ public function retrieveByToken($identifier, $token)
6263
/**
6364
* Update the "remember me" token for the given user in storage.
6465
*
65-
* @param \Illuminate\Auth\UserInterface $user
66+
* @param \Illuinate\Contracts\Auth\User $user
6667
* @param string $token
6768
* @return void
6869
*/
69-
public function updateRememberToken(UserInterface $user, $token)
70+
public function updateRememberToken(UserContract $user, $token)
7071
{
7172
$user->setRememberToken($token);
7273

@@ -77,7 +78,7 @@ public function updateRememberToken(UserInterface $user, $token)
7778
* Retrieve a user by the given credentials.
7879
*
7980
* @param array $credentials
80-
* @return \Illuminate\Auth\UserInterface|null
81+
* @return \Illuinate\Contracts\Auth\User|null
8182
*/
8283
public function retrieveByCredentials(array $credentials)
8384
{
@@ -97,11 +98,11 @@ public function retrieveByCredentials(array $credentials)
9798
/**
9899
* Validate a user against the given credentials.
99100
*
100-
* @param \Illuminate\Auth\UserInterface $user
101+
* @param \Illuinate\Contracts\Auth\User $user
101102
* @param array $credentials
102103
* @return bool
103104
*/
104-
public function validateCredentials(UserInterface $user, array $credentials)
105+
public function validateCredentials(UserContract $user, array $credentials)
105106
{
106107
$plain = $credentials['password'];
107108

src/Illuminate/Auth/GenericUser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php namespace Illuminate\Auth;
22

3-
class GenericUser implements UserInterface {
3+
use Illuminate\Contracts\Auth\User as UserContract;
4+
5+
class GenericUser implements UserContract {
46

57
/**
68
* All of the user's attributes.

0 commit comments

Comments
 (0)