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

Remove unused code + Improve GitHub actions #136

Merged
merged 3 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
| Is bugfix? | ✔️/❌
| New feature? | ✔️/❌
| Breaks BC? | ✔️/❌
| Fixed issues | comma-separated list of tickets # fixed by the PR, if any
26 changes: 13 additions & 13 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions.
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Too noisy. See https://github.community/t/increase-if-necessary-for-github-actions-in-dependabot/179581
open-pull-requests-limit: 0
# Maintain dependencies for GitHub Actions.
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Too noisy. See https://github.community/t/increase-if-necessary-for-github-actions-in-dependabot/179581
open-pull-requests-limit: 0

# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase-if-necessary
# Maintain dependencies for Composer
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase-if-necessary
24 changes: 22 additions & 2 deletions .github/workflows/bc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
on:
- pull_request
- push
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'
push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

name: backwards compatibility

jobs:
roave_bc_check:
uses: yiisoft/actions/.github/workflows/bc.yml@master
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -28,4 +29,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.0', '8.1']
['8.0', '8.1', '8.2', '8.3']
3 changes: 2 additions & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -30,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1']
['8.0', '8.1', '8.2', '8.3']
1 change: 1 addition & 0 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0']
['8.3']
3 changes: 2 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'phpunit.xml.dist'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -28,4 +29,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1']
['8.0', '8.1', '8.2', '8.3']
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 3.0.1 under development

- Bug #133: Don't add not substituted arguments to a query string (@rustamwin)
- Bug #133, #136: Don't add not substituted arguments to a query string (@rustamwin, @vjik)
- Bug #134: Don't add query string if it's empty (@rustamwin)

## 3.0.0 February 17, 2023
Expand Down
2 changes: 0 additions & 2 deletions src/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@
return rtrim($host, '/') . $url;
}

if ((empty($scheme) || $lastRequestScheme === null) && $host !== '' && $this->isRelative($host)) {

Check warning on line 104 in src/UrlGenerator.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "Identical": --- Original +++ New @@ @@ if ($scheme === null && !$this->isRelative($host)) { return rtrim($host, '/') . $url; } - if ((empty($scheme) || $lastRequestScheme === null) && $host !== '' && $this->isRelative($host)) { + if ((empty($scheme) || $lastRequestScheme !== null) && $host !== '' && $this->isRelative($host)) { $host = '//' . $host; } return $this->ensureScheme(rtrim($host, '/') . $url, $scheme ?? $lastRequestScheme);

Check warning on line 104 in src/UrlGenerator.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ if ($scheme === null && !$this->isRelative($host)) { return rtrim($host, '/') . $url; } - if ((empty($scheme) || $lastRequestScheme === null) && $host !== '' && $this->isRelative($host)) { + if ((empty($scheme) || $lastRequestScheme === null || $host !== '') && $this->isRelative($host)) { $host = '//' . $host; } return $this->ensureScheme(rtrim($host, '/') . $url, $scheme ?? $lastRequestScheme);
$host = '//' . $host;
}

return $this->ensureScheme(rtrim($host, '/') . $url, $scheme ?? $lastRequestScheme);

Check warning on line 108 in src/UrlGenerator.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "UnwrapRtrim": --- Original +++ New @@ @@ if ((empty($scheme) || $lastRequestScheme === null) && $host !== '' && $this->isRelative($host)) { $host = '//' . $host; } - return $this->ensureScheme(rtrim($host, '/') . $url, $scheme ?? $lastRequestScheme); + return $this->ensureScheme($host . $url, $scheme ?? $lastRequestScheme); } return $uri === null ? $url : $this->generateAbsoluteFromLastMatchedRequest($url, $uri, $scheme); }
}

return $uri === null ? $url : $this->generateAbsoluteFromLastMatchedRequest($url, $uri, $scheme);
Expand Down Expand Up @@ -157,7 +157,7 @@
{
$port = '';
$uriPort = $uri->getPort();
if ($uriPort !== 80 && $uriPort !== null) {

Check warning on line 160 in src/UrlGenerator.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ { $port = ''; $uriPort = $uri->getPort(); - if ($uriPort !== 80 && $uriPort !== null) { + if ($uriPort !== 79 && $uriPort !== null) { $port = ':' . $uriPort; } return $this->ensureScheme('://' . $uri->getHost() . $port . $url, $scheme ?? $uri->getScheme());

Check warning on line 160 in src/UrlGenerator.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ { $port = ''; $uriPort = $uri->getPort(); - if ($uriPort !== 80 && $uriPort !== null) { + if ($uriPort !== 81 && $uriPort !== null) { $port = ':' . $uriPort; } return $this->ensureScheme('://' . $uri->getHost() . $port . $url, $scheme ?? $uri->getScheme());
$port = ':' . $uriPort;
}

Expand Down Expand Up @@ -207,7 +207,7 @@
*/
private function isRelative(string $url): bool
{
return strncmp($url, '//', 2) && !str_contains($url, '://');

Check warning on line 210 in src/UrlGenerator.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ */ private function isRelative(string $url) : bool { - return strncmp($url, '//', 2) && !str_contains($url, '://'); + return strncmp($url, '//', 1) && !str_contains($url, '://'); } public function getUriPrefix() : string {
}

public function getUriPrefix(): string
Expand Down Expand Up @@ -264,7 +264,6 @@
*/
private function generatePath(array $arguments, array $queryParameters, array $parts): string
{
$notSubstitutedArguments = $arguments;
$path = $this->getUriPrefix();

foreach ($parts as $part) {
Expand Down Expand Up @@ -292,10 +291,9 @@
? rawurlencode($arguments[$part[0]])
: urlencode($arguments[$part[0]]);
}
unset($notSubstitutedArguments[$part[0]]);
}

$path = str_replace('//', '/', $path);

Check warning on line 296 in src/UrlGenerator.php

View workflow job for this annotation

GitHub Actions / mutation / PHP 8.1-ubuntu-latest

Escaped Mutant for Mutator "UnwrapStrReplace": --- Original +++ New @@ @@ $path .= $this->encodeRaw ? rawurlencode($arguments[$part[0]]) : urlencode($arguments[$part[0]]); } } - $path = str_replace('//', '/', $path); + $path = $path; $queryString = ''; if (!empty($queryParameters)) { $queryString = http_build_query($queryParameters);

$queryString = '';
if (!empty($queryParameters)) {
Expand Down
Loading