Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Jul 31, 2024
2 parents 2d8b3bd + f9d77a2 commit 72b8d96
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 46 deletions.
54 changes: 17 additions & 37 deletions .github/workflows/test-phpcpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- 'public/**.php'
- 'system/**.php'
- '.github/workflows/test-phpcpd.yml'

push:
branches:
- 'develop'
Expand All @@ -23,40 +22,21 @@ on:
- 'system/**.php'
- '.github/workflows/test-phpcpd.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
name: Duplicate Code Detection
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: phpcpd
extensions: dom, mbstring

- name: Detect code duplication
run: phpcpd
--exclude system/Test
--exclude system/ThirdParty
--exclude system/Database/SQLSRV/Builder.php
--exclude system/Database/SQLSRV/Forge.php
--exclude system/Database/MySQLi/Builder.php
--exclude system/Database/OCI8/Builder.php
--exclude system/Database/Postgre/Builder.php
--exclude system/Debug/Exceptions.php
--exclude system/HTTP/SiteURI.php
--exclude system/Validation/Rules.php
--exclude system/Autoloader/Autoloader.php
--exclude system/Config/Filters.php
-- app/ public/ system/
phpcpd:
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@main
with:
dirs: "app/ public/ system/"
options: >-
--exclude system/Test
--exclude system/ThirdParty
--exclude system/Database/SQLSRV/Builder.php
--exclude system/Database/SQLSRV/Forge.php
--exclude system/Database/MySQLi/Builder.php
--exclude system/Database/OCI8/Builder.php
--exclude system/Database/Postgre/Builder.php
--exclude system/Debug/Exceptions.php
--exclude system/HTTP/SiteURI.php
--exclude system/Validation/Rules.php
--exclude system/Autoloader/Autoloader.php
--exclude system/Config/Filters.php
13 changes: 6 additions & 7 deletions contributing/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ projects outside of CodeIgniter. Basically, this means that any
dependencies should be kept to a minimum. Any dependencies must be able
to be passed into the constructor. If you do need to use one of the
other core packages, you can create that in the constructor using the
`Services` class, as long as you provide a way for dependencies to
`service()` function, as long as you provide a way for dependencies to
override that:

```php
public function __construct(?Foo $foo = null)
{
$this->foo = $foo ?? \Config\Services::foo();
$this->foo = $foo ?? service('foo');
}
```

## Type declarations
## Type Declarations

PHP7 provides [Type declarations](https://www.php.net/manual/en/language.types.declarations.php)
for method parameters and return types. Use it where possible. Return type
Expand Down Expand Up @@ -112,10 +112,9 @@ should generally match the package name.

## Autoloader

All files within the package should be added to
**system/Config/AutoloadConfig.php**, in the "classmap" property. This
is only used for core framework files, and helps to minimize file system
scans and keep performance high.
All source files within the **system/ThirdParty** should be added to
**system/Config/AutoloadConfig.php**, in the `$coreClassmap` property. This
is only used for loading the third party packages without Composer.

## Command-Line Support

Expand Down
4 changes: 2 additions & 2 deletions contributing/pull_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ PHPStan is expected to scan the entire framework by running this command in your
terminal:

```console
vendor/bin/phpstan analyse
composer phpstan:check
```

See also:
Expand All @@ -272,7 +272,7 @@ false positive and should be ignored, the baseline can be updated with the follo
command:

```console
vendor/bin/phpstan analyze --generate-baseline phpstan-baseline.php
composer phpstan:baseline
```

#### Rector
Expand Down

0 comments on commit 72b8d96

Please sign in to comment.