Commit 5db1e981 authored by Dillenn Terumalai's avatar Dillenn Terumalai
Browse files

// WIP

parent 9cdc0517
.DS_Store
.idea
.phpunit.result.cache
build
builds
composer.lock
coverage
docs
......
......@@ -9,11 +9,12 @@ before_script:
- docker-php-ext-install zip
- curl --silent --show-error "https://getcomposer.org/installer" | php -- --install-dir=/usr/local/bin --filename=composer
test:package:
script:
- composer install
- vendor/bin/phpunit
- vendor/bin/psalm
- vendor/bin/phpunit --colors=always
- vendor/bin/security-checker security:check composer.lock
publish:package:
image: curlimages/curl:latest
......
......@@ -29,6 +29,13 @@
},
"require-dev": {
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.6",
"enlightn/security-checker": "^1.6"
},
"scripts": {
"psalm": "vendor/bin/psalm",
"test": "vendor/bin/phpunit --colors=always",
"security-checker": "vendor/bin/security-checker security:check composer.lock"
}
}
<?xml version="1.0"?>
<psalm
errorLevel="4"
findUnusedVariablesAndParams="true"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
</psalm>
\ No newline at end of file
......@@ -35,7 +35,7 @@ class InterfaceMakeCommand extends GeneratorCommand
*
* @return string
*/
protected function getStub()
protected function getStub(): string
{
$stub = null;
......@@ -54,7 +54,7 @@ class InterfaceMakeCommand extends GeneratorCommand
* @param string $stub
* @return string
*/
protected function resolveStubPath($stub)
protected function resolveStubPath(string $stub)
{
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
? $customPath
......@@ -132,7 +132,7 @@ class InterfaceMakeCommand extends GeneratorCommand
*
* @throws InvalidArgumentException
*/
protected function parseModel($model)
protected function parseModel(string $model)
{
if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) {
throw new InvalidArgumentException('Model name contains invalid characters.');
......
......@@ -4,6 +4,7 @@ namespace Dterumal\RepositoryArtisan\Console;
use Illuminate\Console\Command;
use Illuminate\Console\GeneratorCommand;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Symfony\Component\Console\Input\InputOption;
......@@ -61,7 +62,7 @@ class RepositoryMakeCommand extends GeneratorCommand
* @param string $stub
* @return string
*/
protected function resolveStubPath($stub)
protected function resolveStubPath(string $stub)
{
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
? $customPath
......@@ -86,7 +87,7 @@ class RepositoryMakeCommand extends GeneratorCommand
*
* @param string $name
* @return string
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
* @throws FileNotFoundException
*/
protected function buildClass($name)
{
......@@ -180,9 +181,9 @@ class RepositoryMakeCommand extends GeneratorCommand
* @param string $model
* @return string
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
protected function parseModel($model)
protected function parseModel(string $model)
{
if (preg_match('([^A-Za-z0-9_/\\\\])', $model)) {
throw new InvalidArgumentException('Model name contains invalid characters.');
......@@ -197,9 +198,9 @@ class RepositoryMakeCommand extends GeneratorCommand
* @param string $interface
* @return string
*
* @throws \InvalidArgumentException
* @throws InvalidArgumentException
*/
protected function parseInterface($interface)
protected function parseInterface(string $interface)
{
if (preg_match('([^A-Za-z0-9_/\\\\])', $interface)) {
throw new InvalidArgumentException('Interface name contains invalid characters.');
......
<?php
namespace Dterumal\RepositoryArtisan\Tests\Unit;
use Dterumal\RepositoryArtisan\Tests\TestCase;
class ExampleTest extends TestCase
{
/** @test */
public function true_is_true()
{
$this->assertTrue(true);
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment