Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Cache {
* @param int $expiresIn
* @return mixed
*/
public function get($key, callable $cached = null, $expiresIn = 0);
public function get($key, ?callable $cached = null, $expiresIn = 0);

/**
* @param string $key
Expand Down
4 changes: 2 additions & 2 deletions src/Cache/Sqlite/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class Cache implements CacheInterface {

private $functions;

public function __construct(array $config, string $namespace, ObjectifiedFunctions $functions = null) {
public function __construct(array $config, string $namespace, ?ObjectifiedFunctions $functions = null) {
$this->cacheRoot = (string) $config['cacheRoot'];
$this->name = (string) ($config['name'] ?? 'cache');
$this->maxSize = (int) $config['maxSize'];
$this->namespace = $namespace;
$this->functions = $functions ?? new ObjectifiedFunctions();
}

public function get($key, callable $fn = null, $expiresIn = 0) {
public function get($key, ?callable $fn = null, $expiresIn = 0) {
return $this->getManager()->get($this->getKey($key), $fn, $expiresIn, $this->functions);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Common/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class System {
private $functions;

public function __construct(ObjectifiedFunctions $functions = null) {
public function __construct(?ObjectifiedFunctions $functions = null) {
if ($functions === null) {
$functions = new ObjectifiedFunctions();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ItemNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ItemNotFoundException extends \Exception {
*/
private $url;

public function __construct($message = '', $code = 0, Throwable $previous = null, URL $failed = null) {
public function __construct($message = '', $code = 0, ?Throwable $previous = null, ?URL $failed = null) {
parent::__construct($message, $code, $previous);
$this->url = $failed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Filters/HTML/CSSInlining/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private function inlineCSS(
return $elements;
}

private function addIEFallback(URL $fallbackUrl = null, array $elements = null) {
private function addIEFallback(?URL $fallbackUrl = null, ?array $elements = null) {
if ($fallbackUrl === null || !$elements) {
return $elements;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function __construct(
* @param bool $mustExist
* @return string
*/
public function rewriteUrl($url, URL $baseUrl = null, array $params = [], $mustExist = false) {
public function rewriteUrl($url, ?URL $baseUrl = null, array $params = [], $mustExist = false) {
if (strpos($url, '#') === 0) {
return $url;
}
Expand Down Expand Up @@ -171,7 +171,7 @@ public function getCacheSalt() {
* @param URL|null $baseUrl
* @return URL|null
*/
private function makeURLAbsoluteToBase($url, URL $baseUrl = null) {
private function makeURLAbsoluteToBase($url, ?URL $baseUrl = null) {
$url = trim($url);
if (!$url || substr($url, 0, 5) === 'data:') {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Filters/HTML/ScriptsProxyService/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
ServiceSignature $signature,
LocalRetriever $retriever,
TokenRefMaker $tokenRefMaker,
ObjectifiedFunctions $functions = null
?ObjectifiedFunctions $functions = null
) {
$this->config = $config;
$this->signature = $signature;
Expand Down
2 changes: 1 addition & 1 deletion src/Filters/Image/ImageImplementations/DefaultImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DefaultImage extends BaseImage implements Image {
*/
private $funcs;

public function __construct(URL $imageURL, Retriever $retriever, ObjectifiedFunctions $funcs = null) {
public function __construct(URL $imageURL, Retriever $retriever, ?ObjectifiedFunctions $funcs = null) {
$this->imageURL = $imageURL;
$this->retriever = $retriever;
$this->funcs = is_null($funcs) ? new ObjectifiedFunctions() : $funcs;
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/LogWriters/PHPError/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Writer extends BaseLogWriter {
* @param array $config
* @param ObjectifiedFunctions $funcs
*/
public function __construct(array $config, ObjectifiedFunctions $funcs = null) {
public function __construct(array $config, ?ObjectifiedFunctions $funcs = null) {
foreach (['messageType', 'destination', 'extraHeaders'] as $field) {
if (isset($config[$field])) {
$this->$field = $config[$field];
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/LogWriters/RotatingTextFile/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Writer extends BaseLogWriter {
* @param array $config
* @param ?ObjectifiedFunctions $funcs
*/
public function __construct(array $config, ObjectifiedFunctions $funcs = null) {
public function __construct(array $config, ?ObjectifiedFunctions $funcs = null) {
if (isset($config['path'])) {
$this->path = (string) $config['path'];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Logging/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Logger {
* Logger constructor.
* @param LogWriter $writer
*/
public function __construct(LogWriter $writer, ObjectifiedFunctions $functions = null) {
public function __construct(LogWriter $writer, ?ObjectifiedFunctions $functions = null) {
$this->writer = $writer;
$this->functions = is_null($functions) ? new ObjectifiedFunctions() : $functions;
}
Expand Down
4 changes: 2 additions & 2 deletions src/PhastServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PhastServices {
/**
* @param callable|null $getConfig
*/
public static function serve(callable $getConfig = null) {
public static function serve(?callable $getConfig = null) {
$httpRequest = Request::fromGlobals();

if ($httpRequest->getHeader('CDN-Loop')
Expand Down Expand Up @@ -131,7 +131,7 @@ public static function output(
Request $request,
Response $response,
array $config,
ObjectifiedFunctions $funcs = null
?ObjectifiedFunctions $funcs = null
) {
if (is_null($funcs)) {
$funcs = new ObjectifiedFunctions();
Expand Down
2 changes: 1 addition & 1 deletion src/Retrievers/CachingRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CachingRetriever implements Retriever {
* @param Cache $cache
* @param int $defaultCacheTime
*/
public function __construct(Cache $cache, Retriever $retriever = null, $defaultCacheTime = 0) {
public function __construct(Cache $cache, ?Retriever $retriever = null, $defaultCacheTime = 0) {
$this->cache = $cache;
$this->retriever = $retriever;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Retrievers/LocalRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LocalRetriever implements Retriever {
* @param array $map
* @param ObjectifiedFunctions|null $functions
*/
public function __construct(array $map, ObjectifiedFunctions $functions = null) {
public function __construct(array $map, ?ObjectifiedFunctions $functions = null) {
$this->map = $map;
if ($functions) {
$this->funcs = $functions;
Expand Down
2 changes: 1 addition & 1 deletion src/Retrievers/PostDataRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PostDataRetriever implements Retriever {
* PostDataRetriever constructor.
* @param ObjectifiedFunctions $funcs
*/
public function __construct(ObjectifiedFunctions $funcs = null) {
public function __construct(?ObjectifiedFunctions $funcs = null) {
$this->funcs = is_null($funcs) ? new ObjectifiedFunctions() : $funcs;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ValueObjects/PhastJavaScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private function __construct(string $filename, string $script, bool $minified) {
* @param string $filename
* @param ObjectifiedFunctions|null $funcs
*/
public static function fromFile($filename, ObjectifiedFunctions $funcs = null) {
public static function fromFile($filename, ?ObjectifiedFunctions $funcs = null) {
$funcs = $funcs ? $funcs : new ObjectifiedFunctions();
$contents = $funcs->file_get_contents($filename);
if ($contents === false) {
Expand Down
2 changes: 1 addition & 1 deletion test/php/Filters/Service/CachingServiceFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function setUp(): void {

$cache = $this->createMock(Cache::class);
$cache->method('get')
->willReturnCallback(function ($key, callable $cb = null, $ttl = 0) {
->willReturnCallback(function ($key, ?callable $cb = null, $ttl = 0) {
if (!isset($this->cachedData[$key])) {
if ($cb) {
$data = $cb();
Expand Down
2 changes: 1 addition & 1 deletion test/php/Services/Scripts/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function setUp(): void {
$this->retriever = $this->createMock(Retriever::class);
$this->filter = $this->createMock(ServiceFilter::class);
$this->filter->method('apply')
->willReturnCallback(function (Resource $resource, array $params = null) {
->willReturnCallback(function (Resource $resource, ?array $params = null) {
if (isset($this->returnResource)) {
return $this->returnResource;
}
Expand Down