Skip to content
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

Updated composer.json to allow newer versions of ZF2. #1442

Merged
merged 2 commits into from
Oct 15, 2014
Merged

Updated composer.json to allow newer versions of ZF2. #1442

merged 2 commits into from
Oct 15, 2014

Conversation

michaelmoussa
Copy link
Contributor

I've had to resort to forking phpDocumentor and updating composer.json in order to use it in my projects requiring Zend Framework 2.3.x.

After talking a bit with @rdohms and seeing his comment here, I decided to prepare this PR along with tests in hopes of being able to remove my fork.

As a base case, let's take a developer who is using PHP 5.3.3 and wanting the current 2.7.0 release of phpDocumentor.

vagrant@packer-vmware-iso:~/my-app$ php -v
PHP 5.3.3 (cli) (built: Oct 15 2014 16:54:14)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
vagrant@packer-vmware-iso:~/my-app$ cat composer.json
{
    "name": "vagrant/my-app",
    "repositories": [
        {
            "url": "../phpDocumentor2",
            "type": "git"
        }
    ],
    "require-dev": {
        "phpdocumentor/phpdocumentor": "dev-master"
    }
}

../phpDocumentor2 is a local clone of the upstream repo, currently referencing commit 98b28ee (i.e. 2.7.0).

vagrant@packer-vmware-iso:~/my-app$ composer install --dev
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing zendframework/zend-stdlib (2.1.6)
  --snip--
Writing lock file
Generating autoload files

I omitted most of the output for brevity, but as you can see, it installs 2.1.x ZF2 packages (as expected).

Now, what if the PR is applied?

diff --git a/composer.json b/composer.json
index 7e89d06..de825c3 100644
--- a/composer.json
+++ b/composer.json
@@ -30,13 +30,13 @@
         "jms/serializer":           "~0.12",
         "knplabs/knp-menu":         "~1.1",

-        "zendframework/zend-stdlib":         "2.1.*",
-        "zendframework/zend-servicemanager": "2.1.*",
-        "zendframework/zend-config":         "2.1.*",
-        "zendframework/zend-i18n":           "2.1.*",
-        "zendframework/zend-serializer":     "2.1.*",
-        "zendframework/zend-cache":          "2.1.*",
-        "zendframework/zend-filter":         "2.1.*",
+        "zendframework/zend-stdlib":         "~2.1",
+        "zendframework/zend-servicemanager": "~2.1",
+        "zendframework/zend-config":         "~2.1",
+        "zendframework/zend-i18n":           "~2.1",
+        "zendframework/zend-serializer":     "~2.1",
+        "zendframework/zend-cache":          "~2.1",
+        "zendframework/zend-filter":         "~2.1",

         "phpdocumentor/graphviz":            "~1.0",
         "phpdocumentor/fileset":             "~1.0",
diff --git a/composer.lock b/composer.lock
index de4c2c7..246081e 100644
--- a/composer.lock
+++ b/composer.lock
-- snip ---

composer.lock diff omitted for brevity.

vagrant@packer-vmware-iso:~/my-app$ rm -rf vendor/* && rm composer.lock
vagrant@packer-vmware-iso:~/my-app$ composer install --dev
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing zendframework/zend-stdlib (2.2.6)
  --snip--
Writing lock file
Generating autoload files

This time, we get 2.2.6. (yes, ZF2 went up to 2.2.8, but the individual components required by phpDocumentor stopped at 2.2.6).

Now, what if our application requires at least ZF2 version 2.3? Obviously, this won't work on our PHP 5.3.3 VM, but if we upgrade to 5.5.x...

vagrant@packer-vmware-iso:~/my-app$ php -v
PHP 5.5.9-1ubuntu4.4 (cli) (built: Sep  4 2014 06:56:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
vagrant@packer-vmware-iso:~/my-app$ rm -rf vendor/* && rm composer.lock
vagrant@packer-vmware-iso:~/my-app$ composer require "zendframework/zendframework":"~2.3"
./composer.json has been updated
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing zendframework/zendframework (2.3.3)
  --snip--
Writing lock file
Generating autoload files

I hope this testing is sufficient to ease any concerns, and that you will merge this PR.

@mvriel
Copy link
Member

mvriel commented Oct 15, 2014

Hi @michaelmoussa,

Thank you for submitting this PR; the changes in the composer.json should work excellently. I did notice however that you ran composer update and committed the new lock file. This caused ZF to be updated to 2.3+ and this is exactly what we cannot support.

In addition to this all other libraries are updated as well; can you please revert the changes to the composer.lock and run composer update none?

This is a trick to update none of the packages but it makes sure that the lock file and the json file are in sync.

@michaelmoussa
Copy link
Contributor Author

Sure @mvriel. Must have been because I prepared the PR from my PHP 5.5 environment - oops!

@rdohms
Copy link
Contributor

rdohms commented Oct 15, 2014

@mvriel please note the the composer.lock of phpDocumentor is not relevant to anyone using phpDocumentor, only to those installing it for contributing purposes. So this does not really affect your users.

@rdohms
Copy link
Contributor

rdohms commented Oct 15, 2014

Also, don't use composer update nothing, use composer update --lock it has the same effect but is not "hacky" and is the "official" way to do it.

@mvriel
Copy link
Member

mvriel commented Oct 15, 2014

@rdohms the composer.lock file is relevant for Travis and the releases of phpDocumentor such as the PEAR package and the PHAR file

@mvriel
Copy link
Member

mvriel commented Oct 15, 2014

When I encountered this stuff --lock did not exist yet ;)

@rdohms
Copy link
Contributor

rdohms commented Oct 15, 2014

Yes, just making sure we clear up why we are worried about these aspects.

@michaelmoussa
Copy link
Contributor Author

There seems to be a lot of other changes to the composer.lock file if I run composer update --lock, such as version numbers of symfony and doctrine packages.

I'm going to provide just the composer.json change and see if Travis is satisfied with that.

@michaelmoussa
Copy link
Contributor Author

@mvriel It's complaining about some failed tests, but those look like they were introduced prior to my PR.

mvriel added a commit that referenced this pull request Oct 15, 2014
Updated composer.json to allow newer versions of ZF2.
@mvriel mvriel merged commit a93ff7b into phpDocumentor:develop Oct 15, 2014
@michaelmoussa michaelmoussa deleted the allow-newer-zf2 branch October 15, 2014 19:17
@mvriel
Copy link
Member

mvriel commented Oct 15, 2014

Thanks @michaelmoussa! I appreciate this!

@michaelmoussa
Copy link
Contributor Author

You're welcome! When do you expect you'll be able to tag this?

@mvriel
Copy link
Member

mvriel commented Oct 15, 2014

Hmm.. it is quite some time until the next real tag. But if it helps you I can cherrypick your changes to master and do a 2.7.1 tag. Let me know!

@michaelmoussa
Copy link
Contributor Author

Yes. A cherry-pick would be very helpful! Thanks

@mvriel
Copy link
Member

mvriel commented Oct 15, 2014

I had to re-commit because of the conflict caused by the lock file (and I couldn't solve it for some reason); but a new tag 2.7.1 is made with your changes. Thanks again for the fix!

@michaelmoussa
Copy link
Contributor Author

Great! Thanks again for phpDocumentor. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants