Skip to content

Commit

Permalink
const_default_func_args (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
lexidor authored and azjezz committed Nov 19, 2019
1 parent 02fbf39 commit 771ff22
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .hhconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ safe_array = true
safe_vector_array = true
unsafe_rx = false
ignored_paths = [ "vendor/.+/tests/.+", "vendor/.+/bin/.+" ]
const_default_func_args = true
5 changes: 4 additions & 1 deletion src/Nuxed/Asset/Package.hack
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ use namespace HH\Lib\Str;
* Basic package that adds a version to asset URLs.
*/
class Package implements IPackage {
private Context\IContext $context;

public function __construct(
private VersionStrategy\IVersionStrategy $versionStrategy,
private Context\IContext $context = new Context\NullContext(),
?Context\IContext $context = null
) {
$this->context = $context ?? new Context\NullContext();
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Nuxed/Asset/PathPackage.hack
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class PathPackage extends Package {
public function __construct(
string $basePath,
IVersionStrategy $versionStrategy,
IContext $context = new Context\NullContext(),
?IContext $context = null,
) {
$context ??= new Context\NullContext();
parent::__construct($versionStrategy, $context);

if ('' === $basePath) {
Expand Down
3 changes: 2 additions & 1 deletion src/Nuxed/Asset/UrlPackage.hack
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ class UrlPackage extends Package {
public function __construct(
Container<string> $baseUrls,
VersionStrategy\IVersionStrategy $versionStrategy,
Context\IContext $context = new Context\NullContext(),
?Context\IContext $context = null,
) {
$context ??= new Context\NullContext();
parent::__construct($versionStrategy, $context);

if (C\is_empty($baseUrls)) {
Expand Down

0 comments on commit 771ff22

Please sign in to comment.