Skip to content

Commit 7f6eb35

Browse files
authored
Merge pull request #1 from localheinz/feature/name
Enhancement: Rename package
2 parents d7e7810 + 063bfff commit 7f6eb35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+152
-301
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @localheinz

.github/settings.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# https://github.com/probot/settings
2+
3+
branches:
4+
- name: master
5+
protection:
6+
enforce_admins: false
7+
required_pull_request_reviews:
8+
dismiss_stale_reviews: true
9+
require_code_owner_reviews: true
10+
required_approving_review_count: 1
11+
required_status_checks:
12+
contexts:
13+
- "Travis CI - Branch"
14+
- "Travis CI - Pull Request"
15+
strict: false
16+
restrictions: null
17+
18+
labels:
19+
- name: bug
20+
color: ee0701
21+
22+
- name: enhancement
23+
color: 0e8a16
24+
25+
repository:
26+
allow_merge_commit: true
27+
allow_rebase_merge: false
28+
allow_squash_merge: false
29+
default_branch: master
30+
description: "::fork_and_knife:Fork of sebastian/diff for use with localheinz/composer-normalize."
31+
has_downloads: true
32+
has_issues: false
33+
has_pages: false
34+
has_projects: false
35+
has_wiki: false
36+
name: diff
37+
private: false

.travis.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
language: php
22

3+
env:
4+
global:
5+
- secure: "Qh1la5ftgwh6pGgNZaAxnCdIIj8sANQifZYtHubaOeadSj1IjNndfgVtYBr2sx+ID/CO5DcLsVvpZJgyDIO8+jGCCXAxWiaXcMoEEc38CJpW+aQfhoZ15gkAHrmWh1u9T8fcrCizjtq7OzUS7Huc8D7g1uGFieP5PR//ywFOH3Gn9J2tzJwxIJoq0hqIBcW/BmbNVbHr9WFyU1L6L/lTLVgt9xadypo0Y3B36vkOPuq5TsqoJ+rbmLWRn2KGK2/PXzuNEfSRV2HGaYtyyYtLKYr3F+Dem7ckF6Zyjh6QqfHECxZkywdBRx/8SztZJAa0cUwIMSllBkYon4aLfSWvyRQJWEbZhCUFEacJIF8mZnhi/rXNakbJOySqiQWBL2PFJ0K51nWbHfYKNS71Z5chXav6dkQSxXKCDzARXmx3L8rpIJ2tXuWmcnR0Zn11EDzaPp65IpL1W3zlAxEKCmfW1XKiU8n0D72/8fqTXgrbbJ62VieclSW0rqJLXj040+r6zHACNJ1DN6UAuvanSnQ/CeewtFLlYxzt1QfROb5gKRTFsg4Dk3Lg1gEn6ZLPsrmvILxzLJV0C9UjRowlJ72EFE1TiRsXyMxW80I2CrPOtOrEswV5yHhZlZsT3SpBqtixr/o2dNtoogzbzarGL/vH9tmKH115LamzenpU0ZYCXnU="
6+
7+
cache:
8+
directories:
9+
- $HOME/.composer/cache
10+
311
php:
412
- 7.1
513
- 7.2
614
- 7.3
7-
- 7.4snapshot
815

916
before_install:
10-
- composer self-update
11-
- composer clear-cache
17+
- phpenv config-rm xdebug.ini
1218

1319
install:
14-
- travis_retry composer update --no-interaction --no-ansi --no-progress --no-suggest --optimize-autoloader --prefer-stable
20+
- composer update --no-ansi --no-interaction --no-progress --no-suggest --optimize-autoloader --prefer-stable
1521

