Skip to content

Commit

Permalink
Merge pull request #854 from lucasmichot/feature/master/last-errors
Browse files Browse the repository at this point in the history
Let extended classes access lastErrors
  • Loading branch information
lucasmichot committed Jan 16, 2017
2 parents 3b114ab + 51e5071 commit 7cdf42c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Carbon/Carbon.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class Carbon extends DateTime
*
* @var array
*/
private static $lastErrors;
protected static $lastErrors;

/**
* Will UTF8 encoding be used to print localized date/time ?
Expand Down
6 changes: 6 additions & 0 deletions tests/Carbon/CreateFromFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use DateTime;
use DateTimeZone;
use Tests\AbstractTestCase;
use Tests\Carbon\Fixtures\MyCarbon;

class CreateFromFormatTest extends AbstractTestCase
{
Expand Down Expand Up @@ -74,6 +75,11 @@ public function testCreateFromFormatWithMillis()
$this->assertSame(254687, $d->micro);
}

public function testCreateLastErrorsCanBeAccessedByExtendingClass()
{
MyCarbon::getLastErrors();
}

public function testCreateFromFormatHandlesLastErrors()
{
$carbon = Carbon::createFromFormat('d/m/Y', '41/02/1900');
Expand Down

0 comments on commit 7cdf42c

Please sign in to comment.