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
2 changes: 1 addition & 1 deletion Swat/SwatActionItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getHtmlHeadEntrySet()
*/
public function getAvailableHtmlHeadEntrySet()
{
$set = parent::geAvailabletHtmlHeadEntrySet();
$set = parent::getAvailableHtmlHeadEntrySet();

if ($this->widget !== null) {
$set->addEntrySet($this->widget->getAvailableHtmlHeadEntrySet());
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ protected function getJavaScriptClass()
/**
* Gets the inline JavaScript required for this control.
*
* @return stirng the inline JavaScript required for this control
* @return string the inline JavaScript required for this control
*/
protected function getInlineJavaScript()
{
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatChangeOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function display()
$list_div->class = 'swat-change-order-list';
$list_div->open();

$option_div = new SwatHtmltag('div');
$option_div = new SwatHtmlTag('div');
$option_div->class = 'swat-change-order-item';

foreach ($ordered_options as $option) {
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function __construct($id = null)
*
* Implements the {SwatTitleable::getTitle()} interface.
*
* @return the title of this fieldset
* @return string the title of this fieldset
*/
public function getTitle()
{
Expand Down
2 changes: 0 additions & 2 deletions Swat/SwatForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ public function display()
*
* This form is only marked as processed if it was submitted by the user.
*
* @return true if this form was actually submitted, false otherwise
*
* @see SwatContainer::process()
*/
public function process()
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatHtmlHeadEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getType()
*/
public function getIECondition()
{
return $this->ie_conditional;
return $this->ie_condition;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Swat/SwatInputCell.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,8 @@ public function copy($id_suffix = '')
$copy_clone = $clone->copy($id_suffix);
$copy_clone->parent = $copy;
$copy->clones[$replicator_id] = $copy_clone;
if ($copy_child->id !== null) {
$copy->children_by_id[$copy_child->id] = $copy_child;
if ($copy_clone->id !== null) {
$copy->children_by_id[$copy_clone->id] = $copy_clone;
}

$clone->widgets[$replicator_id] = [];
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatListEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function setState($values)
* For list entry, this is a delimiter separated string containing the
* elements of {@link SwatListEntry::$values}.
*
* @param array $value the value to format for display
* @param string $value the value to format for display
*
* @return string the values displayed in the XHTML input
*/
Expand Down
5 changes: 2 additions & 3 deletions Swat/SwatRadioNoteBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ public function printWidgetTree()
{
echo get_class($this), ' ', $this->id;

$children = $this->getChildren();
if (count($children) > 0) {
if (count($this->children) > 0) {
echo '<ul>';
foreach ($children as $child) {
foreach ($this->children as $child) {
echo '<li>';
$child->printWidgetTree();
echo '</li>';
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatTableView.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @copyright 2004-2016 silverorange
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
*/
class SwatTableView extends SwatView implements SwatUIParent
class SwatTableView extends SwatView
{
/**
* The column of this table-view that data in the model is currently being
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatTileView.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @see SwatTile
*/
class SwatTileView extends SwatView implements SwatUIParent
class SwatTileView extends SwatView
{
/**
* Whether to show a "check all" widget.
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatTreeNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getParent()
*/
public function getChildren(): ?RecursiveIterator
{
return $this->children;
return new RecursiveArrayIterator($this->children);
}

/**
Expand Down
5 changes: 0 additions & 5 deletions Swat/SwatUIObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ public function addComment($comment)
);
}

public function addInlineScript($script)
{
$this->inline_scripts->add($script);
}

/**
* Gets the first ancestor object of a specific class.
*
Expand Down
6 changes: 3 additions & 3 deletions Swat/SwatUIParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public function addChild(SwatObject $child);
* this object. Widgets are ordered in the array as they are found in
* a breadth-first traversal of the subtree.
*
* @param string $class_name optional class name. If set, only UI-objects
* that are instances of <i>$class_name</i> are
* returned.
* @param ?class-string $class_name optional class name. If set, only UI-objects
* that are instances of <i>$class_name</i> are
* returned.
*
* @return array the descendant UI-objects of this object. If descendant
* objects have identifiers, the identifier is used as the
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatView.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @copyright 2004-2016 silverorange
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
*/
abstract class SwatView extends SwatControl
abstract class SwatView extends SwatControl implements SwatUIParent
{
/**
* A data structure that holds the data to display in this view.
Expand Down
2 changes: 1 addition & 1 deletion Swat/SwatYUIComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SwatYUIComponent extends SwatObject
{
private $id;
private $dependencies = [];
private $html_head_entries = [];
private $html_head_entry_set = [];
private $beta = false;

/**
Expand Down
8 changes: 3 additions & 5 deletions Swat/exceptions/SwatIntegerOverflowException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ class SwatIntegerOverflowException extends OverflowException
* Sign.
*
* The sign of the integer, either positive or negative
*
* @var int
*/
protected $sign;
protected int $sign;

/**
* Creates a new invalid type exception.
Expand All @@ -25,7 +23,7 @@ class SwatIntegerOverflowException extends OverflowException
* @param int $sign the sign of the integer, either positive or
* negative
*/
public function __construct($message = null, $code = 0, $sign = 1)
public function __construct(string $message = '', int $code = 0, int $sign = 1)
{
parent::__construct($message, $code);

Expand All @@ -37,7 +35,7 @@ public function __construct($message = null, $code = 0, $sign = 1)
*
* @return int the sign of the integer, either positive or negative
*/
public function getSign()
public function getSign(): int
{
return $this->sign;
}
Expand Down
10 changes: 5 additions & 5 deletions SwatI18N/SwatI18NLocale.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,15 @@ public function parseInteger($string)
if ($string > (float) PHP_INT_MAX) {
throw new SwatIntegerOverflowException(
'Floating point value is too big to be an integer',
null,
0,
1,
);
}

if ($string < (float) (-PHP_INT_MAX - 1)) {
throw new SwatIntegerOverflowException(
'Floating point value is too small to be an integer',
null,
0,
-1,
);
}
Expand Down Expand Up @@ -1002,7 +1002,7 @@ protected function formatIntegerGroupings(
$grouping_total = floor($grouping_total / pow(10, $grouping));
if ($grouping_total > 0) {
$grouping_value = str_pad(
$grouping_value,
(string) $grouping_value,
$grouping,
'0',
STR_PAD_LEFT,
Expand Down Expand Up @@ -1039,7 +1039,7 @@ protected function formatIntegerGroupings(

if ($grouping_total > 0) {
$grouping_value = str_pad(
$grouping_value,
(string) $grouping_value,
$grouping,
'0',
STR_PAD_LEFT,
Expand Down Expand Up @@ -1086,7 +1086,7 @@ protected function formatFractionalPart(
$frac_part = abs(fmod($value, 1));
$frac_part = round($frac_part * pow(10, $fractional_digits));
$frac_part = str_pad(
$frac_part,
(string) $frac_part,
$fractional_digits,
'0',
STR_PAD_LEFT,
Expand Down
53 changes: 0 additions & 53 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,55 +1,2 @@
parameters:
ignoreErrors:
-
message: '#^Call to an undefined static method SwatControl\:\:geAvailabletHtmlHeadEntrySet\(\)\.$#'
identifier: staticMethod.notFound
count: 1
path: Swat/SwatActionItem.php

-
message: '#^Class SwatHtmlTag referenced with incorrect case\: SwatHtmltag\.$#'
identifier: class.nameCase
count: 1
path: Swat/SwatChangeOrder.php

-
message: '#^Method SwatForm\:\:process\(\) should return true but return statement is missing\.$#'
identifier: return.missing
count: 2
path: Swat/SwatForm.php

-
message: '#^Access to an undefined property SwatHtmlHeadEntry\:\:\$ie_conditional\.$#'
identifier: property.notFound
count: 1
path: Swat/SwatHtmlHeadEntry.php

-
message: '#^Undefined variable\: \$copy_child$#'
identifier: variable.undefined
count: 3
path: Swat/SwatInputCell.php

-
message: '#^Call to an undefined method SwatRadioNoteBook\:\:getChildren\(\)\.$#'
identifier: method.notFound
count: 1
path: Swat/SwatRadioNoteBook.php

-
message: '#^Access to an undefined property SwatUIObject\:\:\$inline_scripts\.$#'
identifier: property.notFound
count: 1
path: Swat/SwatUIObject.php

-
message: '#^Call to an undefined method SwatView\:\:getDescendants\(\)\.$#'
identifier: method.notFound
count: 1
path: Swat/SwatView.php

-
message: '#^Access to an undefined property SwatYUIComponent\:\:\$html_head_entry_set\.$#'
identifier: property.notFound
count: 3
path: Swat/SwatYUIComponent.php
9 changes: 9 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ parameters:
- SwatI18N
editorUrl: '%%relFile%%:%%line%%'
editorUrlTitle: '%%relFile%%:%%line%%'
# Checks from higher levels that we want to include here
# Level 2
checkClassCaseSensitivity: true
checkPhpDocMissingReturn: true
# checkThisOnly: false
# Level 3
checkPhpDocMethodSignatures: true
# Level 5
# checkFunctionArgumentTypes: true