mirror of
https://github.com/gantry/gantry5.git
synced 2026-08-19 01:15:04 -05:00
Fixed phpstan level 4 issues (common code)
This commit is contained in:
@@ -25,7 +25,6 @@ platforms/*/*/engines
|
||||
# Grav
|
||||
|
||||
platforms/grav/gantry5/vendor
|
||||
platforms/grav/gantry5/composer.lock
|
||||
|
||||
# Symbolic links in themes
|
||||
themes/*/*/common
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
- Updated minimum requirement to PHP 5.6.0
|
||||
- Updated Symfony Components from v2.8 to v3.4
|
||||
- Updated SCSS compiler to v1.0
|
||||
- Platform independent code passes phpstan level 3 tests
|
||||
- Platform independent code passes phpstan level 4 tests
|
||||
1. [](#improved)
|
||||
- Major code cleanup for PHP 5.6+
|
||||
1. [Joomla](#joomla)
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
{
|
||||
"description": "Test environment for phpstan",
|
||||
"name": "gantry/grav",
|
||||
"description": "Gantry Framework Library",
|
||||
"license": "MIT",
|
||||
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
"scssphp/scssphp": "~1.0"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.1.3"
|
||||
}
|
||||
"require-dev": {
|
||||
"symfony/event-dispatcher": "~3.4",
|
||||
"symfony/yaml": "~3.4",
|
||||
"twig/twig": "~1.42",
|
||||
"pimple/pimple": "~3.2",
|
||||
"filp/whoops": "~2.3",
|
||||
"rockettheme/toolbox": "~1.4",
|
||||
"erusev/parsedown-extra": "~0.7",
|
||||
"phpunit/phpunit": "3.7.*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -23,5 +31,10 @@
|
||||
"src/RealLoader.php",
|
||||
"cli/ChildThemeCommand.php"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.1.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+1053
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -14,6 +14,8 @@
|
||||
|
||||
namespace Gantry5;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
|
||||
/**
|
||||
* Use \Gantry5\Loader::setup() or \Gantry5\Loader::get() instead.
|
||||
*
|
||||
@@ -102,7 +104,7 @@ abstract class RealLoader
|
||||
throw new \LogicException('Please run composer in Gantry 5 Library!');
|
||||
}
|
||||
|
||||
/** @var \Composer\Autoload\ClassLoader $loader */
|
||||
/** @var ClassLoader $loader */
|
||||
$loader = require $autoload;
|
||||
|
||||
if ($dev) {
|
||||
|
||||
@@ -18,6 +18,7 @@ use Gantry\Component\Config\BlueprintForm;
|
||||
use Gantry\Component\Config\ConfigFileFinder;
|
||||
use Gantry\Component\File\CompiledYamlFile;
|
||||
use Gantry\Framework\Gantry;
|
||||
use Gantry\Framework\Platform;
|
||||
use Gantry\Framework\Theme as SiteTheme;
|
||||
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
|
||||
|
||||
@@ -71,8 +72,8 @@ class Particles
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
if (!$this->particles)
|
||||
{
|
||||
if (!$this->particles) {
|
||||
/** @var Platform $platform */
|
||||
$platform = $this->container['platform'];
|
||||
$files = $this->locateParticles();
|
||||
|
||||
@@ -83,7 +84,7 @@ class Particles
|
||||
$particle = (array)$file->content();
|
||||
$file->free();
|
||||
|
||||
if (!isset($particle['dependencies']) || $platform->checkDependencies($particle['dependencies'])) {
|
||||
if (empty($particle['dependencies']) || $platform->checkDependencies($particle['dependencies'])) {
|
||||
$this->particles[$key] = $particle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ class Format2
|
||||
'layout' => $structure
|
||||
];
|
||||
|
||||
if ($this->structure) {
|
||||
if (!empty($this->structure)) {
|
||||
$result['structure'] = $this->structure;
|
||||
}
|
||||
|
||||
if ($this->content) {
|
||||
if (!empty($this->content)) {
|
||||
$result['content'] = $this->content;
|
||||
}
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ class Item implements \ArrayAccess, \Iterator, \Serializable, \Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $ordering
|
||||
* @param array|null $ordering
|
||||
* @return $this
|
||||
*/
|
||||
public function sortChildren($ordering)
|
||||
|
||||
@@ -69,7 +69,7 @@ class Positions extends Collection
|
||||
$position = (array)CompiledYamlFile::instance($info->getPathname())->content();
|
||||
|
||||
// Only use filesystem position if it it is properly set up.
|
||||
if ($position) {
|
||||
if (!empty($position)) {
|
||||
$positions[$name] = new Position($name, $position);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user