Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function validDataFromRequest()
* @param array|null $keys Subset of keys to retrieve.
* @return array|null
*/
public function getParams(array $keys = null)
public function getParams(?array $keys = null)
{
$params = $this->params;

Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Charcoal/Admin/AdminAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ protected function validateCaptcha($token)
* with a new Response object that represents a client error.
* @return boolean Returns TRUE if the user response is valid, FALSE if it is invalid.
*/
protected function validateCaptchaFromRequest(RequestInterface $request, ResponseInterface &$response = null)
protected function validateCaptchaFromRequest(RequestInterface $request, ?ResponseInterface &$response = null)
{
$token = $request->getParam('g-recaptcha-response', false);
if (empty($token)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function headerMenu()
* @throws InvalidArgumentException If the secondary menu widget is invalid.
* @return \Charcoal\Admin\Widget\SecondaryMenuWidgetInterface[]
*/
protected function createHeaderMenu(array $menuItems = null)
protected function createHeaderMenu(?array $menuItems = null)
{
if ($menuItems === null) {
return $this->createSecondaryMenu();
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/Charcoal/Admin/Mustache/AssetsHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AssetsHelpers implements HelpersInterface
/**
* @param array $data Class Dependencies.
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
if (isset($data['assets']) && $data['assets'] instanceof AssetManager) {
$this->assets = $data['assets'];
Expand Down Expand Up @@ -87,7 +87,7 @@ protected function reset()
* @param LambdaHelper|null $helper For rendering strings in the current context.
* @return string|self
*/
public function __invoke($text = null, LambdaHelper $helper = null)
public function __invoke($text = null, ?LambdaHelper $helper = null)
{
if (func_num_args() === 0 || $this->action === null) {
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ protected function setDependencies(Container $container)
* @param array $data Optional metadata to merge on the object.
* @return PropertyMetadata
*/
protected function createMetadata(array $data = null)
protected function createMetadata(?array $data = null)
{
$class = $this->metadataClass();
return new $class($data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BasicInput extends TinymceInput
*
* @param array $data Dependencies.
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
parent::__construct($data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ protected function labelFromProp(IdProperty $prop)
* @param IdProperty $oldProp The previous ID property to analyse.
* @return self
*/
protected function describeConversion(IdProperty $newProp, IdProperty $oldProp = null)
protected function describeConversion(IdProperty $newProp, ?IdProperty $oldProp = null)
{
if ($oldProp) {
$new = $this->labelFromProp($newProp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ protected function registerViewExtensions(Container $container)
* @param string $uri A URI path to wrap.
* @return string
*/
'withAdminUrl' => function ($uri, LambdaHelper $helper = null) use ($adminUrl) {
'withAdminUrl' => function ($uri, ?LambdaHelper $helper = null) use ($adminUrl) {
if ($helper) {
$uri = $helper->render($uri);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ private function formatBytes($bytes)
* @param DateTimeInterface|null $date2 The datetime to compare against.
* @return string
*/
private function formatTimeDiff(DateTimeInterface $date1, DateTimeInterface $date2 = null)
private function formatTimeDiff(DateTimeInterface $date1, ?DateTimeInterface $date2 = null)
{
$isNow = $date2 === null;
if ($isNow) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ protected function createCollectionLoader()
* @param array|null $data Optional collection data.
* @return void
*/
protected function configureCollectionLoader(CollectionLoader $loader, array $data = null)
protected function configureCollectionLoader(CollectionLoader $loader, ?array $data = null)
{
$this->getObjTypeOrFail();

Expand Down Expand Up @@ -787,7 +787,7 @@ public function collection()
* @throws Exception If the object type of the colletion has not been set.
* @return ModelInterface[]
*/
public function createCollection(array $data = null)
public function createCollection(?array $data = null)
{
$objType = $this->getObjTypeOrFail();

Expand Down
6 changes: 3 additions & 3 deletions packages/admin/src/Charcoal/Admin/Widget/DocWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public function action()
* @throws UnexpectedValueException If a property data is invalid.
* @return DocFormPropertyWidget[]|Generator
*/
public function formProperties(array $group = null)
public function formProperties(?array $group = null)
{
$obj = $this->obj();
$props = $obj->metadata()->properties();
Expand Down Expand Up @@ -632,7 +632,7 @@ protected function dataFromObject()
* @param array|null $data Optional. The form group data to set.
* @return FormGroupInterface
*/
protected function createFormGroup(array $data = null)
protected function createFormGroup(?array $data = null)
{
$type = $this->defaultGroupType();

Expand Down Expand Up @@ -674,7 +674,7 @@ protected function createFormGroup(array $data = null)
*/
protected function updateFormGroup(
FormGroupInterface $group,
array $groupData = null,
?array $groupData = null,
$groupIdent = null
) {
$group->setForm($this);
Expand Down
12 changes: 6 additions & 6 deletions packages/admin/src/Charcoal/Admin/Widget/FormWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function setData(array $data)
* @param array $data Optional. The form property data to set.
* @return FormPropertyWidget
*/
public function createFormProperty(array $data = null)
public function createFormProperty(?array $data = null)
{
$p = $this->widgetFactory()->create($this->formPropertyClass());
if ($data !== null) {
Expand Down Expand Up @@ -167,7 +167,7 @@ public function formPropertyClass()
* @throws InvalidArgumentException If the property is already registered.
* @return \Charcoal\Admin\Widget\FormPropertyWidget|mixed
*/
public function getOrCreateFormProperty($ident, array $data = null)
public function getOrCreateFormProperty($ident, ?array $data = null)
{
if ($this->updateFormProperty($ident, $data)) {
return $this->formProperties[$ident];
Expand Down Expand Up @@ -203,7 +203,7 @@ public function getOrCreateFormProperty($ident, array $data = null)
* @throws InvalidArgumentException If the property is already registered.
* @return \Charcoal\Admin\Widget\FormPropertyWidget|mixed
*/
public function getOrCreateHiddenProperty($ident, array $data = null)
public function getOrCreateHiddenProperty($ident, ?array $data = null)
{
if ($this->updateHiddenProperty($ident, $data)) {
return $this->hiddenProperties[$ident];
Expand Down Expand Up @@ -233,7 +233,7 @@ public function getOrCreateHiddenProperty($ident, array $data = null)
* @param array $data Property metadata.
* @return \Charcoal\Admin\Widget\FormPropertyWidget|mixed
*/
protected function buildFormProperty($ident, array $data = null)
protected function buildFormProperty($ident, ?array $data = null)
{
$formProperty = $this->createFormProperty();
$formProperty->setPropertyIdent($ident);
Expand Down Expand Up @@ -264,7 +264,7 @@ protected function buildFormProperty($ident, array $data = null)
* @param array $data Property metadata.
* @return \Charcoal\Admin\Widget\FormPropertyWidget|null
*/
protected function updateFormProperty($ident, array $data = null)
protected function updateFormProperty($ident, ?array $data = null)
{
if ($ident && isset($this->formProperties[$ident])) {
$formProperty = $this->formProperties[$ident];
Expand All @@ -286,7 +286,7 @@ protected function updateFormProperty($ident, array $data = null)
* @param array $data Property metadata.
* @return \Charcoal\Admin\Widget\FormPropertyWidget|null
*/
protected function updateHiddenProperty($ident, array $data = null)
protected function updateHiddenProperty($ident, ?array $data = null)
{
if ($ident && isset($this->hiddenProperties[$ident])) {
$formProperty = $this->hiddenProperties[$ident];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function setDependencies(Container $container)
* @param callable $widgetCallback A callback applied to each widget.
* @return UiItemInterface[]|\Generator
*/
public function widgets(callable $widgetCallback = null)
public function widgets(?callable $widgetCallback = null)
{
$widgets = $this->widgets;

Expand Down
8 changes: 4 additions & 4 deletions packages/admin/src/Charcoal/Admin/Widget/ObjectFormWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function action()
* @throws UnexpectedValueException If a property data is invalid.
* @return FormPropertyWidget[]|\Generator
*/
public function formProperties(array $group = null)
public function formProperties(?array $group = null)
{
$obj = $this->obj();
$props = $obj->metadata()->properties();
Expand Down Expand Up @@ -385,7 +385,7 @@ public function widgetDataForJs()
* @param array|null $groups Form groups to parse.
* @return array
*/
protected function groupsConditionalLogic(array $groups = null)
protected function groupsConditionalLogic(?array $groups = null)
{
if (!$groups) {
$groups = iterator_to_array($this->groups());
Expand Down Expand Up @@ -704,7 +704,7 @@ public function parseFormProperties()
* @param array|null $data Optional. The form group data to set.
* @return FormGroupInterface
*/
protected function createFormGroup(array $data = null)
protected function createFormGroup(?array $data = null)
{
if (isset($data['type'])) {
$type = $data['type'];
Expand Down Expand Up @@ -743,7 +743,7 @@ protected function createFormGroup(array $data = null)
*/
protected function updateFormGroup(
FormGroupInterface $group,
array $groupData = null,
?array $groupData = null,
$groupIdent = null
) {
$group->setForm($this);
Expand Down
14 changes: 7 additions & 7 deletions packages/admin/src/Charcoal/Admin/Widget/TableWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ public function objectCreateUrl()
* @param ModelInterface|null $object The object to test.
* @return boolean
*/
public function isObjActive(ModelInterface $object = null)
public function isObjActive(?ModelInterface $object = null)
{
if ($object === null) {
$object = $this->getCurrentObjOrProto();
Expand All @@ -949,7 +949,7 @@ public function isObjActive(ModelInterface $object = null)
* @param ModelInterface|null $object The object to test.
* @return boolean
*/
public function isObjCreatable(ModelInterface $object = null)
public function isObjCreatable(?ModelInterface $object = null)
{
if ($object === null) {
$object = $this->proto();
Expand All @@ -972,7 +972,7 @@ public function isObjCreatable(ModelInterface $object = null)
* @param ModelInterface|null $object The object to test.
* @return boolean
*/
public function isObjEditable(ModelInterface $object = null)
public function isObjEditable(?ModelInterface $object = null)
{
if ($object === null) {
$object = $this->getCurrentObjOrProto();
Expand All @@ -995,7 +995,7 @@ public function isObjEditable(ModelInterface $object = null)
* @param ModelInterface|null $object The object to test.
* @return boolean
*/
public function isObjDeletable(ModelInterface $object = null)
public function isObjDeletable(?ModelInterface $object = null)
{
if ($object === null) {
$object = $this->getCurrentObjOrProto();
Expand All @@ -1018,7 +1018,7 @@ public function isObjDeletable(ModelInterface $object = null)
* @param ModelInterface|null $object The object to test.
* @return boolean
*/
public function isObjViewable(ModelInterface $object = null)
public function isObjViewable(?ModelInterface $object = null)
{
if ($object === null) {
$object = $this->getCurrentObjOrProto();
Expand Down Expand Up @@ -1064,7 +1064,7 @@ protected function setDependencies(Container $container)
* @param array|null $data Optional collection data.
* @return void
*/
protected function configureCollectionLoader(CollectionLoader $loader, array $data = null)
protected function configureCollectionLoader(CollectionLoader $loader, ?array $data = null)
{
$this->configureCollectionLoaderFromTrait($loader, $data);

Expand Down Expand Up @@ -1372,7 +1372,7 @@ protected function parsePropertyCell(
*/
protected function parsePropertyCellClasses(
PropertyInterface $property,
ModelInterface $object = null
?ModelInterface $object = null
) {
unset($object);

Expand Down
2 changes: 1 addition & 1 deletion packages/admin/tests/Charcoal/Admin/Mock/SortableModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SortableModel extends AbstractModel
/**
* @param array $data Dependencies.
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
$data['metadata'] = [
'properties' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ protected function registerMustacheHelpersServices(Container $container): void
* @param string $uri A URI path to wrap.
* @return string
*/
'withBaseUrl' => function ($uri, LambdaHelper $helper = null) use ($baseUrl) {
'withBaseUrl' => function ($uri, ?LambdaHelper $helper = null) use ($baseUrl) {
if ($helper) {
$uri = $helper->render($uri);
}
Expand All @@ -556,7 +556,7 @@ protected function registerMustacheHelpersServices(Container $container): void

return $uri;
},
'renderContext' => function ($text, LambdaHelper $helper = null) {
'renderContext' => function ($text, ?LambdaHelper $helper = null) {
return $helper->render('{{>' . $helper->render($text) . '}}');
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Attachment extends Content implements AttachableInterface
*
* @param array $data Dependencies.
*/
public function __construct(array $data = null)
public function __construct(?array $data = null)
{
parent::__construct($data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function preSave()
* @param array $properties Optional. The list of properties to update.
* @return boolean
*/
public function preUpdate(array $properties = null)
public function preUpdate(?array $properties = null)
{
$this->generateThumbnail();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ protected function describeCount($count, $plural, $singular, $zero)
* @param array|null $feedback Update the feedback.
* @return boolean
*/
protected function deleteObject(AttachableInterface $obj, &$pruned = null, &$failed = null, array &$feedback = null)
protected function deleteObject(AttachableInterface $obj, &$pruned = null, &$failed = null, ?array &$feedback = null)
{
$verb = $this->verbose();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ trait AttachmentAwareTrait
public function getAttachments(
$group = null,
$type = null,
callable $before = null,
callable $after = null
?callable $before = null,
?callable $after = null
) {
if (is_array($group)) {
$options = $group;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __construct(array $data)
* @param mixed $ttl An integer, interval, date, or NULL to use the facade's default value.
* @return mixed The value corresponding to this cache item's $key, or NULL if not found.
*/
public function get($key, callable $resolve = null, $ttl = null)
public function get($key, ?callable $resolve = null, $ttl = null)
{
$pool = $this->cachePool();
$item = $pool->getItem($key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function dataFromMetadata()
* @throws \UnexpectedValueException If a property data is invalid.
* @return FormPropertyWidget[]
*/
public function formProperties(array $group = null)
public function formProperties(?array $group = null)
{
if (
!key_exists(self::DATA_SOURCE_METADATA, array_flip($this->dataSources())) ||
Expand Down
Loading
Loading