Skip to content

OTT-918 php warning for laravel shortcodes #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webwizo/laravel-shortcodes",
"type": "library",
"description": "Wordpress like shortcodes for Laravel 5, 6, 7, and 8",
"description": "Wordpress like shortcodes for Laravel 5, 6, 7, 8, and 9",
"keywords": [
"laravel",
"wordpress",
Expand All @@ -18,16 +18,16 @@
}
],
"require": {
"illuminate/view": "5.6.x|5.7.x|5.8.x|^6.0|^7.0|^8.0",
"illuminate/support": "5.6.x|5.7.x|5.8.x|^6.0|^7.0|^8.0",
"illuminate/contracts": "5.6.x|5.7.x|5.8.x|^6.0|^7.0|^8.0",
"illuminate/view": "5.6.x|5.7.x|5.8.x|^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/support": "5.6.x|5.7.x|5.8.x|^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/contracts": "5.6.x|5.7.x|5.8.x|^6.0|^7.0|^8.0|^9.0|^10.0",
"php": "^7.2|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5|^8.0",
"orchestra/testbench": "~3.8.0",
"phpunit/phpunit": "^8.0|^9.0",
"orchestra/testbench": "~3.9.0|^4.0|^5.0|^6.0|^7.0|^8.0",
"scrutinizer/ocular": "^1.5",
"squizlabs/php_codesniffer": "~2.3"
"squizlabs/php_codesniffer": "~2.3|^3.7"
},
"autoload": {
"classmap": [
Expand Down Expand Up @@ -55,4 +55,4 @@
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/Compilers/Shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class Shortcode implements Arrayable
* Constructor
*
* @param string $name
* @param array $attributes
* @param string $content
* @param array $attributes
*/
public function __construct($name, $attributes = [], $content)
public function __construct($name, $content, $attributes = [])
{
$this->name = $name;
$this->attributes = $attributes;
$this->content = $content;
$this->attributes = $attributes;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/Compilers/ShortcodeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ShortcodeCompiler
* @var array
*/
protected $data = [];

protected $_viewData;

/**
Expand Down Expand Up @@ -141,11 +141,11 @@ protected function renderShortcodes($value)

return preg_replace_callback("/{$pattern}/s", [$this, 'render'], $value);
}

// get view data
public function viewData( $viewData )
{
$this->_viewData = $viewData;
$this->_viewData = array_merge($this->_viewData ?? [], $viewData);
return $this;
}

Expand Down Expand Up @@ -190,8 +190,8 @@ protected function compileShortcode($matches)
// return shortcode instance
return new Shortcode(
$this->getName(),
$attributes,
$this->getContent()
$this->getContent(),
$attributes
);
}

Expand Down Expand Up @@ -373,7 +373,7 @@ protected function stripTag($m)

return $m[1] . $m[6];
}

/**
* Get registered shortcodes
*
Expand Down