-
-
Notifications
You must be signed in to change notification settings - Fork 8
Bump PHP to 8.1-8.4 + Enable BC checker
#44
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
Changes from all commits
7f6323e
39d1fb5
28c0fc5
be73d2f
080669d
e4e341d
4431011
6bfd4a1
f42c242
a5a0fb8
ba1fe29
bbeb8a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| on: | ||
| 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 | ||
| with: | ||
| os: >- | ||
| ['ubuntu-latest'] | ||
| php: >- | ||
| ['8.4'] | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,31 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
|
||
| <phpunit backupGlobals="false" | ||
| colors="true" | ||
| verbose="true" | ||
| <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
| bootstrap="vendor/autoload.php" | ||
| cacheDirectory=".phpunit.cache" | ||
| requireCoverageMetadata="false" | ||
| beStrictAboutCoverageMetadata="true" | ||
| beStrictAboutOutputDuringTests="true" | ||
| executionOrder="random" | ||
| failOnRisky="true" | ||
| failOnWarning="true"> | ||
| failOnWarning="true" | ||
| stopOnFailure="false" | ||
| colors="true" | ||
| displayDetailsOnPhpunitDeprecations="true" | ||
| > | ||
| <php> | ||
| <ini name="error_reporting" value="-1"/> | ||
| </php> | ||
|
|
||
| <testsuites> | ||
| <testsuite name="Yii Request body parsers tests"> | ||
| <testsuite name="Yii Request Body Parser tests"> | ||
| <directory>./tests</directory> | ||
| </testsuite> | ||
| </testsuites> | ||
|
|
||
| <coverage> | ||
| <source> | ||
| <include> | ||
| <directory>./src</directory> | ||
| <directory suffix=".php">./src</directory> | ||
| </include> | ||
| </coverage> | ||
| </source> | ||
| </phpunit> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ | |
| public function __construct( | ||
| ResponseFactoryInterface $responseFactory, | ||
| ContainerInterface $container, | ||
| BadRequestHandlerInterface $badRequestHandler = null | ||
| BadRequestHandlerInterface|null $badRequestHandler = null | ||
| ) { | ||
| $this->container = $container; | ||
| $this->badRequestHandler = $badRequestHandler ?? new BadRequestHandler($responseFactory); | ||
|
|
@@ -89,7 +89,7 @@ | |
| return $new; | ||
| } | ||
| foreach ($mimeTypes as $mimeType) { | ||
| $this->validateMimeType($mimeType); | ||
|
Check warning on line 92 in src/RequestBodyParser.php
|
||
| unset($new->parsers[$this->normalizeMimeType($mimeType)]); | ||
| } | ||
| return $new; | ||
|
|
@@ -114,7 +114,7 @@ | |
| try { | ||
| /** @var mixed $parsed */ | ||
| $parsed = $parser->parse((string)$request->getBody()); | ||
| if ($parsed !== null && !is_object($parsed) && !is_array($parsed)) { | ||
|
Check warning on line 117 in src/RequestBodyParser.php
|
||
| $parserClass = get_class($parser); | ||
| throw new RuntimeException( | ||
| "$parserClass::parse() return value must be an array, an object, or null." | ||
|
|
@@ -147,12 +147,12 @@ | |
| private function getContentType(ServerRequestInterface $request): ?string | ||
| { | ||
| $contentType = $request->getHeaderLine(Header::CONTENT_TYPE); | ||
| if (trim($contentType) !== '') { | ||
|
Check warning on line 150 in src/RequestBodyParser.php
|
||
| if (str_contains($contentType, ';')) { | ||
| $contentTypeParts = explode(';', $contentType, 2); | ||
| return strtolower(trim($contentTypeParts[0])); | ||
| } | ||
| return strtolower(trim($contentType)); | ||
|
Check warning on line 155 in src/RequestBodyParser.php
|
||
| } | ||
| return null; | ||
| } | ||
|
|
||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 5 months ago
To fix the problem, you should add a
permissionsblock that explicitly limits the permissions available to the workflow. The best approach is to add this block at the workflow (top) level unless you know the job requires more elevated permissions than read-only. Since the job appears to merely check backward compatibility via a reusable workflow and likely does not need to write to the repository or create/update pull requests, a minimalcontents: readpermission is the least privileged and safest starting point. You should insert the following block near the top of the file, immediately after thename:property (line 25), so it applies to all jobs in the workflow:No additional methods, definitions, or library installations are necessary—just this single insertion.