Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Move repository to contao/phpstan
Browse files Browse the repository at this point in the history
* Refactor for contao/phpstan namespace
* Fix requirements for --prefer-lowest tests
* Remove unused dependency
* Rename PHPStan to PhpStan
  • Loading branch information
bytehead committed Aug 22, 2018
1 parent 1676682 commit f079e62
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 78 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ This extension provides following features:

* Provides correct return types for Contao services.

[![Author](https://img.shields.io/badge/author-@1upgmbh-blue.svg?style=flat-square)](https://twitter.com/1upgmbh)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Travis CI](https://travis-ci.org/1up-lab/phpstan-contao.svg?style=flat-square&branch=master)](https://travis-ci.org/1up-lab/phpstan-contao)
[![Coverage Status](https://coveralls.io/repos/github/1up-lab/phpstan-contao/badge.svg?style=flat-square&branch=master)](https://coveralls.io/github/1up-lab/phpstan-contao?branch=master)
[![Total Downloads](https://poser.pugx.org/oneup/phpstan-contao/downloads?style=flat-square)](https://packagist.org/packages/oneup/phpstan-contao)
[![](https://img.shields.io/travis/contao/phpstan/master.svg?style=flat-square)](https://travis-ci.org/contao/phpstan/)
[![](https://img.shields.io/coveralls/contao/phpstan/master.svg?style=flat-square)](https://coveralls.io/github/contao/phpstan)
[![](https://img.shields.io/packagist/v/contao/phpstan.svg?style=flat-square)](https://packagist.org/packages/contao/phpstan)
[![](https://img.shields.io/packagist/dt/contao/phpstan.svg?style=flat-square)](https://packagist.org/packages/contao/phpstan)


## Usage

To use this extension, require it in [Composer](https://getcomposer.org/):

```bash
composer require --dev oneup/phpstan-contao
composer require --dev contao/phpstan
```

And include extension.neon in your project's PHPStan config:

```
includes:
- vendor/oneup/phpstan-contao/extension.neon
- vendor/contao/phpstan/extension.neon
- vendor/phpstan/phpstan-symfony/extension.neon
parameters:
contao:
services_yml_path: %currentWorkingDirectory%/src/Resources/config/services.yml
symfony:
container_xml_path: %currentWorkingDirectory%/vendor/oneup/phpstan-contao/var/cache/dev/appDevPHPStanProjectContainer.xml
container_xml_path: %currentWorkingDirectory%/vendor/contao/phpstan/var/cache/dev/appDevPHPStanProjectContainer.xml
```

## Limitations
Expand Down
92 changes: 44 additions & 48 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
{
"name": "oneup/phpstan-contao",
"description": "Contao Framework extensions and rules for PHPStan",
"license": "MIT",
"authors": [
{
"name": "David Greminger",
"homepage": "https://github.com/bytehead"
}
],
"require": {
"php": "^7.1",
"phpstan/phpstan": "^0.10.2",
"phpstan/phpstan-symfony": "^0.10",
"symfony/debug": "^4.1",
"symfony/monolog-bundle": "^3.3",
"symfony/monolog-bridge": "^3.0 || ^4.0",
"symfony/templating": "^3.1 || ^4.0"
},
"require-dev": {
"contao/core-bundle": "^4.5.999",
"contao/test-case": "^1.1",
"friendsofphp/php-cs-fixer": "^2.12",
"lexik/maintenance-bundle": "^2.1.3",
"php-coveralls/php-coveralls": "^2.1",
"php-http/guzzle6-adapter": "^1.1",
"phpunit/phpunit": "^7.2",
"symfony/var-dumper": "^4.1"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"Oneup\\PHPStan\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Oneup\\PHPStan\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"support": {
"email": "hello@1up.io",
"issues": "https://github.com/1up-lab/phpstan-contao/issues",
"source": "https://github.com/1up-lab/phpstan-contao"
}
"name": "contao/phpstan",
"description": "Contao Framework extensions and rules for PHPStan",
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "David Greminger",
"homepage": "https://github.com/bytehead"
}
],
"require": {
"php": "^7.1",
"friendsofsymfony/http-cache-bundle": "^2.3",
"phpstan/phpstan": "^0.10.2",
"phpstan/phpstan-symfony": "^0.10",
"symfony/debug": "^4.1",
"symfony/monolog-bridge": "^3.0 || ^4.0",
"symfony/monolog-bundle": "^3.3",
"symfony/templating": "^3.1 || ^4.0"
},
"require-dev": {
"contao/core-bundle": "^4.5.999",
"contao/test-case": "^1.1",
"friendsofphp/php-cs-fixer": "^2.12",
"lexik/maintenance-bundle": "^2.1.3",
"php-coveralls/php-coveralls": "^2.1",
"php-http/guzzle6-adapter": "^1.1",
"phpunit/phpunit": "^7.2",
"symfony/var-dumper": "^4.1"
},
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"Contao\\PhpStan\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Contao\\PhpStan\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
12 changes: 6 additions & 6 deletions extension.neon
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
services:
-
class: Oneup\PHPStan\Type\Contao\ContainerInterfaceDynamicMethodReturnTypeExtension
class: Contao\PHPStan\Type\Contao\ContainerInterfaceDynamicMethodReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension
-
class: Oneup\PHPStan\Type\Contao\ContainerAwareInterfaceDynamicMethodReturnTypeExtension
class: Contao\PHPStan\Type\Contao\ContainerAwareInterfaceDynamicMethodReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

-
class: Oneup\PHPStan\Type\Contao\ContaoFrameworkDynamicMethodReturnTypeExtension
class: Contao\PHPStan\Type\Contao\ContaoFrameworkDynamicMethodReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

-
class: Oneup\PHPStan\Type\Contao\ContaoTestCaseDynamicMethodReturnTypeExtension
class: Contao\PHPStan\Type\Contao\ContaoTestCaseDynamicMethodReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

-
class: Oneup\PHPStan\Reflection\Contao\BackendTemplateClassReflectionExtension
class: Contao\PHPStan\Reflection\Contao\BackendTemplateClassReflectionExtension
tags:
- phpstan.broker.propertiesClassReflectionExtension

- Oneup\PHPStan\Contao\ServiceHelper(%contao.services_yml_path%)
- Contao\PHPStan\Contao\ServiceHelper(%contao.services_yml_path%)
2 changes: 1 addition & 1 deletion src/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan;
namespace Contao\PhpStan;

use Contao\CoreBundle\ContaoCoreBundle;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Reflection\Contao;
namespace Contao\PhpStan\Reflection;

use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\PropertiesClassReflectionExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Reflection\Contao;
namespace Contao\PhpStan\Reflection;

use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\PropertyReflection;
Expand Down
2 changes: 1 addition & 1 deletion src/Contao/Service.php → src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Contao;
namespace Contao\PhpStan;

final class Service
{
Expand Down
3 changes: 1 addition & 2 deletions src/Contao/ServiceHelper.php → src/ServiceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Contao;
namespace Contao\PhpStan;

use Oneup\PHPStan\AppKernel;
use PhpParser\Node\Expr;
use PHPStan\Analyser\Scope;
use PHPStan\Type\TypeUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Type\Contao;
namespace Contao\PhpStan\Type;

use Oneup\PHPStan\Contao\Service;
use Oneup\PHPStan\Contao\ServiceHelper;
use Contao\PhpStan\Service;
use Contao\PhpStan\ServiceHelper;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\MethodReflection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Type\Contao;
namespace Contao\PhpStan\Type;

use PHPStan\Reflection\MethodReflection;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Type\Contao;
namespace Contao\PhpStan\Type;

use PHPStan\Reflection\MethodReflection;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Type\Contao;
namespace Contao\PhpStan\Type;

use Contao\CoreBundle\Framework\ContaoFramework;
use PhpParser\Node\Arg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Type\Contao;
namespace Contao\PhpStan\Type;

use Contao\TestCase\ContaoTestCase;
use PhpParser\Node\Arg;
Expand Down
Empty file.
25 changes: 25 additions & 0 deletions tests/ServiceHelperTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Contao\PhpStan\Tests;

use Contao\PhpStan\ServiceHelper;
use PHPUnit\Framework\TestCase;

class ServiceHelperTest extends TestCase
{
public function testCanBeInstantiated(): void
{
$serviceHelper = new ServiceHelper(__DIR__.'/Resources/config/empty_services.yml');

$this->assertInstanceOf('Contao\PhpStan\ServiceHelper', $serviceHelper);
}

public function testEmptyServicesYml(): void
{
$serviceHelper = new ServiceHelper(__DIR__.'/Resources/config/empty_services.yml');

$this->assertNull($serviceHelper->getService('foobar.id'));
}
}
6 changes: 3 additions & 3 deletions tests/Contao/ServiceTest.php → tests/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Oneup\PHPStan\Tests\Contao;
namespace Contao\PhpStan\Tests;

use Oneup\PHPStan\Contao\Service;
use Contao\PhpStan\Service;
use PHPUnit\Framework\TestCase;

class ServiceTest extends TestCase
Expand All @@ -25,7 +25,7 @@ public function setUp()/* The :void return type declaration that should be here

public function testCanBeInstantiated(): void
{
$this->assertInstanceOf('Oneup\PHPStan\Contao\Service', $this->service);
$this->assertInstanceOf('Contao\PhpStan\Service', $this->service);
}

public function testReturnsValidId(): void
Expand Down

0 comments on commit f079e62

Please sign in to comment.