getherbert / herbert

The WordPress Plugin Framework:
http://getherbert.com/
632 stars 94 forks source link

Cannot submit to Wordpress.org SVN repo. #99

Closed jamiechong closed 8 years ago

jamiechong commented 8 years ago

I'm coming across an issue where Herbert framework dependencies require PHP 5.5+. Specifically Illuminate Database. It's a problem because I'm trying to submit a Herbert based plugin to Wordpress.org and their linter is catching "errors" related to new PHP 5.5 specific syntax. Their linter tests agains PHP 5.4.

This means that Wordpress.org is rejecting my plugin when I try to commit code to the SVN repository. Has anyone successfully submitted to Wordpress.org?

jasonagnew commented 8 years ago

Quick fix would editing your plugins composer.json to set a PHP version like:

{
  "name": "getherbert/herbert-plugin",
  "description": "Herbert plugin",
  "license": "MIT",
  "require": {
    "php": "<=5.4.0",
    "getherbert/framework": "~0.9"
  },
  "config": {
    "preferred-install": "dist"
  },
  "minimum-stability": "dev",
  "autoload": {
    "psr-4": {
      "MyPlugin\\": "app/"
    }
  }
}

If that doesn't work you supply the version of Illuminate Database which uses PHP 5.4 like so:

{
  "name": "getherbert/herbert-plugin",
  "description": "Herbert plugin",
  "license": "MIT",
  "require": {
    "illuminate/database": "5.0.33",
    "getherbert/framework": "~0.9"
  },
  "config": {
    "preferred-install": "dist"
  },
  "minimum-stability": "dev",
  "autoload": {
    "psr-4": {
      "MyPlugin\\": "app/"
    }
  }
}
jamiechong commented 8 years ago

@jasonagnew Good suggestion, but composer isn't finding a set of installable packages with that config.

jamiechong commented 8 years ago

@jasonagnew I apologize - I've made progress with your 2nd suggestion. It would be worth documenting this as I'm surprised others haven't complained about being unable to submit to wordpress.org.

jasonagnew commented 8 years ago

Also before submitting make sure you don't include the vender tests. Example .gitignore

vendor/**/test/
vendor/**/tests/
jamiechong commented 8 years ago

Well - I spent too much time worrying about the PHP 5.4 linter and didn't test the actual app. I'm getting this error: Fatal error: Declaration of Herbert\Framework\Application::make() must be compatible with Illuminate\Contracts\Container\Container::make($abstract, $parameters = Array) in vendor/getherbert/framework/Herbert/Framework/Application.php on line 12

imboden commented 8 years ago

It would be interesting to get a full documentation on what we should do and configure before sending a plugin to the WordPress official repo! I don't know if I really can use Herbert or if it's too risky...

jamiechong commented 8 years ago

The error was related to this fix using this commit. Because I'm using an older version of Illuminate/Database, I had to essentially reverse the fix in Herbert/Framework/Application.php so that the make() function was compatible.

Line 965:
    //public function make($abstract, Array $parameters = array())
    public function make($abstract, $parameters = [])

@jasonagnew is there release version of Herbert/Framework that I can use in composer.json that is compatible with illuminate/database 5.0.33? Currently I've modified the vendor code, which is less than ideal. EDIT: After looking through the framework code, I don't think a version exists - or at least it's way too old. It would benefit the community if a version of the Herbert project is released that is compatible with Wordpress.org. It would mean downgrading packages that contain PHP >=5.5 code. As you can gather from this post, Wordpress.org admins are enforcing PHP 5.4 syntax.

Regardless, with the changes made above (Downgrade illuminate/database in composer.json and modify Framework/Application.php), I was able to successfully get my Herbert based project committed to Wordpress.org/plugins.

jeremyzahner commented 8 years ago

@onnimonni @jamiechong We should probably close this issue and go along with the newly created one #115.

jeremyzahner commented 8 years ago

@jamiechong @imboden Please refer to #115 for further discussions on how we should provide documentation/examples on this matter.