From 0e1325e775af2b80af82a9615e50e36948f369d0 Mon Sep 17 00:00:00 2001 From: Samantha Nguyen Date: Sat, 15 Mar 2025 14:11:38 -0500 Subject: [PATCH] chore: cleanup again --- .devcontainer/Dockerfile | 16 --------------- .devcontainer/devcontainer.json | 35 --------------------------------- .gitattributes | 4 ++++ LIBRARY.md | 14 ++++++------- README.md | 14 ++++++------- composer.json | 1 - src/Dog.php | 34 -------------------------------- src/HelloWorld.php | 9 +++++++++ src/IAnimal.php | 22 --------------------- tests/DogTest.php | 26 ------------------------ tests/HelloWorldTest.php | 18 +++++++++++++++++ 11 files changed, 44 insertions(+), 149 deletions(-) delete mode 100644 .devcontainer/Dockerfile delete mode 100644 .devcontainer/devcontainer.json delete mode 100644 src/Dog.php create mode 100644 src/HelloWorld.php delete mode 100644 src/IAnimal.php delete mode 100644 tests/DogTest.php create mode 100644 tests/HelloWorldTest.php diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index ec25cea..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/php/.devcontainer/base.Dockerfile - -# [Choice] PHP version (use -bullseye variants on local arm64/Apple Silicon): 8, 8.1, 8.0, 7, 7.4, 7.3, 8-bullseye, 8.1-bullseye, 8.0-bullseye, 7-bullseye, 7.4-bullseye, 7.3-bullseye, 8-buster, 8.1-buster, 8.0-buster, 7-buster, 7.4-buster -ARG VARIANT="8.1-apache-bullseye" -FROM mcr.microsoft.com/vscode/devcontainers/php:0-${VARIANT} - -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - -# [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index ccdb130..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,35 +0,0 @@ -// For format details: https://aka.ms/devcontainer.json -// For config options: https://github.com/devcontainers/images/tree/main/src/php -{ - "name": "PHP", - "build": { - "dockerfile": "./Dockerfile", - "context": "." - }, - "features": { - "ghcr.io/devcontainers/features/php:1": {}, - "ghcr.io/devcontainers/features/git:1": {} - }, - "customizations": { - "vscode": { - "settings": { - "php.validate.executablePath": "/usr/local/bin/php" - }, - "extensions": [ - "bmewburn.vscode-intelephense-client", - "felixfbecker.php-debug", - "ikappas.composer", - "mrmlnc.vscode-apache", - "neilbrayfield.php-docblocker" - ] - } - }, - - // Use 'forwardPorts' to make a list of ports inside - // the container available locally. - "forwardPorts": [8080], - - // Comment out to connect as root instead. - // More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode" -} diff --git a/.gitattributes b/.gitattributes index dfe0770..d6b893c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,6 @@ # Auto detect text files and perform LF normalization * text=auto + +# enable syntax highlighting with closest language +# available for Doxygen's configuration file +Doxyfile linguist-language=INI diff --git a/LIBRARY.md b/LIBRARY.md index 9b9faf8..6be059c 100644 --- a/LIBRARY.md +++ b/LIBRARY.md @@ -5,10 +5,10 @@ [license-badge]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square [license-url]: #license -[docs-badge]: https://img.shields.io/github/deployments/neoncitylights/php-template/github-pages?label=docs&style=flat-square -[docs-url]: https://neoncitylights.github.io/php/ -[ci-badge]: https://img.shields.io/github/actions/workflow/status/neoncitylights/php/.github/workflows/php.yml?style=flat-square -[ci-url]: https://github.com/neoncitylights/php/actions/workflows/php.yml +[docs-badge]: https://img.shields.io/github/deployments/php-lights/php/github-pages?label=docs&style=flat-square +[docs-url]: https://php-lights.github.io/php/ +[ci-badge]: https://img.shields.io/github/actions/workflow/status/php-lights/php/.github/workflows/php.yml?style=flat-square +[ci-url]: https://github.com/php-lights/php/actions/workflows/php.yml Describe the library. @@ -19,10 +19,10 @@ composer install author/package ## Usage ```php -use Neoncitylights\ExampleLibrary\Dog; +use Neoncitylights\ExampleLibrary\HelloWorld; -$dog = new Dog(); -$dog->bark(); // "Woof!" +$greet1 = HelloWorld::greet(); // 'Hello World' +$greet2 = HelloWorld::greet( 'Bob' ); // 'Hello Bob' ``` ## License diff --git a/README.md b/README.md index 3db0638..04ef8d1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# PHP Repository Template +# PHP template > This template is based on my past history with developing MediaWiki software, and largely based on MediaWiki's own repository template for PHP projects. > @@ -11,12 +11,11 @@ This repository makes it easier to develop a PHP application or library by provi ## Features - [x] [PHP 8.3+](https://www.php.net/releases/8.3/en.php) support -- [x] *Unit testing* with [PHPUnit](https://github.com/sebastianbergmann/phpunit/) ([official website](https://phpunit.de/)) +- [x] Unit testing with [PHPUnit](https://github.com/sebastianbergmann/phpunit/) ([official website](https://phpunit.de/)) - [x] Validates PHP syntax with [php-parallel-lint](https://github.com/php-parallel-lint/PHP-Parallel-Lint) - [x] Lint and auto-format PHP code with [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) (PHPCS) - [x] Continuous integration with [GitHub Actions](https://github.com/features/actions) - [x] auto-generated documentation with [phpDocumentor](https://www.phpdoc.org/), [GitHub Pages](https://docs.github.com/en/pages) -- [x] Remote development with [GitHub Codespaces](https://github.com/features/codespaces) - [x] Composer dependency updates auto-managed with Dependabot ## Getting started @@ -26,17 +25,16 @@ Choose a method: - **GitHub UI**: Press the "Use this template" button in the top-right corner of this page. - **GitHub CLI**: Install [GitHub CLI](https://cli.github.com). Then run one of the following: ```shell - gh repo create --template neoncitylights/php --public --clone {{repository}} # clone as public - gh repo create --template neoncitylights/php --private --clone {{repository}} # clone as private + gh repo create --template php-lights/php --public --clone {{repository}} # clone as public + gh repo create --template php-lights/php --private --clone {{repository}} # clone as private ``` ### Replace placeholders Using your text editor or IDE, find-and-replace the following placeholders: -- `{repo-name}`: Replace with the name of your repository - `author/package`: Replace with your own author and package name. -- `neoncitylights/php-template`: Replace with the name of your GitHub repository. +- `php-lights/php`: Replace with the name of your GitHub repository. - `Neoncitylights\ExampleLibrary`: Replace with your own namespace. - `Neoncitylights\\ExampleLibrary\\`: Replace with your own namespace (escaped version using double backslashes). @@ -58,7 +56,7 @@ Delete this `README.md`, and rename [`LIBRARY.md`](./LIBRARY.md) to `README.md`. ## License -This software is licensed under the MIT license ([`LICENSE-MIT`](./LICENSE) or ). +This software is licensed under the MIT license ([`LICENSE`](./LICENSE) or ). ### Contribution diff --git a/composer.json b/composer.json index 9438d2c..2de6fd2 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,6 @@ }, "config": { "allow-plugins": { - "composer/package-versions-deprecated": true, "dealerdirect/phpcodesniffer-composer-installer": true } } diff --git a/src/Dog.php b/src/Dog.php deleted file mode 100644 index 5e40cbe..0000000 --- a/src/Dog.php +++ /dev/null @@ -1,34 +0,0 @@ -name = $name; - $this->age = $age; - } - - public function getName(): string { - return $this->name; - } - - public function getAge(): float { - return $this->age; - } - - public function getType(): string { - return 'Dog'; - } - - public function getSound(): string { - return 'Woof!'; - } -} diff --git a/src/HelloWorld.php b/src/HelloWorld.php new file mode 100644 index 0000000..2abba88 --- /dev/null +++ b/src/HelloWorld.php @@ -0,0 +1,9 @@ +assertEquals( 'Ralph', ( new Dog( 'Ralph', 4.0 ) )->getName() ); - } - - public function testGetSound(): void { - $this->assertEquals( 'Woof!', ( new Dog( 'Charlie', 5.0 ) )->getSound() ); - } - - public function testGetType(): void { - $this->assertEquals( 'Dog', ( new Dog( 'Buddy', 3.2 ) )->getType() ); - } - - public function testGetAge(): void { - $this->assertEqualsWithDelta( 8.7, ( new Dog( 'Waffles', 8.7 ) )->getAge(), 0.0001 ); - } -} diff --git a/tests/HelloWorldTest.php b/tests/HelloWorldTest.php new file mode 100644 index 0000000..1d762b0 --- /dev/null +++ b/tests/HelloWorldTest.php @@ -0,0 +1,18 @@ +assertSame( 'Hello World', HelloWorld::greet() ); + } + + public function testWithArgument(): void { + $this->assertSame( 'Hello Bob', HelloWorld::greet( 'Bob' ) ); + } +}