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

Prevent unintentional backward compatibility breaks #3718

Closed
2 tasks
sebastianbergmann opened this issue Jun 10, 2019 · 8 comments
Closed
2 tasks

Prevent unintentional backward compatibility breaks #3718

sebastianbergmann opened this issue Jun 10, 2019 · 8 comments
Labels
type/enhancement A new idea that should be implemented

Comments

@sebastianbergmann
Copy link
Owner

Add BackwardCompatibilityCheck to the build pipeline to automatically detect unintentional backward compatibility breaks.

This is currently blocked by

  • BackwardCompatibilityCheck does not ignore API breaks in code annotated with @internal
  • BackwardCompatibilityCheck chokes on annotations such as \PHPUnit\Util\TestDox\array<int,

According to @Ocramius, these issues are being worked on.

@Ocramius
Copy link
Contributor

@sebastianbergmann I implemented Roave/BackwardCompatibilityCheck#51 (@internal)

For Roave/BackwardCompatibilityCheck#134 (docblock parsing), I got Roave/BackwardCompatibilityCheck#142

Would you prefer trying dev-master after Roave/BackwardCompatibilityCheck#142 is merged, or would you rather have a released phar?

@Ocramius
Copy link
Contributor

Tried it on phpunit/phpunit:dev-master@0bf3d5a4ed8edb6500e4d0aaf1c0c92a75dc3897:

../../roave/ApiCompare/bin/roave-backward-compatibility-check 
Detected last minor version: 8.2.0
Comparing from 256de4e5b9d7959b368e3ee3510767effae9f185 to 0bf3d5a4ed8edb6500e4d0aaf1c0c92a75dc3897...
Loading composer repositories with package information
Updating dependencies
Package operations: 28 installs, 0 updates, 0 removals
  - Installing myclabs/deep-copy (1.9.1): Loading from cache
  - Installing phar-io/version (2.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.3): Loading from cache
  - Installing phpunit/php-timer (2.1.2): Loading from cache
  - Installing sebastian/diff (3.0.2): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Loading from cache
  - Installing sebastian/exporter (3.1.0): Loading from cache
  - Installing sebastian/object-reflector (1.1.1): Loading from cache
  - Installing sebastian/global-state (3.0.0): Loading from cache
  - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  - Installing sebastian/resource-operations (2.0.1): Loading from cache
  - Installing doctrine/instantiator (1.2.0): Loading from cache
  - Installing sebastian/comparator (3.0.2): Loading from cache
  - Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
  - Installing webmozart/assert (1.4.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.3.1): Loading from cache
  - Installing phpspec/prophecy (1.8.1): Loading from cache
  - Installing theseer/tokenizer (1.1.3): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/environment (4.2.2): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/php-token-stream (3.0.2): Loading from cache
  - Installing phpunit/php-file-iterator (2.0.2): Loading from cache
  - Installing phpunit/php-code-coverage (7.0.6): Loading from cache
  - Installing sebastian/type (1.1.3): Loading from cache
Writing lock file
Loading composer repositories with package information
Updating dependencies
Package operations: 28 installs, 0 updates, 0 removals
  - Installing myclabs/deep-copy (1.9.1): Loading from cache
  - Installing phar-io/version (2.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.3): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Loading from cache
  - Installing doctrine/instantiator (1.2.0): Loading from cache
  - Installing sebastian/exporter (3.1.0): Loading from cache
  - Installing sebastian/diff (3.0.2): Loading from cache
  - Installing sebastian/comparator (3.0.2): Loading from cache
  - Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
  - Installing webmozart/assert (1.4.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.3.1): Loading from cache
  - Installing phpspec/prophecy (1.8.1): Loading from cache
  - Installing theseer/tokenizer (1.1.3): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/environment (4.2.2): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/php-token-stream (3.0.2): Loading from cache
  - Installing phpunit/php-file-iterator (2.0.2): Loading from cache
  - Installing phpunit/php-code-coverage (7.0.6): Loading from cache
  - Installing phpunit/php-timer (2.1.2): Loading from cache
  - Installing sebastian/object-reflector (1.1.1): Loading from cache
  - Installing sebastian/global-state (3.0.0): Loading from cache
  - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  - Installing sebastian/resource-operations (2.0.1): Loading from cache
  - Installing sebastian/type (1.1.3): Loading from cache