1622
script:
17-
- ./vendor/bin/phpunit --coverage-clover=coverage.xml
18-
19-
after_success:
20-
- bash <(curl -s https://codecov.io/bash)
23+
- ./vendor/bin/phpunit
2124

2225
notifications:
2326
email: false

README.md

Lines changed: 3 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1,195 +1,5 @@
1-
# sebastian/diff
1+
# localheinz/diff
22

3-
Diff implementation for PHP, factored out of PHPUnit into a stand-alone component.
3+
This is a fork of [`sebastian/diff`](https://github.com/sebastianbergmann/diff) for use with [`localheinz/composer-normalize`](https://github.com/localheinz/composer-normalize), with permission from Sebastian Bergmann.
44

5-
## Installation
6-
7-
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
8-
9-
composer require sebastian/diff
10-
11-
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
12-
13-
composer require --dev sebastian/diff
14-
15-
### Usage
16-
17-
#### Generating diff
18-
19-
The `Differ` class can be used to generate a textual representation of the difference between two strings:
20-
21-
```php
22-
<?php
23-
use SebastianBergmann\Diff\Differ;
24-
25-
$differ = new Differ;
26-
print $differ->diff('foo', 'bar');
27-
```
28-
29-
The code above yields the output below:
30-
```diff
31-
--- Original
32-
+++ New
33-
@@ @@
34-
-foo
35-
+bar
36-
```
37-
38-
There are three output builders available in this package:
39-
40-
#### UnifiedDiffOutputBuilder
41-
42-
This is default builder, which generates the output close to udiff and is used by PHPUnit.
43-
44-
```php
45-
<?php
46-
47-
use SebastianBergmann\Diff\Differ;
48-
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
49-
50-
$builder = new UnifiedDiffOutputBuilder(
51-
"--- Original\n+++ New\n", // custom header
52-
false // do not add line numbers to the diff
53-
);
54-
55-
$differ = new Differ($builder);
56-
print $differ->diff('foo', 'bar');
57-
```
58-
59-
#### StrictUnifiedDiffOutputBuilder
60-
61-
Generates (strict) Unified diff's (unidiffs) with hunks,
62-
similar to `diff -u` and compatible with `patch` and `git apply`.
63-
64-
```php
65-
<?php
66-
67-
use SebastianBergmann\Diff\Differ;
68-
use SebastianBergmann\Diff\Output\StrictUnifiedDiffOutputBuilder;
69-
70-
$builder = new StrictUnifiedDiffOutputBuilder([
71-
'collapseRanges' => true, // ranges of length one are rendered with the trailing `,1`
72-
'commonLineThreshold' => 6, // number of same lines before ending a new hunk and creating a new one (if needed)
73-
'contextLines' => 3, // like `diff: -u, -U NUM, --unified[=NUM]`, for patch/git apply compatibility best to keep at least @ 3
74-
'fromFile' => null,
75-
'fromFileDate' => null,
76-
'toFile' => null,
77-
'toFileDate' => null,
78-
]);
79-
80-
$differ = new Differ($builder);
81-
print $differ->diff('foo', 'bar');
82-
```
83-
84-
#### DiffOnlyOutputBuilder
85-
86-
Output only the lines that differ.
87-
88-
```php
89-
<?php
90-
91-
use SebastianBergmann\Diff\Differ;
92-
use SebastianBergmann\Diff\Output\DiffOnlyOutputBuilder;
93-
94-
$builder = new DiffOnlyOutputBuilder(
95-
"--- Original\n+++ New\n"
96-
);
97-
98-
$differ = new Differ($builder);
99-
print $differ->diff('foo', 'bar');
100-
```
101-
102-
#### DiffOutputBuilderInterface
103-
104-
You can pass any output builder to the `Differ` class as longs as it implements the `DiffOutputBuilderInterface`.
105-
106-
#### Parsing diff
107-
108-
The `Parser` class can be used to parse a unified diff into an object graph:
109-
110-
```php
111-
use SebastianBergmann\Diff\Parser;
112-
use SebastianBergmann\Git;
113-
114-
$git = new Git('/usr/local/src/money');
115-
116-
$diff = $git->getDiff(
117-
'948a1a07768d8edd10dcefa8315c1cbeffb31833',
118-
'c07a373d2399f3e686234c4f7f088d635eb9641b'
119-
);
120-
121-
$parser = new Parser;
122-
123-
print_r($parser->parse($diff));
124-
```
125-
126-
The code above yields the output below:
127-
128-
Array
129-
(
130-
[0] => SebastianBergmann\Diff\Diff Object
131-
(
132-
[from:SebastianBergmann\Diff\Diff:private] => a/tests/MoneyTest.php
133-
[to:SebastianBergmann\Diff\Diff:private] => b/tests/MoneyTest.php
134-
[chunks:SebastianBergmann\Diff\Diff:private] => Array
135-
(
136-
[0] => SebastianBergmann\Diff\Chunk Object
137-
(
138-
[start:SebastianBergmann\Diff\Chunk:private] => 87
139-
[startRange:SebastianBergmann\Diff\Chunk:private] => 7
140-
[end:SebastianBergmann\Diff\Chunk:private] => 87
141-
[endRange:SebastianBergmann\Diff\Chunk:private] => 7
142-
[lines:SebastianBergmann\Diff\Chunk:private] => Array
143-
(
144-
[0] => SebastianBergmann\Diff\Line Object
145-
(
146-
[type:SebastianBergmann\Diff\Line:private] => 3
147-
[content:SebastianBergmann\Diff\Line:private] => * @covers SebastianBergmann\Money\Money::add
148-
)
149-
150-
[1] => SebastianBergmann\Diff\Line Object
151-
(
152-
[type:SebastianBergmann\Diff\Line:private] => 3
153-
[content:SebastianBergmann\Diff\Line:private] => * @covers SebastianBergmann\Money\Money::newMoney
154-
)
155-
156-
[2] => SebastianBergmann\Diff\Line Object
157-
(
158-
[type:SebastianBergmann\Diff\Line:private] => 3
159-
[content:SebastianBergmann\Diff\Line:private] => */
160-
)
161-
162-
[3] => SebastianBergmann\Diff\Line Object
163-
(
164-
[type:SebastianBergmann\Diff\Line:private] => 2
165-
[content:SebastianBergmann\Diff\Line:private] => public function testAnotherMoneyWithSameCurrencyObjectCanBeAdded()
166-
)
167-
168-
[4] => SebastianBergmann\Diff\Line Object
169-
(
170-
[type:SebastianBergmann\Diff\Line:private] => 1
171-
[content:SebastianBergmann\Diff\Line:private] => public function testAnotherMoneyObjectWithSameCurrencyCanBeAdded()
172-
)
173-
174-
[5] => SebastianBergmann\Diff\Line Object
175-
(
176-
[type:SebastianBergmann\Diff\Line:private] => 3
177-
[content:SebastianBergmann\Diff\Line:private] => {
178-
)
179-
180-
[6] => SebastianBergmann\Diff\Line Object
181-
(
182-
[type:SebastianBergmann\Diff\Line:private] => 3
183-
[content:SebastianBergmann\Diff\Line:private] => $a = new Money(1, new Currency('EUR'));
184-
)
185-
186-
[7] => SebastianBergmann\Diff\Line Object
187-
(
188-
[type:SebastianBergmann\Diff\Line:private] => 3
189-
[content:SebastianBergmann\Diff\Line:private] => $b = new Money(2, new Currency('EUR'));
190-
)
191-
)
192-
)
193-
)
194-
)
195-
)
5+
Please use [`sebastian/diff`](https://github.com/sebastianbergmann/diff) instead.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "sebastian/diff",
3-
"description": "Diff implementation",
2+
"name": "localheinz/diff",
3+
"description": "Fork of sebastian/diff for use with localheinz/composer-normalize",
44
"keywords": ["diff", "udiff", "unidiff", "unified diff"],
55
"homepage": "https://github.com/sebastianbergmann/diff",
66
"license": "BSD-3-Clause",

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.2/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
55
forceCoversAnnotation="true"
66
beStrictAboutCoversAnnotation="true"

src/Chunk.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
final class Chunk
1414
{

src/Diff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
final class Diff
1414
{

src/Differ.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

13-
use SebastianBergmann\Diff\Output\DiffOutputBuilderInterface;
14-
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
13+
use Localheinz\Diff\Output\DiffOutputBuilderInterface;
14+
use Localheinz\Diff\Output\UnifiedDiffOutputBuilder;
1515

1616
/**
1717
* Diff implementation.

src/Exception/ConfigurationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
final class ConfigurationException extends InvalidArgumentException
1414
{

src/Exception/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
interface Exception
1414
{

src/Exception/InvalidArgumentException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
class InvalidArgumentException extends \InvalidArgumentException implements Exception
1414
{

src/Line.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
final class Line
1414
{

src/LongestCommonSubsequenceCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
interface LongestCommonSubsequenceCalculator
1414
{

src/MemoryEfficientLongestCommonSubsequenceCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff;
11+
namespace Localheinz\Diff;
1212

1313
final class MemoryEfficientLongestCommonSubsequenceCalculator implements LongestCommonSubsequenceCalculator
1414
{

src/Output/AbstractChunkOutputBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff\Output;
11+
namespace Localheinz\Diff\Output;
1212

1313
abstract class AbstractChunkOutputBuilder implements DiffOutputBuilderInterface
1414
{

src/Output/DiffOnlyOutputBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
namespace SebastianBergmann\Diff\Output;
11+
namespace Localheinz\Diff\Output;
1212

13-
use SebastianBergmann\Diff\Differ;
13+
use Localheinz\Diff\Differ;
1414

1515
/**
1616
* Builds a diff string representation in a loose unified diff format

0 commit comments

Comments
 (0)