Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
8 changes: 5 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ jobs:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
Expand All @@ -43,7 +45,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -56,6 +58,6 @@ jobs:
run: php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage report
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion src/Helper/AbstractList.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ abstract class AbstractList extends AbstractHelper
* @return self
*
*/
public function __invoke(array $attr = null)
public function __invoke($attr = null)
{
if ($attr !== null) {
$this->attr = $attr;
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Input extends HelperLocator
* @return mixed
*
*/
public function __invoke(array $spec = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit confused, can we do array $spec = [] to fix this ? I didnot noticed where the casting was done . (array) $attr mentioned. May be I missed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment, @harikt!

I kept the $spec = null as-is to avoid any behavior changes in legacy code — this method has been around since the PHP 5.x days. Instead of relying on a type hint, I tried to compensate with a more precise PHPDoc type so modern static analysis tools can still verify correctness.

The idea is to preserve runtime compatibility while improving type clarity at the tooling level.

Happy to add an explicit cast if you think it's safer. Let me know what you think!

public function __invoke($spec = null)
{
if ($spec === null) {
return $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Input/AbstractInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ abstract class AbstractInput extends AbstractHelper
* @return string
*
*/
public function __invoke(array $spec = null)
public function __invoke($spec = null)
{
if ($spec !== null) {
$this->prep($spec);
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Input/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Select extends AbstractInput
* @return string|self
*
*/
public function __invoke(array $spec = null)
public function __invoke($spec = null)
{
if ($spec !== null) {
$this->prep($spec);
Expand Down
18 changes: 9 additions & 9 deletions src/Helper/Styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Styles extends AbstractSeries
* @return self
*
*/
public function add($href, array $attr = null, $pos = 100)
public function add($href, $attr = null, $pos = 100)
{
$attr = $this->fixAttr($href, $attr);
$tag = $this->void('link', $attr);
Expand All @@ -64,7 +64,7 @@ public function add($href, array $attr = null, $pos = 100)
* @return self
*
*/
public function addCond($cond, $href, array $attr = null, $pos = 100)
public function addCond($cond, $href, $attr = null, $pos = 100)
{
$attr = $this->fixAttr($href, $attr);
$link = $this->void('link', $attr);
Expand All @@ -85,7 +85,7 @@ public function addCond($cond, $href, array $attr = null, $pos = 100)
*
* @access protected
*/
protected function style($css, array $attr = null)
protected function style($css, $attr = null)
{
$attr = $this->fixInternalAttr($attr);
$attr = $this->escaper->attr($attr);
Expand All @@ -103,7 +103,7 @@ protected function style($css, array $attr = null)
*
* @access public
*/
public function addInternal($css, array $attr = null, $pos = 100)
public function addInternal($css, $attr = null, $pos = 100)
{
$style = $this->style($css, $attr);
$this->addElement($pos, $style);
Expand All @@ -126,7 +126,7 @@ public function addInternal($css, array $attr = null, $pos = 100)
* @return self
*
*/
public function addCondInternal($cond, $css, array $attr = null, $pos = 100)
public function addCondInternal($cond, $css, $attr = null, $pos = 100)
{
$style = $this->style($css, $attr);
$cond = $this->escaper->html($cond);
Expand All @@ -146,7 +146,7 @@ public function addCondInternal($cond, $css, array $attr = null, $pos = 100)
*
* @access public
*/
public function beginInternal(array $attr = null, $pos = 100)
public function beginInternal($attr = null, $pos = 100)
{
$this->capture[] = array(
'attr' => $attr,
Expand All @@ -167,7 +167,7 @@ public function beginInternal(array $attr = null, $pos = 100)
*
* @access public
*/
public function beginCondInternal($cond, array $attr = null, $pos = 100)
public function beginCondInternal($cond, $attr = null, $pos = 100)
{
$this->capture[] = array(
'attr' => $attr,
Expand Down Expand Up @@ -215,7 +215,7 @@ public function endInternal()
*
* @access protected
*/
protected function fixInternalAttr(array $attr = null)
protected function fixInternalAttr($attr = null)
{
$attr = (array) $attr;

Expand All @@ -241,7 +241,7 @@ protected function fixInternalAttr(array $attr = null)
* @return array The fixed attributes.
*
*/
protected function fixAttr($href, array $attr = null)
protected function fixAttr($href, $attr = null)
{
$attr = (array) $attr;

Expand Down