Writing lock file
[BC] REMOVED: Method PHPUnit\Framework\TestCase#__construct() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#doubledTypes() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getGroups() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setGroups() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getAnnotations() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getName() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getSize() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#hasSize() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#isSmall() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#isMedium() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#isLarge() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getActualOutput() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#hasOutput() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#doesNotPerformAssertions() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#hasExpectationOnOutput() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getExpectedException() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getExpectedExceptionCode() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getExpectedExceptionMessage() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getExpectedExceptionMessageRegExp() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setRegisterMockObjectsFromTestArgumentsRecursively() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setUseErrorHandler() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#runBare() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setName() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setDependencies() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getDependencies() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#hasDependencies() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setDependencyInput() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getDependencyInput() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setBeStrictAboutChangesToGlobalState() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setBackupGlobals() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setBackupStaticAttributes() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setRunTestInSeparateProcess() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setRunClassInSeparateProcess() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setPreserveGlobalState() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setInIsolation() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#isInIsolation() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getResult() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setResult() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setOutputCallback() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getTestResultObject() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#setTestResultObject() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#registerMockObject() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#addToAssertionCount() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getNumAssertions() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#usesDataProvider() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#dataDescription() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#dataName() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getDataSetAsString() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#getProvidedData() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#addWarning() was removed
[BC] REMOVED: Method PHPUnit\Framework\TestCase#createResult() was removed
[BC] CHANGED: PHPUnit\Framework\TestCase#__construct() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#doubledTypes() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getGroups() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setGroups() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getAnnotations() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getName() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getSize() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#hasSize() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#isSmall() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#isMedium() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#isLarge() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getActualOutput() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#hasOutput() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#doesNotPerformAssertions() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#hasExpectationOnOutput() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getExpectedException() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getExpectedExceptionCode() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getExpectedExceptionMessage() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getExpectedExceptionMessageRegExp() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setRegisterMockObjectsFromTestArgumentsRecursively() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setUseErrorHandler() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#runBare() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setName() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setDependencies() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getDependencies() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#hasDependencies() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setDependencyInput() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getDependencyInput() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setBeStrictAboutChangesToGlobalState() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setBackupGlobals() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setBackupStaticAttributes() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setRunTestInSeparateProcess() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setRunClassInSeparateProcess() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setPreserveGlobalState() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setInIsolation() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#isInIsolation() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getResult() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setResult() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setOutputCallback() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getTestResultObject() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#setTestResultObject() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#registerMockObject() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#addToAssertionCount() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getNumAssertions() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#usesDataProvider() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#dataDescription() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#dataName() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getDataSetAsString() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#getProvidedData() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#addWarning() was marked "@internal"
[BC] CHANGED: PHPUnit\Framework\TestCase#createResult() was marked "@internal"
102 backwards-incompatible changes detected

@Ocramius
Copy link
Contributor

After verifying that it works as expected, released the tool as 4.0.0: feel free to include it in CI, but be aware that 8.2.0 ~ master has the aforementioned BC breaks, which will crash your builds until 8.3.0 is released.

@sebastianbergmann
Copy link
Owner Author

The methods reported as being removed have not been removed. Or "removed" mean "removed from public API"?

@Ocramius
Copy link
Contributor

Ocramius commented Jul 18, 2019

Yes, they are now @internal, so they effectively do not exist for downstream consumers anymore.

This is a duplication due to MethodRemoved and FunctionMarkedInternal rules doing the same check. Could be a bit confusing, but the output is correct.

@sebastianbergmann
Copy link
Owner Author

Yes, it is correct. Yes, I was confused. :)

@sebastianbergmann
Copy link
Owner Author

Implemented in 90b1b7a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants