forked from humbug/php-scoper
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix easy cases of date related functions
Closes humbug#301
- Loading branch information
Showing
8 changed files
with
205 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the humbug/php-scoper package. | ||
* | ||
* Copyright (c) 2017 Théo FIDRY <[email protected]>, | ||
* Pádraic Brady <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
return [ | ||
'meta' => [ | ||
'title' => 'Date related functions/calls', | ||
// Default values. If not specified will be the one used | ||
'prefix' => 'Humbug', | ||
'whitelist' => [], | ||
'whitelist-global-constants' => true, | ||
'whitelist-global-classes' => false, | ||
'whitelist-global-functions' => true, | ||
'registered-classes' => [], | ||
'registered-functions' => [], | ||
], | ||
|
||
'date values' => <<<'PHP' | ||
<?php | ||
const ISO8601_BASIC = 'Ymd\THis\Z'; | ||
new Foo('d\H\Z'); | ||
new DateTime('d\H\Z'); | ||
new DateTimeImmutable('d\H\Z'); | ||
date_create('d\H\Z'); | ||
date('d\H\Z'); | ||
gmdate('d\H\Z'); | ||
DateTime::createFromFormat('d\H\Z', '15\Feb\2009'); | ||
DateTimeImmutable::createFromFormat('d\H\Z', '15\Feb\2009'); | ||
date_create_from_format('d\H\Z', '15\Feb\2009'); | ||
(new DateTime('now'))->format('d\H\Z'); | ||
date_format(new DateTime('now'), 'd\H\Z'); | ||
---- | ||
<?php | ||
namespace Humbug; | ||
const ISO8601_BASIC = 'Humbug\\Ymd\\THis\\Z'; | ||
new \Humbug\Foo('Humbug\\d\\H\\Z'); | ||
new \DateTime('d\\H\\Z'); | ||
new \DateTimeImmutable('d\\H\\Z'); | ||
\date_create('d\\H\\Z'); | ||
\date('d\\H\\Z'); | ||
\gmdate('d\\H\\Z'); | ||
\DateTime::createFromFormat('d\\H\\Z', '15\\Feb\\2009'); | ||
\DateTimeImmutable::createFromFormat('d\\H\\Z', '15\\Feb\\2009'); | ||
\date_create_from_format('d\\H\\Z', '15\\Feb\\2009'); | ||
(new \DateTime('now'))->format('Humbug\\d\\H\\Z'); | ||
\date_format(new \DateTime('now'), 'Humbug\\d\\H\\Z'); | ||
|
||
PHP | ||
, | ||
|
||
'date values in a namespace' => <<<'PHP' | ||
<?php | ||
namespace Acme; | ||
use DateTime; | ||
use DateTimeImmutable; | ||
const ISO8601_BASIC = 'Ymd\THis\Z'; | ||
new Foo('d\H\Z'); | ||
new DateTime('d\H\Z'); | ||
new DateTimeImmutable('d\H\Z'); | ||
date_create('d\H\Z'); | ||
date('d\H\Z'); | ||
gmdate('d\H\Z'); | ||
DateTime::createFromFormat('d\H\Z', '15\Feb\2009'); | ||
DateTimeImmutable::createFromFormat('d\H\Z', '15\Feb\2009'); | ||
date_create_from_format('d\H\Z', '15\Feb\2009'); | ||
(new DateTime('now'))->format('d\H\Z'); | ||
date_format(new DateTime('now'), 'd\H\Z'); | ||
---- | ||
<?php | ||
namespace Humbug\Acme; | ||
use DateTime; | ||
use DateTimeImmutable; | ||
const ISO8601_BASIC = 'Humbug\\Ymd\\THis\\Z'; | ||
new \Humbug\Acme\Foo('Humbug\\d\\H\\Z'); | ||
new \DateTime('d\\H\\Z'); | ||
new \DateTimeImmutable('d\\H\\Z'); | ||
\date_create('d\\H\\Z'); | ||
\date('d\\H\\Z'); | ||
\gmdate('d\\H\\Z'); | ||
\DateTime::createFromFormat('d\\H\\Z', '15\\Feb\\2009'); | ||
\DateTimeImmutable::createFromFormat('d\\H\\Z', '15\\Feb\\2009'); | ||
\date_create_from_format('d\\H\\Z', '15\\Feb\\2009'); | ||
(new \DateTime('now'))->format('Humbug\\d\\H\\Z'); | ||
\date_format(new \DateTime('now'), 'Humbug\\d\\H\\Z'); | ||
|
||
PHP | ||
, | ||
]; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters