Skip to content

Commit

Permalink
Merge dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzap committed Feb 21, 2017
2 parents 5b68baf + 9bfe96c commit c93e872
Show file tree
Hide file tree
Showing 30 changed files with 188 additions and 114 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
* Case whatever we get from `get_option(uninstall_plugins)` to an array, to avoid throwing a warning. See [#36].
* Fix variable syntax for `.env` file template. See [#38].
* Fix RuntimeException because of `DB_NAME`, `DB_USER`, `DB_PASSWORD` not set. See [#48].
* Code styles fixes.
* Improve `Helpers::addHook()` by using WordPress function when available and loading `plugin.php` earlier on WP 4.7+. See [#50].
* Add WP CLI step that adds a `wp-cli.yml` file in the project root. See [#33].
* Code styles fixes.
* Declare strict types in all files.

## [2.3.2] - 2016-07-28

Expand Down
4 changes: 1 addition & 3 deletions wpstarter/src/Env/Env.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WP Starter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand Down
10 changes: 4 additions & 6 deletions wpstarter/src/Env/Loader.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the wpstarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -28,9 +26,9 @@ final class Loader extends DotenvLoader
*/
public function setEnvironmentVariable($name, $value = null)
{
list($name, $value) = $this->normaliseEnvironmentVariable($name, $value);
list($normalised_name, $value) = $this->normaliseEnvironmentVariable($name, $value);

in_array($name, $this->allVars, true) or $this->allVars[] = $name;
in_array($normalised_name, $this->allVars, true) or $this->allVars[] = $normalised_name;

if (!$this->immutable || is_null($this->getEnvironmentVariable($name))) {
parent::setEnvironmentVariable($name, $value);
Expand Down
10 changes: 6 additions & 4 deletions wpstarter/src/Helpers.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WP Starter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand Down Expand Up @@ -77,7 +75,11 @@ public static function addHook($hook, $callable, $priority = 10, $argsNum = 1)
return;
}

if (defined(ABSPATH) && is_file(ABSPATH.'wp-includes/plugin.php')) {
if (
defined(ABSPATH)
&& is_file(ABSPATH.'wp-includes/class-wp-hook.php')
&& is_file(ABSPATH.'wp-includes/plugin.php')
) {
require_once ABSPATH.'wp-includes/plugin.php';
if (class_exists('WP_Hook')) {
add_filter($hook, $callable, $priority, $argsNum);
Expand Down
9 changes: 5 additions & 4 deletions wpstarter/src/MuLoader/MuLoader.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WP Starter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand Down Expand Up @@ -108,7 +106,10 @@ private function loading($refresh, $transient)
*/
private function loadPlugin($key, $file, $refresh, $transient)
{
if (is_readable($file) && strtolower(pathinfo($file, PATHINFO_EXTENSION)) === 'php') {
if (
is_readable($file)
&& strtolower( (string) pathinfo($file, PATHINFO_EXTENSION)) === 'php'
) {
wp_register_plugin_realpath($file);
if (in_array($file, $this->regular, true)) {
$this->regularLoaded[] = $file;
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/MuLoader/PluginAsMuLoader.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
8 changes: 4 additions & 4 deletions wpstarter/src/Setup.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -25,6 +23,7 @@
use WCM\WPStarter\Setup\Steps\GitignoreStep;
use WCM\WPStarter\Setup\Steps\IndexStep;
use WCM\WPStarter\Setup\Steps\MoveContentStep;
use WCM\WPStarter\Setup\Steps\WPCliStep;
use WCM\WPStarter\Setup\Steps\WPConfigStep;

/**
Expand Down Expand Up @@ -102,6 +101,7 @@ private function install(Composer $composer, Config $config, IO $io, array $extr
->addStep(new EnvExampleStep($io, $builder))
->addStep(new DropinsStep($io, $overwrite))
->addStep(new GitignoreStep($io, $builder))
->addStep(new WPCliStep($builder))
->addStep(new MoveContentStep($io))
->run($paths);
}
Expand Down
8 changes: 3 additions & 5 deletions wpstarter/src/Setup/Config.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -185,7 +183,7 @@ private function validateBoolOrAskOrUrl($value)
private function validateBoolOrAsk($value)
{
$asks = array('ask', 'prompt', 'query', 'interrogate', 'demand');
if (in_array(trim(strtolower($value)), $asks, true)) {
if (is_string($value) && in_array(trim(strtolower($value)), $asks, true)) {
return 'ask';
}

Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/FileBuilder.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/IO.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/OverwriteHelper.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Salter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Stepper.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/StepperInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/BlockingStepInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/CheckPathStep.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/DropinStep.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
8 changes: 3 additions & 5 deletions wpstarter/src/Setup/Steps/DropinsStep.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -147,7 +145,7 @@ private function validName($name)
if ($this->config['unknown-dropins'] === true || in_array($name, self::$dropins, true)) {
return true;
}
$ext = pathinfo($name, PATHINFO_EXTENSION);
$ext = (string) pathinfo($name, PATHINFO_EXTENSION);
if (strtolower($ext) !== 'php') {
return $this->config['unknown-dropins'] === 'ask' && $this->ask($name, 0);
}
Expand Down
7 changes: 2 additions & 5 deletions wpstarter/src/Setup/Steps/EnvExampleStep.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace WCM\WPStarter\Setup\Steps;

use WCM\WPStarter\Setup\IO;
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/FileStepInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
7 changes: 2 additions & 5 deletions wpstarter/src/Setup/Steps/GitignoreStep.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace WCM\WPStarter\Setup\Steps;

use WCM\WPStarter\Setup\Config;
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/IndexStep.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/MoveContentStep.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php declare( strict_types = 1 ); # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/OptionalStepInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/PostProcessStepInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
6 changes: 2 additions & 4 deletions wpstarter/src/Setup/Steps/StepInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
<?php # -*- coding: utf-8 -*-
/*
* This file is part of the WPStarter package.
*
* (c) Giuseppe Mazzapica <[email protected]>
* This file is part of the WP Starter package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
Loading

0 comments on commit c93e872

Please sign in to comment.